/* Google Font Import for a clean, modern look */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;600&display=swap');

:root {
    /* The Pastel Palette */
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #4a5568;
    --text-muted: #718096;
    
    /* Soft Accent Colors */
    --mint: #e2f0cb;
    --sky: #d4eaf7;
    --lavender: #e6e6fa;
    --peach: #ffdac1;
    --accent-blue: #a2c2e8;
    
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

/* Add this to your style.css border-top section */
#countdown { border-top: 5px solid var(--lavender); }
#quote     { border-top: 5px solid var(--mint); }
#news      { border-top: 5px solid var(--sky); }

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin: 0;
    line-height: 1.6;
}

/* Header Styling */
header {
    position: sticky;
    top: 0;
    z-index: 900;
    
    /* THE FIX: Header width is total minus sidebar width */
    width: calc(100% - 350px); 
    padding: 15px 40px;
    
    background: rgba(255, 255, 255, 0.1); 
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-subtitle {
    max-width: 1400px;
    margin: 5px auto 0 auto;
    text-align: left; /* Keeps your name/date aligned with the title */
    font-size: 0.9rem;
    color: var(--text-muted);
}

header h1 {
    font-weight: 600;
    font-size: 2.2rem;
    margin: 0;
    background: linear-gradient(to right, #6a82fb, #fc5c7d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
	text-align: center;
}

header p {
    color: var(--text-muted);
    font-weight: 300;
}

.header-top {
    display: flex;
    justify-content: space-between; /* Pushes Title left, Location right */
    align-items: center;
    margin-bottom: 5px;
	max-width: 1400px; /* Matches your dashboard width */
    margin: 0 auto;    /* Centers the header content box */
}

.location-group {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: background 0.3s ease;
}

.location-group:hover {
    background: rgba(255, 255, 255, 0.4);
}

#display-location {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.settings-icon {
    font-size: 1.1rem;
    transition: transform 0.5s ease;
    opacity: 0.7;
}

.location-group:hover .settings-icon {
    transform: rotate(90deg);
    opacity: 1;
}

/* Settings Drawer Styles */
.drawer {
    position: fixed;
    top: 0;
    left: -350px; /* Hidden state */
    width: 350px; /* Slightly wider for better spacing */
    height: 100vh;
    z-index: 1000; /* Above the header */
    
    /* THE FIX: Solid background color */
    background: #ffffff; 
    
    /* Modern glass touch */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    /* Shadow on the right side only */
    box-shadow: 10px 0 30px rgba(0,0,0,0.1); 
    transition: left 0.4s cubic-bezier(0.05, 0.7, 0.1, 1);
    padding: 0; /* Let drawer-content handle padding */
    overflow-y: auto;
}

.drawer.open {
    left: 0;
}

.drawer-content {
    padding: 30px;
    background: transparent;
}

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


#close-drawer {
    float: right;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

input[type="text"] {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ddd;
    margin: 10px 0;
}

#save-settings {
    background: var(--accent-blue);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    width: 100%;
}

.settings-section {
    margin-bottom: 25px;
}

.drawer-divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

input[type="date"] {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ddd;
    margin: 10px 0;
    font-family: inherit;
}

.btn-primary { background: var(--accent-blue); color: white; border: none; padding: 10px; border-radius: 10px; width: 100%; cursor: pointer; }
.btn-secondary { background: var(--mint); color: #4a5568; border: none; padding: 10px; border-radius: 10px; width: 100%; cursor: pointer; margin-top: 10px; font-weight: 600; }

/* Dashboard Grid */

/* Main Layout Container */
.main-layout {
    display: flex;
    flex-direction: row; /* Sidebar on the right */
    width: 100%;
    min-height: 100vh;
    margin: 0;
}
/* Sticky Sidebar */
/* The Solid Sidebar Column */
.sidebar {
    width: 350px;
    height: 100vh;
    position: fixed; /* Fixed so it stays while the main content scrolls */
    top: 0;
    right: 0;
    background: #ffffff;
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 950; /* Sits just below the Drawer (1000) but above everything else */
    overflow-y: auto;
    box-shadow: -5px 0 15px rgba(0,0,0,0.02);
}
/* Sidebar Specific Widget Styling */
.sidebar-widget {
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

/* Re-assigning the colors */
#weather { border-top-color: var(--sky); }
#countdown { border-top-color: var(--lavender); }
#quote { border-top-color: var(--mint); }

/* Main Content Area */
/* Dashboard Content: THE FIX FOR OVERLAP */
.dashboard-content {
    flex-grow: 1;
    /* This creates the space for the fixed sidebar */
    margin-right: 350px; 
    padding: 30px 40px;
    /* Grid layout for the widgets */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    /* Subtract sidebar width from total width */
    width: calc(100% - 350px);
}

/* Modern Widget Card */
.widget-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 220px;
    height: 380px; /* Fixed height for perfect grid alignment */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contains the scrollable areas */
}

.widget-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
}

.widget-card h3 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.weather-widget-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.weather-icon {
    font-size: 2rem;
}

.weather-temp {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-main);
}

.weather-details p {
    margin: 5px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.weather-city {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.75rem !important;
} 

.history-widget {
    display: flex;
    flex-direction: column;
    height: 100%; 
    width: 100%;
}

.history-widget h3 {
    color: var(--text-main);
    margin-bottom: 15px;
    flex-direction: column;
	flex-shrink: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    border-left: 3px solid var(--peach); /* The pastel accent from earlier */
    padding: 5px 0 5px 15px;
    transition: transform 0.2s ease;
}

.history-item:hover {
    transform: translateX(5px);
}

.history-year {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    background: var(--peach);
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 5px;
}

.history-link-wrapper:hover .history-item {
    background: rgba(255, 218, 193, 0.1); /* Very light peach tint */
    border-left-width: 6px;
    transform: translateX(4px);
}

.history-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
    /* Limit text to 3 lines to keep cards uniform */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* The scrollable area */
.history-scroll-container {
    max-height: 350px; /* Set your preferred height */
    overflow-y: auto;
    padding-right: 10px; /* Space for the scrollbar */
    margin-top: 10px;
}

/* Customizing the scrollbar for a modern look */
.history-scroll-container::-webkit-scrollbar {
    width: 5px;
}
.history-scroll-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.02);
}
.history-scroll-container::-webkit-scrollbar-thumb {
    background: var(--peach);
    border-radius: 10px;
}

/* Make the links feel like cards */
.history-link-wrapper {
    text-decoration: none;
    display: block;
    margin-bottom: 15px;
}
.countdown-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.countdown-widget h3 {
    margin-bottom: 20px;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    padding: 12px;
    border-radius: 15px;
    border-left: 5px solid var(--accent-blue);
    gap: 15px;
}

.event-info {
    text-align: center;
    min-width: 60px;
}

.event-days {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
}

.event-unit {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.event-name {
    margin: 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.event-date {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* The scrollable area for event cards */
.event-scroll-container {
    max-height: 300px; /* Adjust this to match your History widget height */
    overflow-y: auto;
    padding-right: 8px; /* Gap for scrollbar */
    margin-top: 10px;
}

/* Modern Scrollbar for Events */
.event-scroll-container::-webkit-scrollbar {
    width: 5px;
}
.event-scroll-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.02);
}
.event-scroll-container::-webkit-scrollbar-thumb {
    background: var(--sky); /* Soft sky blue thumb */
    border-radius: 10px;
}

/* If days left is 0, give it a subtle pulse or glow */
.event-item:has(.event-days:contains('0')) {
    background: var(--peach);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    /* Top floor: Highest index to cover everything */
    z-index: 2000; 
    
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 450px;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
}

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

#close-modal {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
}

/* Modal Open State */
.modal-overlay.active {
    display: flex;
}

/* Add to style.css */
.quote-widget-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    position: relative;
    padding: 10px;
}

.quote-icon {
    font-size: 4rem;
    color: var(--mint); /* Using your pastel mint */
    opacity: 0.3;
    position: absolute;
    top: -10px;
    left: 10px;
    font-family: serif;
}

.quote-text {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.quote-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* News Widget Structure */
.news-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.news-widget h3 {
    flex-shrink: 0;
    margin-bottom: 15px;
}

/* Scroll Container */
.news-scroll-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}

/* Modern Scrollbar for News */
.news-scroll-container::-webkit-scrollbar {
    width: 5px;
}
.news-scroll-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.02);
}
.news-scroll-container::-webkit-scrollbar-thumb {
    background: var(--sky);
    border-radius: 10px;
}

/* News Item Styling */
.news-link-wrapper {
    text-decoration: none;
    display: block;
    margin-bottom: 18px;
}

.news-item {
    border-left: 3px solid var(--sky);
    padding: 5px 0 5px 15px;
    transition: all 0.2s ease;
}

.news-link-wrapper:hover .news-item {
    background: rgba(212, 234, 247, 0.1);
    border-left-width: 6px;
    transform: translateX(4px);
}

.news-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-blue);
    text-transform: uppercase;
}

.news-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 3px 0;
    line-height: 1.3;
}

.news-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit description to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Container Fix */
.links-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 columns */
    grid-template-rows: 1fr 1fr;    /* 2 rows */
    gap: 15px;
    flex-grow: 1;
    margin-top: 10px;
}

/* Individual Link Cards */
.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    transition: all 0.3s ease;
}

.link-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.link-icon {
    font-size: 1.4rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.link-card span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Ensure the quote card has its pastel top border */
#quote {
    border-top: 5px solid var(--mint);
}

/* Customizing specific widget "tops" with pastel accents */
#weather { border-top: 5px solid var(--sky); }
#emails  { border-top: 5px solid var(--lavender); }
#links   { border-top: 5px solid var(--mint); }
#history { border-top: 5px solid var(--peach); }

/* Footer */
footer {
    padding: 40px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Responsive Layout for Tablets and Mobile */
@media (max-width: 1024px) {
    /* 1. Header takes full width */
    header {
        width: 100%;
        margin-right: 0;
        padding: 15px 20px;
    }

    /* 2. Main layout stacks vertically */
    .main-layout {
        flex-direction: column;
    }

    /* 3. Dashboard content takes full width */
    .dashboard-content {
        margin-right: 0;
        width: 100%;
        padding: 20px;
        order: 2; /* Moves main content below the sidebar if desired */
    }

    /* 4. Sidebar becomes a normal section instead of fixed */
    .sidebar {
        position: relative; /* No longer floating on the right */
        width: 100%;
        height: auto;
        border-left: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding: 20px;
        flex-direction: row; /* Layout sidebar widgets side-by-side */
        flex-wrap: wrap;
        gap: 20px;
        order: 1; /* Sidebar content appears first (Weather/Events) */
    }

    .sidebar-widget {
        flex: 1 1 300px; /* Sidebar widgets grow to fill width */
    }

    /* 5. Adjust Grid for smaller screens */
    .dashboard-container {
        grid-template-columns: 1fr; /* Single column on very small phones */
        padding: 10px;
    }
}