:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a202c;
    --bg-tertiary: #2d3748;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --accent-blue: #4299e1;
    --accent-purple: #9f7aea;
    --accent-gold: #ecc94b;
    --accent-teal: #38b2ac;
    --gradient-primary: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    --gradient-gold: linear-gradient(135deg, var(--accent-gold), #f6ad55);
    --shadow-glow: 0 0 30px rgba(66, 153, 225, 0.3);
    --border-radius: 12px;
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-serif: 'Crimson Pro', Georgia, serif;
}

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

body {
    font-family: var(--font-display);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.ambient-bg {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(66, 153, 225, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(159, 122, 234, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(236, 201, 75, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Header */
.header {
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
    position: relative;
    z-index: 10;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.city-icon {
    width: 60px;
    height: 40px;
    color: var(--accent-blue);
    filter: drop-shadow(0 0 10px rgba(66, 153, 225, 0.5));
}

.logo-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Input section */
.input-section {
    margin-bottom: 2rem;
}

.search-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    padding: 0.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.05);
    border: 1px solid rgba(66, 153, 225, 0.2);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-family: var(--font-display);
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.generate-btn {
    background: var(--gradient-primary);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    color: white;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(66, 153, 225, 0.4);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-top: 0.5rem;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 100;
}

.suggestion-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.suggestion-item:hover {
    background: rgba(66, 153, 225, 0.2);
}

.suggestion-name {
    font-weight: 500;
}

.suggestion-country {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.example-cities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
    align-items: center;
}

.example-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.city-chip {
    background: var(--bg-tertiary);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.city-chip:hover:not(:disabled) {
    background: rgba(66, 153, 225, 0.2);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.city-chip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.options-toggle {
    display: block;
    margin: 1.5rem auto 0;
    background: transparent;
    border: 1px solid var(--text-muted);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s;
}

.options-toggle:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.options-panel {
    max-width: 700px;
    margin: 1.5rem auto 0;
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 12px;
    display: grid;
    gap: 1.5rem;
    animation: slideDown 0.3s ease;
}

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

.option-group h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option-btn {
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.option-btn:hover {
    border-color: var(--accent-blue);
}

.option-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

/* Progress section */
.progress-section {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--bg-tertiary);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-stage {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    opacity: 0.4;
    transition: all 0.3s;
    position: relative;
}

.progress-stage.active {
    opacity: 1;
    background: rgba(66, 153, 225, 0.1);
}

.progress-stage.completed {
    opacity: 0.7;
}

.progress-icon {
    font-size: 1.25rem;
}

.progress-text {
    font-size: 0.95rem;
}

.progress-pulse {
    position: absolute;
    right: 1rem;
    width: 10px;
    height: 10px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

.progress-bar {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.5s ease;
}

/* Error message */
.error-message {
    max-width: 500px;
    margin: 1rem auto;
    padding: 1rem 1.5rem;
    background: rgba(245, 101, 101, 0.1);
    border: 1px solid rgba(245, 101, 101, 0.3);
    border-radius: 8px;
    color: #fc8181;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.retry-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid currentColor;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    color: inherit;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s;
}

.retry-btn:hover {
    background: rgba(245, 101, 101, 0.2);
}

/* Result section */
.result-section {
    margin: 2rem 0;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .result-container {
        grid-template-columns: 1fr;
    }
}

.image-container {
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 9/16;
    max-height: 80vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.image-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.result-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s;
}

.result-image.loaded {
    opacity: 1;
}

.result-info {
    position: sticky;
    top: 2rem;
}

.result-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.era-cards {
    margin-bottom: 2rem;
}

.era-cards h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.era-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    border-left: 3px solid var(--era-color);
    transition: all 0.2s;
}

.era-card:hover {
    background: rgba(45, 55, 72, 0.8);
}

.era-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
}

.era-badge {
    background: var(--era-color);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.era-titles {
    flex: 1;
    min-width: 0;
}

.era-titles h4 {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.era-local-name {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.era-period {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.era-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.era-content {
    padding: 0 1rem 1rem;
    animation: slideDown 0.3s ease;
}

.era-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.era-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.era-details h5 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.era-landmarks ul {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.era-landmarks li::before {
    content: '• ';
    color: var(--era-color);
}

.char-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.char-tag {
    background: var(--bg-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-btn {
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.action-btn.primary {
    background: var(--gradient-primary);
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(66, 153, 225, 0.4);
}

.action-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.2);
}

.action-btn.secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-blue);
}

.action-btn.tertiary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-muted);
}

.action-btn.tertiary:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Gallery section */
.gallery-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.gallery-section h2 {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 9/16;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    display: flex;
    flex-direction: column;
}

.gallery-city {
    font-weight: 600;
    font-size: 0.85rem;
}

.gallery-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    padding: 2rem;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-link {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--accent-purple);
}

.footer-divider {
    opacity: 0.3;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .logo-text h1 {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .generate-btn {
        width: 100%;
    }
    
    .example-cities {
        gap: 0.4rem;
    }
    
    .city-chip {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .result-title {
        font-size: 1.5rem;
    }
    
    .era-details {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        text-align: center;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}