/* Modern Sleek Apple-Inspired Theme */
:root {
    --dark-blue: #1d1d1f;
    --medium-blue: #2c2c2e;
    --accent-blue: #0071e3;
    --light-blue: #06c;
    --cream-white: #f5f5f7;
    --cream-light: #ffffff;
    --cream-dark: #d2d2d7;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-strong: rgba(0, 0, 0, 0.15);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --glass-bg: rgba(255, 255, 255, 0.72);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overscroll-behavior: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--cream-white);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--medium-blue) 100%);
    color: var(--cream-light);
    padding: 2rem 2rem 1.5rem 2rem;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow-strong);
}

.header-content {
    position: relative;
}

.header-home-link {
    text-decoration: none;
    color: inherit;
}

.header-home-link:hover h1 {
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

header h1 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

header h1 i {
    margin-right: 1rem;
    color: var(--cream-light);
}

header p {
    font-size: 1.1rem;
    opacity: 0.85;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.api-button {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.6rem 1.5rem;
    background: transparent;
    color: var(--cream-light);
    border: 2px solid var(--cream-light);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    display: inline-block;
}

.api-button:hover {
    background: var(--cream-light);
    color: var(--dark-blue);
    transform: translateY(-50%) scale(1.05);
}

footer {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--medium-blue) 100%);
    color: var(--cream-light);
    padding: 1.5rem 2rem;
    text-align: center;
    box-shadow: 0 -2px 10px var(--shadow-strong);
    margin-top: auto;
}

footer p {
    font-size: 1rem;
    opacity: 0.85;
    font-weight: 400;
    letter-spacing: 0.01em;
    margin: 0;
}

/* API Info Page */
.api-content {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

.api-info-section {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.api-info-section h2 {
    font-size: 2rem;
    color: var(--dark-blue);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.api-info-section h2 i {
    margin-right: 0.5rem;
    color: var(--accent-blue);
}

.api-status-text {
    font-size: 1.3rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Infinite Marquee Slider */
.marquee-container {
    width: 100%;
    overflow: hidden;
    background: var(--cream-white);
    padding: 1.5rem 0;
    position: relative;
}

.marquee-container::before,
.marquee-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    z-index: 10;
    pointer-events: none;
}

.marquee-container::before {
    left: 0;
    background: linear-gradient(to right, var(--cream-white), transparent);
}

.marquee-container::after {
    right: 0;
    background: linear-gradient(to left, var(--cream-white), transparent);
}

.marquee-track {
    display: flex;
    gap: 1.5rem;
    animation: marquee 40s linear infinite;
    width: fit-content;
}

.marquee-track:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.marquee-item {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.marquee-item:hover {
    transform: scale(1.1);
    z-index: 20;
}

.marquee-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 4px 16px var(--shadow);
    display: block;
}

.container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 90%;
    flex: 1;
}

/* Top Row: Two equal columns side-by-side */
.top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Middle Row: Centered button */
.middle-row {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Bottom Row: Full width result */
.bottom-row {
    display: flex;
    width: 100%;
}

.quadrant {
    background: var(--cream-light);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 2px 16px var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quadrant:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-strong);
}

.quadrant h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    letter-spacing: -0.3px;
}

.quadrant h2 i {
    margin-right: 0.5rem;
    color: var(--accent-blue);
}

/* Map Quadrant */
.map-quadrant {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 450px;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#location-search {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--cream-light);
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#location-search:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

#search-btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
}

#search-btn:hover {
    background: var(--light-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
}

#map {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--shadow);
    min-height: 300px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Generate Button Section (No Card Styling) */
.generate-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    background: transparent;
    padding: 0;
}

.generate-container {
    display: flex;
    gap: 1rem;
    max-width: 500px;
}

.generate-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
    letter-spacing: -0.2px;
}

.generate-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35);
    background: var(--light-blue);
}

.generate-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.generate-button i {
    margin-right: 0.5rem;
}

.settings-toggle-button {
    width: 56px;
    height: 56px;
    background: var(--glass-bg);
    color: var(--accent-blue);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow);
}

.settings-toggle-button:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-strong);
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 35, 50, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.settings-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.settings-modal-content {
    background: var(--cream-light);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.settings-modal-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.3px;
}

.settings-modal-header h2 i {
    margin-right: 0.5rem;
    color: var(--accent-blue);
}

.close-settings-button {
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-settings-button:hover {
    background: rgba(0, 0, 0, 0.1);
}

.settings-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.status-message {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    display: none;
    max-width: 500px;
    width: 100%;
}

.status-message.show {
    display: block;
}

.status-message.loading {
    background: rgba(58, 90, 122, 0.1);
    color: var(--accent-blue);
}

.status-message.success {
    background: rgba(46, 204, 113, 0.1);
    color: #27ae60;
}

.status-message.error {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

/* Weather Quadrant */
.weather-quadrant {
    display: flex;
    flex-direction: column;
    min-height: 450px;
}

#weather-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.placeholder-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}

.placeholder-text i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.placeholder-text p {
    font-size: 1rem;
    font-weight: 400;
}

#weather-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

.weather-header h3 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0;
}

#weather-icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.weather-main {
    text-align: center;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.05) 0%, rgba(0, 113, 227, 0.02) 100%);
    border-radius: 16px;
    border: 1px solid rgba(0, 113, 227, 0.1);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.temperature {
    font-size: 4rem;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -2px;
}

.weather-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-transform: capitalize;
    font-weight: 500;
}

.weather-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    flex-shrink: 1;
    min-height: 0;
}

.detail-item {
    background: var(--glass-bg);
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 0;
}

.detail-item:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.detail-item i {
    color: var(--accent-blue);
    font-size: 1.1rem;
}

.detail-item span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.detail-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.setting-input {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--cream-light);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.setting-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

/* Image Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 35, 50, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.image-modal.show {
    display: flex;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.close-image-modal-button {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.75rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 2001;
}

.close-image-modal-button:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Image Quadrant */
.image-quadrant {
    flex: 1;
    min-height: 400px;
    width: 100%;
}

#image-display {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#image-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#generated-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 8px 24px var(--shadow-strong);
    background: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#generated-image:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px var(--shadow-strong);
}

@media (prefers-reduced-motion: reduce) {
    #generated-image:hover {
        transform: none;
    }
    
    .image-modal,
    .image-modal-content {
        animation: none;
    }
    
    .close-image-modal-button:hover {
        transform: none;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .top-row {
        grid-template-columns: 1fr;
    }
    
    .map-quadrant {
        height: 400px;
    }
    
    .weather-quadrant {
        min-height: 400px;
    }
    
    .quadrant {
        min-height: 350px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 1rem;
        gap: 1rem;
    }
    
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    header p {
        font-size: 0.95rem;
    }
    
    .api-button {
        display: none;
    }
    
    .marquee-item {
        width: 150px;
        height: 150px;
    }
    
    .map-quadrant {
        height: 350px;
        overflow: hidden;
    }
    
    #map {
        min-height: 250px;
    }
    
    .weather-quadrant {
        min-height: 350px;
    }
    
    .quadrant {
        padding: 1rem;
        min-height: 300px;
    }
    
    .quadrant h2 {
        font-size: 1.25rem;
    }
    
    .generate-container {
        flex-direction: column;
        width: 100%;
        padding: 0 1rem;
    }
    
    .generate-button {
        width: 100%;
    }
    
    .settings-toggle-button {
        width: 100%;
        height: 48px;
    }
    
    .temperature {
        font-size: 3rem;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .settings-modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    footer {
        padding: 1rem;
    }
    
    footer p {
        font-size: 0.9rem;
    }
}
