/* CSS Design System for Discord Digest Dashboard (Warm/Colorful Light Theme) */

:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Theme-agnostic constants */
    --transition-speed: 0.25s;
    --border-radius-lg: 12px;
    --border-radius-md: 8px;
    --border-radius-sm: 4px;

    /* Warm/Colorful Colors & Accents */
    --discord-color: #7c3aed; /* Deep violet accent */
    --twitch-color: #db2777;  /* Pinkish accent */
    --accent-orange: #d97706;  /* Warm amber accent */
    --gradient-warm: linear-gradient(135deg, #f59e0b, #d97706, #c2410c);
    
    /* Warm Light Theme Variables */
    --bg-app: #fbf9f4;         /* Warm clean cream/ivory */
    --bg-sidebar: #f3eedf;     /* Warm beige */
    --bg-card: transparent;    /* Borderless seamless cards blending with background */
    --border-color: rgba(180, 150, 110, 0.15); /* Soft beige borders */
    
    --text-primary: #382d22;   /* Deep warm brown */
    --text-secondary: #635342; /* Medium warm brown */
    --text-muted: #968370;     /* Muted grayish warm brown */
    
    --hover-bg: rgba(220, 205, 175, 0.4);
    --active-bg: rgba(124, 58, 237, 0.08); /* Violet tinted active state */
    
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
}

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

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

/* Layout App Container */
.app-container {
    display: grid;
    grid-template-columns: 290px 1fr;
    height: 100vh;
    width: 100%;
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    animation: pulse 4s infinite ease-in-out;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--gradient-warm);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Channel Selector */
.channel-selector-wrapper {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.selector-label {
    font-family: var(--font-heading);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
}

.select-container {
    position: relative;
    width: 100%;
}

.channel-select {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23635342' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 32px;
}

.channel-select:hover {
    border-color: var(--discord-color);
    background-color: #fcfbf7;
}

.channel-select:focus {
    border-color: var(--discord-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* Tree Navigation Sidebar (Calendar & Options) */
.digest-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-title {
    padding: 0 24px 12px 24px;
    font-family: var(--font-heading);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

/* Calendar Container */
.calendar-container {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px 20px 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cal-nav-btn {
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

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

.calendar-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    row-gap: 6px;
    column-gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: var(--text-muted);
    border: 1px solid transparent;
    user-select: none;
}

.calendar-day.disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.calendar-day.has-digests {
    cursor: pointer;
    color: var(--text-primary);
    background: rgba(180, 150, 110, 0.15); /* Soft beige background to highlight active dates */
}

.calendar-day.has-digests:hover {
    background: var(--hover-bg);
    border-color: var(--discord-color);
}

.calendar-day.selected {
    background: var(--discord-color) !important;
    color: #ffffff !important;
    border-color: var(--discord-color) !important;
    font-weight: 700;
}

/* Date Options container below calendar */
.date-options-container {
    padding: 8px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.options-title {
    font-family: var(--font-heading);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.date-options-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item-btn {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    text-align: left;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

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

.nav-item-btn.active {
    background-color: var(--active-bg);
    color: var(--text-primary);
    font-weight: 600;
    border-left: 3px solid var(--discord-color);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    padding-left: 9px;
}

/* Main Content Area Styling */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-header {
    padding: 24px 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius-md);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.share-btn:hover {
    background-color: var(--hover-bg);
    border-color: var(--text-muted);
}

.share-btn.copied {
    background-color: #22c55e;
    color: #ffffff;
    border-color: #22c55e;
}

.main-header h1 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.meta-pills {
    display: flex;
    gap: 8px;
}

.meta-pill {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #fcfbf7;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Body Content Scroller */
.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    background: #ffffff;
}

/* Welcome/Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    max-width: 450px;
    margin: 0 auto;
    padding: 40px 0;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 24px;
    animation: float 4s infinite ease-in-out;
}

.empty-state h2 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Details Layout */
.digest-details {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 1000px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* Cards Design (Seamless vertical flow, no box borders/division) */
.digest-card {
    background: var(--bg-card);
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 24px 0;
}

/* Vertical Stacking for top section: Bullets & Summary */
.top-rows-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.card-header-mini {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.card-title-mini {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.daily-badge {
    background: rgba(217, 119, 6, 0.12); /* Soft warm amber */
    color: #b45309;
}

.hourly-badge {
    background: rgba(124, 58, 237, 0.12); /* Soft violet */
    color: #6d28d9;
}

.model-badge {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

/* Key Bullets Bulleted List */
.bullets-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bullets-list li {
    position: relative;
    padding-left: 24px;
    line-height: 1.6;
    font-size: 14.5px;
    color: var(--text-secondary);
}

.bullets-list li::before {
    content: "✦";
    position: absolute;
    left: 4px;
    color: var(--discord-color);
    font-size: 13px;
    top: 1px;
}

/* Summary text styling */
.summary-text {
    line-height: 1.7;
    font-size: 14.5px;
    color: var(--text-primary);
}

.summary-text p {
    margin-bottom: 12px;
}

.summary-text p:last-child {
    margin-bottom: 0;
}

.summary-text strong {
    color: var(--discord-color);
    font-weight: 700;
}

/* Grid of structured lists */
.structured-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.spec-card {
    padding: 20px 0;
    border-bottom: none;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    color: var(--text-primary);
}

.card-section {
    margin-bottom: 20px;
}

.card-section:last-child {
    margin-bottom: 0;
}

.card-section h4 {
    font-family: var(--font-heading);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 700;
}

/* List Stylings */
.pill-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill-list li {
    background: #f3eedf;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.notes-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-line;
}

.check-list, .bullet-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-list li {
    position: relative;
    padding-left: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.check-list li::before {
    content: "✓";
    position: absolute;
    left: 4px;
    color: #059669;
    font-weight: bold;
}

.bullet-list li {
    position: relative;
    padding-left: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.bullet-list li::before {
    content: "•";
    position: absolute;
    left: 6px;
    color: var(--twitch-color);
    font-size: 18px;
    line-height: 1;
    top: -2px;
}

/* Custom Scrollbar */
.digest-list-wrapper::-webkit-scrollbar,
.content-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.digest-list-wrapper::-webkit-scrollbar-track,
.content-body::-webkit-scrollbar-track {
    background: transparent;
}

.digest-list-wrapper::-webkit-scrollbar-thumb,
.content-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.digest-list-wrapper::-webkit-scrollbar-thumb:hover,
.content-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Responsive queries */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 270px 1fr;
    }
    
    .structured-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        height: auto;
    }
    
    .sidebar {
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .digest-list-wrapper {
        max-height: 250px;
    }
    
    .content-body {
        padding: 20px;
    }
}

/* --- Profile Popover --- */

.name-chip {
    cursor: pointer;
    text-decoration: underline dotted var(--text-muted);
    text-underline-offset: 3px;
    transition: color var(--transition-speed), background-color var(--transition-speed);
    border-radius: var(--border-radius-sm);
    padding: 0 2px;
}

.name-chip:hover {
    color: var(--discord-color);
    background-color: var(--active-bg);
}

.profile-popover {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 32px rgba(56, 45, 34, 0.14);
    width: 300px;
    animation: popoverIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes popoverIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar);
}

.popover-avatar {
    font-size: 22px;
    flex-shrink: 0;
}

.popover-title-block {
    flex: 1;
    min-width: 0;
}

.popover-title-block strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popover-prev-names {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popover-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    padding: 4px 6px;
    border-radius: var(--border-radius-sm);
    line-height: 1;
    flex-shrink: 0;
    transition: color var(--transition-speed), background-color var(--transition-speed);
}

.popover-close:hover {
    color: var(--text-primary);
    background-color: var(--hover-bg);
}

.popover-body {
    padding: 12px 16px 16px;
}

.popover-stat {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.popover-roles-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.popover-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.role-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--active-bg);
    color: var(--discord-color);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(124, 58, 237, 0.15);
}
