:root {
    /* Color palette */
    --bg-main: #121212;
    --bg-card: #1e1e1e;
    --bg-task: #2a2a2a;
    --accent-blue: #4a80f5;
    --accent-purple: #7e57c2;
    --accent-teal: #26a69a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --completed-color: #555555;
    --off-color: #424242;
    --exam-color: #6d4c41;
    --shadow: rgba(0, 0, 0, 0.3);
    --status-green: #4CAF50; /* Added Green for pending */
    --status-grey: #666666; /* Added Grey for future */
}

body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container with max-width to add side margins */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Header styling */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

header h1 {
    font-size: 3.8rem; /* Increased from 3rem */
    margin: 0 0 25px 0;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.navigation-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative; /* Needed for absolute positioning of user menu */
}

button {
    padding: 12px 20px;
    background-color: #2d2d2d;
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button:hover,
button:focus { /* Added focus state */
    background-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    outline: none; /* Remove default focus outline */
}

/* Date Header */
#dateHeader {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin: 0 0 30px 0;
    text-align: center;
    font-weight: bold;
    padding: 15px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.03);
    border-bottom: 3px solid var(--accent-blue); /* Default border */
    transition: border-bottom-color 0.3s ease; /* Smooth transition for color change */
}

/* Date Header Status Colors */
#dateHeader.status-completed {
    border-bottom-color: var(--accent-blue); /* Blue for completed */
}
#dateHeader.status-pending {
    border-bottom-color: var(--status-green); /* Green for pending */
}
#dateHeader.status-future {
    border-bottom-color: var(--status-grey); /* Grey for future */
}


/* View containers */
.view-container {
    background-color: var(--bg-card);
    border-radius: 15px;
    padding: 35px;
    box-shadow: 0 8px 16px var(--shadow);
    max-width: 850px; /* Reduced from 900px */
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* Task card styling */
.task {
    background-color: var(--bg-task);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border-left: 5px solid var(--accent-blue);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); /* Slightly enhanced shadow */
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: linear-gradient(145deg, var(--bg-task), #252525); /* Subtle gradient */
}

.task.expanded {
    transform: scale(1.02);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.task.collapsed {
    max-height: 90px;
    opacity: 0.85;
}

/* Completed task styling */
.task-completed {
    border-left-color: var(--completed-color);
    opacity: 0.7;
}

.task-completed .subject,
.task-completed .task-topic {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.8;
}

.task-completed .timer-container {
    opacity: 0.65;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 15px 0;
    position: relative;
}

.task-header-content {
    flex: 1;
    text-align: center;
}

.task-header .subject {
    font-weight: bold;
    color: var(--accent-blue);
    font-size: 1.3rem;
    /* display: block; */ /* Removed this line */
    margin-bottom: 5px;
    margin-right: 8px; /* Added spacing */
}

.task-header .time-block {
    background-color: #333;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    position: absolute;
    left: 0;
}

.task-header .hours {
    position: absolute;
    right: 0;
    background-color: #333;
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.task-header .pass {
    color: var(--text-secondary);
}

.task-topic {
    font-size: 1.4rem;
    margin: 15px 0;
    color: var(--text-primary);
    text-align: center;
}

.task-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
}

.task.expanded .task-details {
    max-height: 800px;
    opacity: 1;
}

.detail-row {
    display: flex;
    gap: 15px;
    align-items: baseline;
}

.detail-label {
    font-weight: bold;
    color: var(--accent-teal);
    min-width: 100px;
}

.progress-row {
    margin-top: 12px;
}

.progress-item {
    background-color: #333;
    padding: 6px 12px;
    border-radius: 6px;
    margin-right: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.motivation-tip {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--accent-purple);
    font-style: italic;
    color: var(--text-secondary);
    border-radius: 6px;
}

.task-completion {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #3a3a3a;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

.task-completion label {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.task-completion input[type="checkbox"] {
    width: 28px;
    height: 28px;
    cursor: pointer;
    accent-color: var(--accent-blue);
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: auto;
    padding: 10px 15px;
    border-radius: 8px;
    background-color: #232323;
    transition: all 0.3s ease;
}

.timer-container.active {
    background-color: rgba(74, 128, 245, 0.15);
    box-shadow: 0 0 8px rgba(74, 128, 245, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 128, 245, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(74, 128, 245, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 128, 245, 0);
    }
}

.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.timer-controls {
    display: flex;
    gap: 8px;
}

.timer-controls button {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #333;
    color: var(--text-primary);
}

.timer-start {
    background-color: #2e7d32 !important;
}

.timer-pause {
    background-color: #f57c00 !important;
}

.timer-reset {
    background-color: #c62828 !important;
    opacity: 0.7;
}

.timer-controls button:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.daily-hours-header {
    color: var(--accent-teal);
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.3rem;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
}

/* OFF day styling */
.off-day {
    background-color: var(--off-color);
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    border-left: 5px solid #666;
    margin-bottom: 25px;
}

/* Exam task styling */
.exam-task {
    background-color: var(--exam-color);
    color: #e5c3a0;
    border-left: 5px solid #915d10;
}

.exam-time {
    float: right;
    background-color: #915d10;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
}

/* Weekly view styling - 4 columns */
#weeklyView {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Changed to 4 columns */
    gap: 20px;
}

.weekly-day {
    margin: 0;
    padding: 20px;
    background-color: var(--bg-task);
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
    border-top: 5px solid #444;
    display: flex;
    flex-direction: column;
    min-height: 150px; /* Use min-height instead of fixed height */
    justify-content: space-between; /* Distribute content vertically */
}

.weekly-day:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.weekly-day h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.weekly-day.current {
    border-top: 5px solid var(--accent-blue); /* Keep blue border for current day highlight */
    background-color: rgba(74, 128, 245, 0.1);
}

/* Weekly Day Status Colors (using border-top) */
.weekly-day.status-completed {
    border-top-color: var(--accent-blue); /* Blue for completed */
}
.weekly-day.status-pending {
    border-top-color: var(--status-green); /* Green for pending */
}
.weekly-day.status-future {
    border-top-color: var(--status-grey); /* Grey for future */
}
.weekly-day.status-off { /* Renamed from .off-day for consistency */
    border-top-color: var(--status-grey); /* Use grey border for off days too */
    background-color: var(--off-color); /* Keep background grey */
    color: var(--text-secondary);
}

.exam-indicator {
    color: #e5c3a0;
    background-color: rgba(145, 93, 16, 0.3);
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 0.9rem; /* Slightly smaller */
}

/* User Menu Styles */
.user-menu-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.user-menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary) !important;
    font-size: 1.8rem; /* Icon size */
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.user-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: none; /* Override general button hover */
    box-shadow: none; /* Override general button hover */
}

.user-menu-dropdown {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    padding: 15px;
    min-width: 200px;
    z-index: 101;
}

.user-menu-dropdown.active {
    display: block; /* Show when active */
}

.user-menu-dropdown #userEmailDropdown {
    color: var(--accent-blue);
    font-weight: 500;
    margin-bottom: 15px;
    display: block;
    word-break: break-all; /* Prevent long emails overflowing */
}

.user-menu-dropdown .sign-out-btn {
    width: 100%;
    text-align: center;
}

/* Visually hidden class for accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Add these styles for the login UI */

.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px; /* Increased padding */
    background-color: var(--bg-card);
    border-radius: 15px; /* Slightly larger radius */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35); /* Enhanced shadow */
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05); /* Subtle border */
}

.login-container h2 {
    margin-top: 0;
    margin-bottom: 25px;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.8rem;
}

.login-container input {
    display: block;
    width: calc(100% - 36px); /* Adjust width considering padding */
    padding: 14px 18px; /* Increased padding */
    margin-bottom: 18px; /* Increased margin */
    background-color: #333;
    border: 1px solid #444; /* Subtle border */
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; /* Added transition */
}

.login-container input::placeholder { /* Style placeholder */
    color: var(--text-secondary);
    opacity: 0.7;
}

.login-container input:focus {
    outline: none; /* Remove default outline */
    border-color: var(--accent-blue); /* Accent border on focus */
    background-color: #3a3a3a;
    box-shadow: 0 0 0 3px rgba(74, 128, 245, 0.3); /* Subtle glow effect */
}

.login-container button {
    width: 100%;
    margin-top: 15px; /* Increased margin */
    padding: 14px 20px; /* Increased padding */
    background-color: var(--accent-blue); /* Use accent color */
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease; /* Added transition */
}

.login-container button:hover,
.login-container button:focus {
    background-color: #5a90f6; /* Slightly lighter blue on hover/focus */
    transform: translateY(-1px); /* Subtle lift */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    outline: none;
}

.login-error {
    color: #f44336; /* Standard error color */
    margin-top: 20px; /* Increased margin */
    min-height: 20px;
    font-weight: 500; /* Make error text slightly bolder */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    /* Removed .user-info styles as they are replaced by the dropdown */
}

/* Responsive adjustments */
@media (max-width: 900px) { /* Adjusted breakpoint */
    #weeklyView {
        grid-template-columns: repeat(3, 1fr); /* 3 columns for medium screens */
    }
}

@media (max-width: 768px) {
    .view-container {
        padding: 20px;
    }

    #weeklyView {
        grid-template-columns: repeat(2, 1fr); /* 2 columns for smaller screens */
    }

    .navigation-controls {
        flex-direction: column;
    }

    header h1 {
        font-size: 3rem; /* Slightly smaller title on mobile */
    }

    .user-menu-container {
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 500px) {
    .task-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .task-header .time-block,
    .task-header .time-block,
    .task-header .hours {
        position: static;
        margin: 5px 0;
    }

    #weeklyView {
        grid-template-columns: 1fr; /* 1 column for very small screens */
    }
}
