/* ==========================================================================
   1. FONTS, CORE VARIABLES & BASE RESET
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght=300;400;500;600;700&display=swap');

:root {
    --bg-gradient: linear-gradient(180deg, #dbeafe 0%, #f8fafc 40%, #f1f5f9 100%);
    --widget-bg: #ffffff;
    --samsung-blue: #3b82f6;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    padding: 16px;
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

.brief-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
}

/* ==========================================================================
   2. ACTION BAR & SETTINGS DRAWER PANELS
   ========================================================================== */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
}

.app-status-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--samsung-blue);
    background: #e0f2fe;
    padding: 4px 10px;
    border-radius: 12px;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
}

.settings-drawer {
    position: absolute;
    top: 45px;
    right: 0;
    left: 0;
    background: #ffffff;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    z-index: 100;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: background-color 0.3s ease;
}

.settings-drawer.hidden {
    display: none;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 { 
    margin: 0; 
    font-size: 1.1rem; 
}

.input-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 6px;
}

input, #theme-select {
    width: 100%;
    background: #f1f5f9;
    border: none;
    padding: 14px 16px;
    color: var(--text-primary);
    border-radius: 16px;
    font-size: 0.95rem;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
    margin-bottom: 8px;
    appearance: none;
    -webkit-appearance: none;
}

#save-settings-btn {
    background: var(--text-primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* ==========================================================================
   3. TYPOGRAPHY HEADERS & NARRATIVE LAYOUT
   ========================================================================== */
#greeting-title { 
    font-size: 2.5rem; 
    font-weight: 600; 
    margin: 0; 
}

#date-display { 
    font-size: 1.05rem; 
    color: var(--text-secondary); 
    margin: 2px 0 0 0; 
}

.narrative-summary { 
    font-size: 1.15rem; 
    line-height: 1.45; 
    color: #1f2937; 
    margin: 6px 0; 
    transition: color 0.3s ease;
}

.narrative-summary p {
    margin: 0;
}

/* ==========================================================================
   4. CONTENT CARDS & WIDGET DESIGN COMPONENTS
   ========================================================================== */
.widget {
    background: var(--widget-bg);
    border-radius: 26px;
    padding: 22px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.015);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.widget-title { 
    font-size: 1rem; 
    font-weight: 600; 
    margin: 0 0 14px 0; 
}

.weather-widget {
    background: #4dabf7; 
    color: white;
}

.weather-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.temp-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

#weather-icon-box {
    font-size: 2.8rem;
}

#current-temp {
    font-size: 3.4rem;
    font-weight: 300;
}

.weather-loc { 
    text-align: right; 
}

#location-name { 
    font-weight: 600; 
    font-size: 1.05rem; 
    display: block; 
}

#temp-range { 
    font-size: 0.88rem; 
    color: rgba(255, 255, 255, 0.85); 
}

.weather-insight {
    margin-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 10px;
    font-size: 0.92rem;
}

.weather-widget.rain-mode {
    background: linear-gradient(135deg, #4b6584 0%, #353b48 100%) !important;
    box-shadow: 0 10px 30px rgba(53, 59, 72, 0.2);
}

/* ==========================================================================
   5. RSS STORIES LOG MODULE STREAM
   ========================================================================== */
.news-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-primary);
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.news-item:last-child { 
    border-bottom: none; 
}

.news-title { 
    font-size: 0.96rem;
    font-weight: 500;
    line-height: 1.4;
    margin: 0 0 4px 0;
    transition: color 0.2s ease;
}

.news-title::after {
    content: ' ▾';
    font-size: 0.8rem;
    color: var(--text-muted);
    display: inline-block;
    margin-left: 4px;
    transition: transform 0.3s ease;
}

.news-item.expanded .news-title::after {
    transform: rotate(180deg);
}

.news-source { 
    font-size: 0.72rem; 
    color: var(--text-muted); 
    font-weight: 600; 
}

.news-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.3s ease;
}

.news-item.expanded .news-details {
    max-height: 200px; 
    margin-top: 10px;
}

.news-snippet {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

.read-more-pill {
    display: inline-block;
    align-self: flex-start;
    background: #e0f2fe;
    color: var(--samsung-blue);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
}

.loading-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 8px 0;
}

/* ==========================================================================
   6. WIKIPEDIA HISTORY FLASHBACK LAYOUT CARD RULES
   ========================================================================== */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

#history-year-badge {
    background: #f1f5f9;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#history-content-container p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ==========================================================================
   7. HIGH-CONTRAST ACCESSIBILITY MIDNIGHT THEMING OVERRIDES
   ========================================================================== */
body.dark-theme {
    --bg-gradient: linear-gradient(180deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
    --widget-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
}

body.dark-theme .narrative-summary,
body.dark-theme .narrative-summary p,
body.dark-theme #weather-sentence {
    color: var(--text-secondary) !important;
}

body.dark-theme .widget {
    background: var(--widget-bg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

body.dark-theme #history-year-badge {
    background: #0f172a;
    color: var(--samsung-blue);
}

body.dark-theme .settings-drawer {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

body.dark-theme #theme-select,
body.dark-theme #theme-select option,
body.dark-theme input {
    background-color: #0f172a !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .news-item {
    border-bottom: 1px solid #334155;
}

body.dark-theme .read-more-pill {
    background: #1e3a8a;
    color: #93c5fd;
}

body.dark-theme .app-status-tag {
    background: #1e3a8a;
    color: #93c5fd;
}