/* ── Modern Variables & Theme ── */
:root {
    /* Base Colors */
    --bg-primary: #09090b;
    --bg-secondary: #121217;
    --bg-tertiary: #1c1c24;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #52525b;
    --text-accent: #3b82f6;

    /* Accents (Gradients) */
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);

    /* Semantic Colors */
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);
    --color-glow: rgba(59, 130, 246, 0.5);

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --header-height: 70px;
    --container-width: 1200px;

    /* Effects */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --blur-bg: blur(12px);
}

/* ── Reset & Base Styles ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

ul {
    list-style: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* ── Layout ── */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1;
    animation: fadeIn 0.5s ease-out;
}

/* ── Navbar ── */
.navbar {
    height: var(--header-height);
    background: rgba(9, 9, 11, 0.7);
    backdrop-filter: var(--blur-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-icon {
    font-size: 1.5rem;
    -webkit-text-fill-color: initial;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.nav-icon {
    opacity: 0.8;
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-discord-invite {
    background: #5865F2;
    color: #fff !important;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn-discord-invite:hover {
    background: #4752C4;
    transform: translateY(-1px);
}

/* ── Date Navigation ── */
.date-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-display {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 7rem;
    text-align: center;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-border-hover);
}

.btn-accent {
    background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-accent:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* ── Forms ── */
input,
select {
    background: var(--bg-secondary);
    border: 1px solid var(--color-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: all 0.2s;
    width: 100%;
}

input:focus,
select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: var(--bg-tertiary);
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ── Cards & Containers ── */
.glass-panel {
    background: var(--gradient-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.page-header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── Dashboard Specific ── */
.dashboard-controls {
    display: flex;
    gap: 1rem;
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.schedule-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.5rem;
    border-right: 1px solid var(--color-border);
    padding-right: 1rem;
}

.schedule-control input {
    width: 70px;
    text-align: center;
    padding: 0.4rem;
}

.category-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #60a5fa;
}

/* ── View Tabs ── */
.view-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.collected-time {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.view-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    width: fit-content;
}

.view-tab {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.view-tab.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* ── News Grid ── */
.news-grid {
    display: grid;
    gap: 2rem;
}

.category-section {
    animation: slideUp 0.5s ease-out;
}

.cat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.cat-name,
.feed-cat-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cat-count {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

.article-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--category-color, var(--text-secondary));
    opacity: 0.7;
}

.article-card:hover {
    transform: translateY(-4px);
    border-color: var(--category-color, var(--text-secondary));
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.3);
}

.article-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.article-title a:hover {
    color: var(--text-accent);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.source-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 500;
    color: var(--category-color, var(--text-secondary));
}

/* Category Colors */
.cat-ai {
    --category-color: #10b981;
}

.cat-hci {
    --category-color: #8b5cf6;
}

.cat-health {
    --category-color: #ef4444;
}

.cat-dev {
    --category-color: #3b82f6;
}

.cat-startup {
    --category-color: #f59e0b;
}

/* ── YouTube Summary ── */
.youtube-container {
    max-width: 800px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    position: relative;
}

.input-group input {
    padding-right: 100px;
    font-size: 1.1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-border);
}

.input-group input:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--text-accent);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    bottom: 8px;
}

.summary-result {
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.summary-result.show {
    opacity: 1;
    transform: translateY(0);
}

.video-info {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.video-thumb {
    width: 200px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
}

/* ── Markdown Content ── */
.markdown-body {
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    font-size: 1rem;
    color: #d4d4d8;
    line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: var(--text-primary);
    font-weight: 700;
}

.markdown-body h1 {
    font-size: 1.8rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1.25rem;
}

.markdown-body h2 {
    font-size: 1.4rem;
    color: #a78bfa;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.markdown-body h3 {
    font-size: 1.15rem;
    color: #60a5fa;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.markdown-body p {
    margin-bottom: 1.25rem;
    text-indent: 1em;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.75rem;
}

.markdown-body strong {
    color: var(--text-primary);
}

.markdown-body blockquote {
    border-left: 4px solid #8b5cf6;
    padding-left: 1rem;
    color: #d4d4d8;
    font-style: italic;
    margin: 1rem 0;
    background: rgba(139, 92, 246, 0.1);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
}

/* ── Timestamp Badge ── */
.timestamp-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.12);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.25rem;
}

/* ── Feeds Management ── */
.feed-card {
    background: var(--bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.feed-header {
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.2s;
}

.feed-list-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.feed-list-item:last-child {
    border-bottom: none;
}

.feed-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.feed-name {
    font-weight: 600;
    color: var(--text-primary);
}

.feed-url {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-family: 'JetBrains Mono', monospace;
}

/* ── Loaders & Toast ── */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left-color: #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 999;
    transform: translateY(100px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 500;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.hidden {
    display: none !important;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .navbar {
        height: auto;
        min-height: var(--header-height);
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 0.25rem;
        padding: 0.2rem;
    }

    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .nav-auth {
        white-space: nowrap;
    }

    .btn-discord-invite {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .btn-sm {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .article-list {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .dashboard-controls {
        flex-direction: column;
        width: 100%;
    }

    .schedule-control {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
        width: 100%;
        justify-content: space-between;
    }

    .markdown-body {
        padding: 1.25rem;
    }

    .youtube-container .input-group input {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
}