/* Norwegian/Scandinavian Minimalist Design System */

:root {
    /* Color Palette - Inspired by Norwegian nature and minimalism */
    --color-bg: #FAFAFA;
    --color-surface: #FFFFFF;
    --color-text-primary: #1A1A1A;
    --color-text-secondary: #6B7280;
    --color-accent: #2563EB;
    --color-accent-hover: #1D4ED8;
    --color-border: #E5E7EB;
    --color-shadow: rgba(0, 0, 0, 0.04);

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;

    /* Spacing - Based on 8px grid */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Navigation */
.nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-image {
    height: 40px;
    width: auto;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.logo {
    font-size: var(--font-size-xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

.nav-links {
    display: flex;
    gap: var(--space-2);
}

.nav-link {
    background: transparent;
    border: none;
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg);
}

.nav-link.active {
    color: var(--color-accent);
    background: rgba(37, 99, 235, 0.08);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.auth-button {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-button:hover {
    background: var(--color-accent-hover);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

#user-email {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.sign-out-button {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sign-out-button:hover {
    border-color: var(--color-text-secondary);
    color: var(--color-text-primary);
}

/* Main Content */
.main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
    width: 100%;
    padding-bottom: 120px; /* Space for player */
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Section Title */
.section-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-6);
    color: var(--color-text-primary);
}

/* Search */
.search-container {
    margin-bottom: var(--space-8);
}

.search-input {
    width: 100%;
    padding: var(--space-4);
    font-size: var(--font-size-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Podcast Grid */
.podcast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-6);
}

.podcast-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--color-border);
}

.podcast-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px var(--color-shadow);
}

.podcast-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.podcast-card-content {
    padding: var(--space-4);
}

.podcast-card-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-1);
    color: var(--color-text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.podcast-card-author {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Subscriptions */
.subscriptions-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.subscription-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--color-border);
}

.subscription-card:hover {
    box-shadow: 0 4px 12px var(--color-shadow);
}

.subscription-card img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.subscription-info {
    flex: 1;
}

.subscription-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.subscription-author {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.unsubscribe-button {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.unsubscribe-button:hover {
    background: #FEE2E2;
    border-color: #EF4444;
    color: #EF4444;
}

.unsubscribe-icon {
    display: none;
    flex-shrink: 0;
}

.unsubscribe-text {
    display: inline;
}

/* Podcast Header */
.back-button {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    cursor: pointer;
    padding: var(--space-2) 0;
    margin-bottom: var(--space-6);
    transition: all 0.2s ease;
}

.back-button:hover {
    color: var(--color-text-primary);
}

.podcast-header {
    display: flex;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
    background: var(--color-surface);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.podcast-header img {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

.podcast-details {
    flex: 1;
}

.podcast-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    line-height: 1.2;
}

.podcast-author {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

.podcast-description {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-4);
}

.subscribe-button {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.subscribe-button:hover {
    background: var(--color-accent-hover);
}

.subscribe-button.subscribed {
    background: var(--color-border);
    color: var(--color-text-secondary);
}

/* Episodes List */
.episodes-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.episode-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--color-border);
}

.episode-card:hover {
    box-shadow: 0 4px 12px var(--color-shadow);
}

.episode-card.playing {
    border-color: var(--color-accent);
    background: rgba(37, 99, 235, 0.02);
}

.episode-podcast-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.episode-podcast-badge img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.episode-podcast-badge span {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

.episode-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

.episode-meta {
    display: flex;
    gap: var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.episode-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.episode-progress-bar {
    width: 100%;
    height: 3px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    margin-top: var(--space-3);
    overflow: hidden;
}

.episode-progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.completed-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #10B981;
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    margin-left: var(--space-2);
    vertical-align: middle;
}

/* Audio Player */
.player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--space-4) var(--space-6);
    z-index: 200;
    box-shadow: 0 -4px 12px var(--color-shadow);
}

.player-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.player-info {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.player-artwork {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.player-text {
    flex: 1;
    min-width: 0;
}

.player-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-podcast {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
}

.control-button {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-button:hover {
    background: var(--color-bg);
}

.control-button-primary {
    background: var(--color-accent);
    color: white;
    padding: var(--space-3);
}

.control-button-primary:hover {
    background: var(--color-accent-hover);
}

.player-progress {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.time {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    min-width: 45px;
    text-align: center;
}

.progress-bar {
    flex: 1;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.progress-bar::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-6);
    color: var(--color-text-secondary);
}

.empty-state h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 150;
    transition: all 0.3s ease;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--color-text-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--color-surface);
    z-index: 200;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -4px 0 12px var(--color-shadow);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.mobile-menu-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text-primary);
}

.mobile-menu-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    color: var(--color-text-primary);
}

.mobile-menu-content {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.mobile-nav-link {
    background: transparent;
    border: none;
    padding: var(--space-4);
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
    text-align: left;
}

.mobile-nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg);
}

.mobile-nav-link.active {
    color: var(--color-accent);
    background: rgba(37, 99, 235, 0.08);
}

.mobile-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-4) 0;
}

.mobile-auth-button {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.mobile-auth-button:hover {
    background: var(--color-accent-hover);
}

.mobile-user-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.mobile-user-email {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    padding: var(--space-2);
}

.mobile-sign-out-button {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-sign-out-button:hover {
    border-color: var(--color-text-secondary);
    color: var(--color-text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Show hamburger menu on mobile */
    .hamburger {
        display: flex;
    }

    /* Hide desktop nav links on mobile */
    .nav-links {
        display: none;
    }

    /* Hide desktop user menu on mobile */
    .user-menu {
        display: none;
    }

    /* Show icon-only unsubscribe button on mobile */
    .unsubscribe-button {
        padding: var(--space-2);
        min-width: auto;
    }

    .unsubscribe-icon {
        display: block;
    }

    .unsubscribe-text {
        display: none;
    }

    .podcast-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--space-4);
    }

    .podcast-header {
        flex-direction: column;
    }

    .podcast-header img {
        width: 100%;
        max-width: 300px;
        height: auto;
        margin: 0 auto;
    }

    .subscription-card img {
        width: 60px;
        height: 60px;
    }

    .player-content {
        gap: var(--space-3);
    }

    .player-artwork {
        width: 48px;
        height: 48px;
    }

    .footer {
        padding: var(--space-6) var(--space-4);
        padding-bottom: 100px; /* Extra padding to account for fixed player on mobile */
    }
}

/* Footer */
.footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--space-8) var(--space-6);
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin: 0;
}

/* Auth Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-content h2 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--space-3);
    color: var(--color-text-primary);
}

.modal-description {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
    line-height: 1.6;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.auth-input {
    width: 100%;
    padding: var(--space-4);
    font-size: var(--font-size-base);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.auth-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-submit {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-submit:hover {
    background: var(--color-accent-hover);
}

.auth-note {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-align: center;
    margin-top: var(--space-4);
}

.close-modal {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
}

.close-modal:hover {
    color: var(--color-text-primary);
}
