/* --- VARIABLES & RESET --- */
:root {
    --bg-dark: #121212;
    --sidebar-bg: #1e1e1e;
    --card-bg: #252525;
    --accent: #bb86fc; /* Purple accent */
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --border-radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

*:focus {
    outline: none !important;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* --- GLOBAL SCROLLBAR (Modern & Minimal) --- */
::-webkit-scrollbar {
    width: 6px;  /* Thin width */
    height: 6px; /* Thin height for horizontal scrolls */
}

::-webkit-scrollbar-track {
    background: transparent; /* Blends with container background */
}

::-webkit-scrollbar-thumb {
    background: #333; /* Dark grey thumb */
    border-radius: 3px; /* Rounded edges */
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: #444; /* Slightly lighter on hover */
}

/* --- CUSTOM TOOLTIP --- */
#global-tooltip {
    position: fixed;
    background: #18181b; /* Zinc-900 */
    border: 1px solid #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    pointer-events: none; /* Mouse must pass through */
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    white-space: nowrap;
    font-weight: 500;
}
#global-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- CUSTOM CONFIRM MODAL (HeroUI Style) --- */
.confirm-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6); /* Darker dim */
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center; align-items: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.confirm-overlay.open { opacity: 1; pointer-events: all; }

.confirm-box {
    background: #18181b;
    border: 1px solid #27272a;
    width: 400px;
    max-width: 90vw;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column; gap: 12px;
}
.confirm-overlay.open .confirm-box { transform: scale(1); }

.confirm-header { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }

.confirm-icon-box {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
/* Variants for the icon box */
.confirm-icon-box.danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.confirm-icon-box.info   { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

.confirm-title { color: #fff; font-size: 1.1rem; font-weight: 600; }
.confirm-desc { color: #a1a1aa; font-size: 0.9rem; line-height: 1.5; }

.confirm-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px;
}

.btn-confirm-cancel {
    background: transparent; border: 1px solid #3f3f46; color: #fff;
    padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; transition: 0.2s;
}
.btn-confirm-cancel:hover { background: #27272a; }

.btn-confirm-action {
    background: #fff; color: #000;
    border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: 0.2s;
}
.btn-confirm-action:hover { opacity: 0.9; transform: translateY(-1px); }

/* Danger Variant Button */
.btn-confirm-action.danger { background: #ef4444; color: #fff; }
.btn-confirm-action.danger:hover { background: #dc2626; }

/* --- LAYOUT STRUCTURE --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    border-right: 1px solid #333;
}

/* --- STUDENT CARD WIDGET --- */
.student-card-widget {
    background: #252525; /* Matches your theme's card color */
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #333; /* Subtle border defined in the image's structure */
    color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); /* Gives it depth like the reference */
}

/* Header Section */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.id-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in srgb, var(--accent) 15%, transparent); /* Your purple accent, low opacity */
    color: var(--accent); /* Your purple accent color */
    padding: 6px 12px;
    border-radius: 6px; /* Rounded badge look */
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-icon {
    color: #666; /* Subtle grey for the secondary icon */
    font-size: 1.2rem;
}

/* Thin Separator Line */
.card-separator {
    height: 1px;
    background: #333;
    margin: 12px 0;
}

/* --- SEMESTER TRACKER --- */
.semester-tracker {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.sem-value {
    font-family: 'Times New Roman', serif;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    line-height: 1;
    text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 10%, transparent); 
}

/* Body Section (Name & Major) */
.card-body {
    text-align: center;
    padding: 5px 0;
}

.card-body h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.card-body p {
    margin: 5px 0 0;
    font-size: 0.85rem;
    color: #b3b3b3; /* Muted text color */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

/* Footer Section (ID Number) */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Aligns the icon with the text baseline */
}

.footer-label {
    display: block;
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 4px;
    font-weight: 600;
}

.footer-value {
    margin: 0;
    font-size: 1rem;
    font-family: 'Courier New', monospace; /* Monospace font for the ID number look */
    letter-spacing: 1px;
    color: #fff;
}

.footer-icon {
    font-size: 2rem;
    color: #555; /* Dark grey for the barcode */
    opacity: 0.8;
}

/* Scrolling Text Effect */
.now-playing-text {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    max-width: 100%;
}

.nav-links { list-style: none; }
.nav-links li { margin-bottom: 15px; }
.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    transition: 0.3s;
}
.nav-links li.active a, .nav-links a:hover {
    background-color: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
}

/* --- MAIN CONTENT --- */
.content-area {
    flex: 1;
    padding: 20px;
}

/* Hero Banner */
.hero-banner {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://images.unsplash.com/photo-1470770841072-f978cf4d019e?auto=format&fit=crop&w=1000&q=80');
    background-size: cover;
    background-position: center;
    height: 200px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: flex-end;
    padding: 30px;
    margin-bottom: 30px;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

/* --- BENTO GRID SYSTEM --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    grid-template-rows: 352px 280px 250px;
    gap: 20px;
}

/* Card Styling */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* --- WIDGET SPECIFIC SPANS --- */
/* --- HYBRID CLOCK STYLING --- */
.widget-clock {
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.analog-clock {
    width: 200px; /* Slightly larger for visibility */
    height: 200px;
    border-radius: 50%;
    position: relative;
    /* No border, just the floating elements */
}

/* Digital Overlay Position */
.digital-overlay {
    position: absolute;
    top: 70%; /* Push to bottom half */
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 9; /* Lowest layer, behind hands */
    pointer-events: none;
}

#digital-time {
    font-size: 1.2rem;
    font-weight: 700;
    color: #dbdbdb;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums; /* Prevents jitter */
}

#digital-date {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 4px;
    text-transform: uppercase;
}

/* Hand Refinements */
.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 10px;
    z-index: 10; /* Above text */
}

.hour-hand {
    width: 6px;
    height: 50px;
    background: #fff;
}

.min-hand {
    width: 4px;
    height: 70px;
    background: #fff;
}

.second-hand {
    width: 2px;
    height: 80px;
    background: #666;
    z-index: 11;
}

.center-dot {
    position: absolute;
    top: 50%; left: 50%;
    width: 12px; height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 12;
}

/* Tick Marks */
.dial-lines {
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
    pointer-events: none;
}

.tick {
    position: absolute;
    width: 2px;
    height: 12px;
    background: #666; /* Subtle grey for standard ticks */
    left: 50%;
    top: 0;
    transform-origin: 50% 100px; /* Half of clock width */
}

.tick.major {
    background: #fff; /* Bright white for 12, 3, 6, 9 */
    width: 3px;
    height: 15px;
}

/* --- DASHBOARD PLAYER CARD --- */
.widget-spotify-player {
    grid-column: 4 / 5; /* Rightmost column */
    grid-row: 1 / 2;    /* Standard height */
    padding: 0;          /* Remove padding so the embed fills the card */
    overflow: hidden;    /* Cut off square corners */
    min-height: 152px;   /* Minimum height for Spotify standard view */

    /* SKELETON LOADER: Draws a fake player instantly */
    background-image: 
        /* 1. Fake Album Art (Square Left) */
        linear-gradient(#333, #333), 
        /* 2. Fake Title (Thick Line) */
        linear-gradient(#333, #333),
        /* 3. Fake Subtitle (Thin Line) */
        linear-gradient(#333, #333);
    
    background-repeat: no-repeat;
    
    /* Sizing the fake elements to match the screenshot */
    background-size: 
        110px 110px,    /* Art Size */
        180px 24px,     /* Title Width/Height */
        120px 16px,     /* Subtitle Width/Height */
        50px 50px;      /* Play Button Size */
        
    /* Positioning (Based on your screenshot layout) */
    background-position: 
        20px 20px,      /* Art: Top Left padding */
        150px 45px,     /* Title: To the right of Art */
        150px 80px,     /* Subtitle: Below Title */
        92% 50px;       /* Play Button: Far Right */
}

/* --- WIDGET HEADER (Generic) --- */
.widget-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.widget-header-row h3 { margin: 0; font-size: 1rem; color: #fff; display:flex; align-items:center; gap:8px;}

/* --- TASKS LIST WIDGET --- */
.widget-tasks {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
}

.task-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px; /* Tight gap */
    padding-right: 2px;
}

/* Individual Task Item */
.task-row {
    display: flex;
    align-items: center;
    border-radius: 6px;
    padding: 6px 8px;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.task-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Dragging State (Applied by JS) */
.task-row.dragging {
    opacity: 1;
    background: #333;
    border: 1px dashed #666;
}

.task-row.over {
    border: 1px dashed var(--accent);
}

/* Custom Checkbox (HeroUI Style) */
.task-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #52525b; /* Zinc-600 */
    border-radius: 5px; /* Squircle */
    background: transparent;
    cursor: pointer;
    margin-right: 10px;
    display: grid;
    place-content: center;
    transition: 0.2s all;
}

.task-checkbox::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 0.15s transform ease-in-out;
    box-shadow: inset 1em 1em #000; /* Checkmark color */
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    background: #000;
}

.task-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.task-checkbox:checked::before {
    transform: scale(1);
    background: #fff; /* Checkmark turns white */
    box-shadow: inset 1em 1em #fff;
}

/* Task Text */
.task-label {
    flex: 1;
    font-size: 0.9rem;
    color: #e4e4e7;
    cursor: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.task-checkbox:checked + .task-label {
    color: #71717a; /* Muted */
    text-decoration: line-through;
}

/* Edit Input */
.task-edit-input {
    flex: 1;
    background: #18181b;
    border: 1px solid var(--accent);
    color: #fff;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    outline: none;
}

/* Drag Handle */
.task-drag-handle {
    color: #52525b;
    cursor: grab;
    padding: 4px;
    font-size: 1.2rem;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s;
    display: flex; align-items: center;
}
.task-row:hover .task-drag-handle { opacity: 1; }
.task-drag-handle:active { cursor: grabbing; color: #fff; }

/* --- CURRENT ASSIGNMENTS WIDGET --- */
.widget-current-assignments {
    grid-column: 4 / 5;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.assignments-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.dashboard-assign-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
    cursor: pointer;
}

.dashboard-assign-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(1px);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Left side: Text Info */
.da-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden; /* For text truncation */
}

.da-course {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.da-title {
    font-size: 0.9rem;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right side: Deadline Badge */
.da-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    background: #333;
    color: #aaa;
}

/* Urgency Colors */
.da-badge.urgent { /* < 3 days */
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.da-badge.soon { /* < 7 days */
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.da-badge.medium { /* < 4 weeks */
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.da-badge.far { /* > 1 month */
    background: rgba(255, 255, 255, 0.05);
    color: #888;
}

.widget-dashboard-calendar {
    grid-column: 2 / 4;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    padding: 0 !important; /* Let calendar touch edges */
    overflow: hidden;
    background: #252525;
    position: relative;
    border-radius: var(--border-radius);
    border: 1px solid #333; /* Match card style */

    height: 100%;       /* Fill the grid cells exactly */
    min-height: 0;      /* Allow shrinking below content size (Flexbox fix) */
    max-height: 100%;   /* Prevent growing */
}

.widget-dashboard-calendar .calendar-view {
    flex: 1;
    overflow: hidden; /* Hide overflow on the wrapper */
    display: flex;
    flex-direction: column;
    min-height: 0;    /* Critical for nested flex scrolling */
}

.widget-dashboard-calendar .calendar-scroll-area {
    flex: 1;
    overflow-y: auto; /* Scroll INSIDE this area */
    display: flex;
    position: relative;
}

/* Adjustments for the smaller Dashboard Calendar */
.widget-dashboard-calendar .day-header {
    padding: 8px 0;
    font-size: 0.7rem;
}
.widget-dashboard-calendar .time-label {
    font-size: 0.6rem;
}
.widget-dashboard-calendar .class-event {
    font-size: 0.65rem; /* Smaller text for dense view */
    pointer-events: none; /* Read-only */
}

.course-item { margin-top: 15px; }
.progress-bar {
    height: 6px;
    background: #333;
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}
.fill { height: 100%; background-color: var(--accent); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--accent) 80%, #000); /* Darker accent */
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: 0.2s;
}

.btn-secondary:hover {
    border-color: #888;
    color: #fff;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; padding: 10px; }
    .music-widget { display: none; } /* Hide music on mobile or move it */
    .bento-grid { grid-template-columns: 1fr; grid-template-rows: auto; } /* Stack everything */
    .widget-dashboard-calendar {height: 500px !important;}
    .widget-tasks, .widget-current-assignments { grid-row: span 1; }
}

/* --- COURSE DETAILS PAGE LAYOUT --- */
.course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.course-grid {
    display: grid;
    /* 60% Left Column, 40% Right Column */
    grid-template-columns: 1.5fr 1fr; 
    grid-template-rows: auto 1fr;
    gap: 20px;
    height: calc(100vh - 150px); /* Fill remaining height */
}

/* Section Titles */
.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- WIDGET PLACEMENTS --- */
.widget-assignments {
    grid-column: 1 / 2; /* Top Left */
    grid-row: 1 / 2;
    min-height: 250px;
}

.widget-notes {
    grid-column: 2 / 3; /* Top Right */
    grid-row: 1 / 2;
}

.widget-course-calendar {
    grid-column: 1 / 2; /* Bottom Left */
    grid-row: 2 / 3;
    /* This leaves Bottom Right empty, as requested (Topics/Useful removed) */
}

/* --- GOALS WIDGET (Row 3, Span 4) --- */
.widget-goals {
    grid-column: 1 / 5;
    grid-row: 3 / 4;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
}

.goals-header {
    margin-bottom: 15px;
    display: flex; align-items: center; gap: 8px;
    font-size: 1.1rem; font-weight: 700; color: #fff;
}

/* The 4-Column Layout Inside the Widget */
.goals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 15px;
    flex: 1;
    overflow: hidden;
}

/* Sub-Cards (Stats & Lists) */
.goal-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Progress Stats Area */
.goal-stats-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    gap: 20px;
}

.stat-item {
    display: flex; flex-direction: column; gap: 6px;
}

.stat-header {
    display: flex; justify-content: space-between;
    font-size: 0.8rem; color: #aaa; font-weight: 600;
}

.stat-track {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.2, 0, 0, 1);
}

/* Specific colors for different timeframes */
.fill-week { background: #60a5fa; } /* Blue */
.fill-semester { background: var(--accent); } /* Purple */
.fill-year { background: #34d399; } /* Green */

/* Header for goal lists */
.goal-list-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem; font-weight: 600; color: #ddd;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

/* Reuse the task container styles but scoped if needed */
.goal-list-body {
    flex: 1;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
}

/* Meatball Menu Button */
.task-options-btn {
    background: transparent;
    border: none;
    color: #52525b;
    cursor: pointer;
    width: 24px;
    height: 24px;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-left: 2px;
    transition: 0.2s;

    opacity: 0;
    transform: scale(0.9);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.task-row:hover .task-options-btn {
    opacity: 1;
    transform: scale(1);
}

.task-options-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Mobile Fixes */
@media (max-width: 768px) {
    .bento-grid { 
        grid-template-columns: 1fr; 
        grid-template-rows: auto; 
    }
    .widget-goals { grid-column: span 1; height: auto; }
    .goals-grid { grid-template-columns: 1fr; } /* Stack goal lists on mobile */
}

/* --- TABLE --- */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.hero-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: #e0e0e0;
}

.hero-table th {
    text-align: left;
    padding: 12px 16px;
    color: #888;
    font-weight: 500;
    font-size: 0.8rem;
    border-bottom: 1px solid #333;
}

.hero-table td {
    padding: 16px;
    border-bottom: 1px solid #2a2a2a; /* Very subtle divider */
    vertical-align: middle;
}

.hero-table tr:last-child td { border-bottom: none; }
.hero-table tr:hover { background-color: rgba(255,255,255,0.02); }

.cell-title { font-weight: 500; display: block; }
.cell-sub { font-size: 0.75rem; color: #666; margin-top: 2px; }

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
	align-items: center;
	gap: 6px;
}

.status-badge ion-icon {
	font-size: 0.9rem;
	transform: translateY(2px);
}

.status-badge.progress { background: rgba(59, 130, 246, 0.2); color: #60a5fa; } /* Blue */
.status-badge.pending { background: rgba(107, 114, 128, 0.2); color: #9ca3af; } /* Grey */
.status-badge.done { background: rgba(16, 185, 129, 0.2); color: #34d399; } /* Green */

/* --- LECTURE NOTES (Mini Grid) --- */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.note-item {
    background: #2a2a2a;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.note-item:hover { border-color: #444; background: #333; }
.note-icon { font-size: 1.2rem; }
.note-info h4 { font-size: 0.85rem; margin: 0; color: #fff; }
.note-info p { font-size: 0.7rem; color: #888; margin: 2px 0 0; }

/* --- CALENDAR WIDGET --- */
.widget-course-calendar {
    display: flex;
    flex-direction: column;
    padding: 0 !important; /* Remove standard padding to let grid hit edges */
    overflow: hidden;
    position: relative;
    background: #252525;
}

.calendar-header-row {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252525;
    z-index: 20;
    border-bottom: 1px solid #333;
}

.btn-add-event {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* --- THE GRID LAYOUT --- */
.calendar-view {
    display: flex;
    flex-direction: column;
    flex: 1; /* Fills remaining height of the card */
    overflow: hidden;
}

.days-header-row {
    display: grid;
    grid-template-columns: 50px repeat(7, 1fr); /* 50px for time column */
    border-bottom: 1px solid #333;
    background: #252525;
}

.header-spacer { width: 50px; }

.day-header {
    text-align: center;
    padding: 10px 0;
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
}
.day-header.today { color: var(--accent); }

/* SCROLL AREA */
.calendar-scroll-area {
    display: flex;
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* Hide Scrollbar */
.calendar-scroll-area::-webkit-scrollbar { width: 4px; }

/* TIME COLUMN */
.time-column {
    width: 50px;
    flex-shrink: 0;
    border-right: 1px solid #333;
    background: #1e1e1e;
}

.time-label {
    height: 60px; /* 1 Hour = 60px height */
    font-size: 0.65rem;
    color: #666;
    text-align: right;
    padding-right: 8px;
    transform: translateY(-8px); /* Center label on line */
}

.time-column .time-label:first-child {
	transform: translateY(5px);
}

/* WEEK GRID */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
    position: relative;
}

.day-col {
    border-right: 1px solid #2a2a2a;
    position: relative;
}

/* Slot Lines */
.day-slots {
	position: relative;
    display: grid;
    grid-template-rows: repeat(24, 60px);
	height: 1440px;
}

.slot {
    height: 60px;
    border-bottom: 1px solid #2a2a2a;
    box-sizing: border-box;
	position: relative; /* anchors the hover effect inside */
	cursor: pointer;
}

.slot::after {
    content: '';
    position: absolute;
    /* This creates the gap: 4px from Top/Bottom, 6px from Left/Right */
    inset: 2px 6px; 
    border-radius: 8px;
    background: var(--text-muted); 
    opacity: 0; /* Invisible by default */
    transform: scale(0.95); /* Starts slightly smaller */
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none; /* Ensures clicks go through to the slot */
}

/* Hover State */
.slot:hover::after {
    opacity: 0.15; /* Shows the purple box at 15% opacity */
    transform: scale(1); /* Grows to fill the inset space */
}

/* Active/Click State (Optional: gives instant feedback) */
.slot:active::after {
    opacity: 0.25;
    transform: scale(0.98);
}

/* CURRENT TIME INDICATOR */
.now-line {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: var(--accent);
    z-index: 10;
    pointer-events: none;
}
.now-dot {
    position: absolute; left: -4px; top: -3px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
}

/* --- EVENT BLOCKS --- */
.class-event {
    position: absolute;
    left: 2px; right: 2px;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #fff;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    border-left: 3px solid rgba(255,255,255,0.5);
    z-index: 5;
    transition: transform 0.1s;

	box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.25), /* Top highlight */
        0 2px 5px rgba(0,0,0,0.3); /* Drop shadow */

	border: none;
}
.class-event:hover { transform: scale(1.02); z-index: 20; }

.event-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-time { font-size: 0.6rem; opacity: 0.8; }

/* --- CONNECTED EVENT STYLES --- */

/* If an event connects to one below it */
.class-event.connect-bottom {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
	z-index: 1;

	box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}

/* If an event connects to one above it */
.class-event.connect-top {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
	margin-top: -1px;
	z-index: 5;

	box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* If it connects both ways (middle of a stack) */
.class-event.connect-bottom.connect-top {
    border-radius: 0;
	z-index: 2;
	box-shadow: none;
}

/* --- WIDGET PLACEMENT (Bottom Right) --- */
.widget-course-info {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- PROFESSOR CARD --- */
.prof-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
}

.prof-avatar {
    width: 40px; height: 40px;
    background: #2a2a2a;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    font-size: 1.2rem;
}

.prof-details { flex: 1; }

.prof-name { font-weight: 600; font-size: 0.95rem; color: #fff; }

.btn-email {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    width: 36px; height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.btn-email:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.office-hours {
    display: flex; align-items: center; gap: 8px;
    margin-top: 10px;
    font-size: 0.8rem; color: #aaa;
    padding-left: 4px;
}

/* --- SEPARATOR --- */
.info-separator {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 5px 0;
}

/* --- GRADING SCHEME --- */
.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #666;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.grading-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grade-item { display: flex; flex-direction: column; gap: 4px; }

.grade-label {
    display: flex; justify-content: space-between;
    font-size: 0.8rem; color: #ccc;
}

.grade-track {
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    overflow: hidden;
}

.grade-fill { height: 100%; border-radius: 3px; }

/* --- RESOURCE PILLS --- */
.resource-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.resource-pill {
    flex: none;
    display: flex; align-items: center; justify-content: center;
    gap: 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 12px;
    border-radius: 8px;
    color: #ccc;
    font-size: 0.85rem;
    text-decoration: none;
    transition: 0.2s;
    height: 100%;
}

.resource-pill:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    transform: translateY(-2px);
}

.btn-modal-delete {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.btn-modal-delete:hover {
    color: #ef4444;
}

.btn-icon-small {
    background: transparent;
    border: 1px solid #444;
    color: #aaa;
    width: 24px; height: 24px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.btn-icon-small:hover { border-color: var(--accent); color: #fff; background: rgba(255,255,255,0.05); }

/* --- CIRCULAR CHART STYLES --- */
.grading-chart-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.chart-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.circular-chart {
    display: block;
    width: 100%;
    height: 100%;
    transform: rotate(0deg); 
}

.circle-bg {
    fill: none;
    stroke: #2a2a2a;
    stroke-width: 3.8;
}

.circle-segment {
    fill: none;
    stroke-width: 3.8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease; /* Smooth loading only */
    cursor: default;
}

/* Center Percentage Text */
.chart-center-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    pointer-events: none;
}

/* Legend */
.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #ccc;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: default;
}

.legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

/* Container for the right side (Percent + Menu) */
.legend-right {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between % and button */
}

/* The Meatball Button */
.btn-legend-menu {
    background: transparent;
    border: none;
    color: #666; /* Subtle default color */
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Hidden by default */
    opacity: 0; 
    transform: translateX(-5px); /* Slide in effect */
    transition: all 0.2s ease;
}

/* Reveal on Row Hover */
.legend-item:hover .btn-legend-menu {
    opacity: 1;
    transform: translateX(0);
}

/* Hover state for the button itself */
.btn-legend-menu:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center; align-items: center;
}
.modal-overlay.open { display: flex; }

.modal-glass {
    background: #1e1e1e;
    border: 1px solid #333;
    padding: 25px;
    border-radius: 16px;
    width: 350px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
	gap: 6px;
	display: flex;
	flex-direction: column;
    position: relative;
}
.modal-glass h3 { margin-bottom: 10px; color: #fff; }
.modal-glass input, .modal-glass select {
    width: 100%; background: #2a2a2a; border: 1px solid #444;
    color: #fff; padding: 10px; border-radius: 8px; margin-bottom: 15px;
}

.modal-actions {
	gap: 15px;
	display: flex;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.input-group label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    margin-left: 2px;
}

.req-star {
	color: #ff453a;
	margin-left: 1px;
}

/* --- CUSTOM SELECT DROPDOWN --- */
.custom-select {
    position: relative;
    width: 100%;
    cursor: pointer;
    font-size: 0.9rem;
}

.select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 10px 12px;
    border-radius: 8px;
    color: #ccc;
    transition: 0.2s;
}

.custom-select.active .select-trigger {
    border-color: var(--accent);
    color: #fff;
}

.select-options {
    position: absolute;
    top: 110%;
    left: 0; right: 0;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: 0.2s;
    overflow: hidden;
}

.custom-select.active .select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.option {
    padding: 10px 12px;
    color: #ccc;
    transition: 0.2s;
}

.option:hover {
    background: #333;
    color: #fff;
}

/* --- CUSTOM DATE PICKER (HeroUI Style) --- */
.custom-date-picker {
    position: relative;
    width: 100%;
}

.date-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 10px 12px;
    border-radius: 8px;
    color: #ccc;
    cursor: pointer;
    transition: 0.2s;
}

.date-trigger:hover { border-color: #666; }
.date-trigger ion-icon { font-size: 1.1rem; color: var(--accent); }

.mini-calendar {
    position: absolute;
    top: 110%; left: 0;
    width: 280px;
    background: #18181b; /* Dark Zinc */
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
}

.mini-calendar.visible { display: block; }

.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: #fff;
    font-weight: 600;
}

.cal-header button {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}
.cal-header button:hover { background: #333; color: #fff; }

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 8px;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #ccc;
    border-radius: 6px;
    cursor: pointer;
}

.cal-day:hover { background: #27272a; }
.cal-day.empty { pointer-events: none; }
.cal-day.today { border: 1px solid var(--accent); color: var(--accent); }
.cal-day.selected { background: var(--accent); color: #fff; }

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.status-badge.progress { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-badge.pending { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.status-badge.done { background: rgba(16, 185, 129, 0.2); color: #34d399; }

/* The Grid Container */
.directory-grid {
    display: grid;
    /* This ensures cards are side-by-side, not stacked */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* The Individual Course Card */
.dir-card {
    background: #252525;
    border-radius: 16px;
    border: 1px solid #333;
    position: relative;
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    text-decoration: none;
    padding: 0; /* REMOVED PADDING so image hits the edge */
    overflow: hidden; /* Ensures image respects rounded corners */
}

.dir-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

/* New: The Banner Image Area */
.dir-card-banner {
    height: 120px;
    width: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}

/* Overlay gradient so the delete button and icon pop */
.dir-card-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

/* The Box around the Icon */
.course-icon-box {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 42px; height: 42px;
    background: rgba(30, 30, 30, 0.8); /* Semi-transparent dark bg */
    backdrop-filter: blur(4px); /* Glass effect */
    color: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 0;
    z-index: 2;
    border: 1px solid rgba(255,255,255,0.1);
}

.dir-course-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.dir-course-prof {
    font-size: 0.85rem;
    color: #888;
}

/* Content Area (Text) below the image */
.dir-card-content {
    padding: 20px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1; /* Pushes content to fill space */
}

.dir-course-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.dir-course-prof {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 10px;
}

.context-menu {
    position: fixed;
    z-index: 10000;
    width: 260px;
    background: #18181b; /* Zinc-900 style dark */
    border: 1px solid #27272a;
    border-radius: 14px;
    padding: 6px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1), 
        0 10px 15px -3px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05); /* Subtle inner ring */
    display: none; /* Hidden by default */
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.1s ease, transform 0.1s ease;
    backdrop-filter: blur(12px);
}

.context-menu.visible {
    display: block;
    opacity: 1;
    transform: scale(1);
}

/* --- SEGMENTED CONTROL (Better Action Type Selector) --- */
.segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.seg-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #888;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.seg-btn:hover {
    color: #ccc;
    background: rgba(255,255,255,0.03);
}

.seg-btn.active {
    background: var(--accent); /* Purple Highlight */
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-weight: 600;
}

/* Menu Section Label */
.ctx-label {
    padding: 8px 12px 4px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #71717a; /* Muted text */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Menu Items */
.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: #e4e4e7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.ctx-item:hover {
    background: #27272a; /* Zinc-800 hover */
    color: #fff;
}

.ctx-item ion-icon {
    font-size: 1.1rem;
    color: #a1a1aa;
}

.ctx-item:hover ion-icon {
    color: var(--accent);
}

/* Danger Item (Delete) */
.ctx-item.danger:hover {
    background: rgba(239, 68, 68, 0.15); /* Red tint */
    color: #ef4444;
}
.ctx-item.danger:hover ion-icon {
    color: #ef4444;
}

/* Separator */
.ctx-separator {
    height: 1px;
    background: #27272a;
    margin: 6px 0;
}

/* --- EMBEDDED ICON PICKER --- */
.ctx-icon-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.ctx-icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    color: #a1a1aa;
    transition: background 0.2s, color 0.2s;
}

.ctx-icon-option:hover {
    background: #27272a;
    color: #fff;
}

.ctx-icon-option.selected {
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

/* --- ASSIGNMENT CONTEXT MENU SPECIFICS --- */
.ctx-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px 8px 8px 8px;
}

.ctx-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 4px 8px 8px 8px;
}

/* Color coordination for Status Icons */
.status-pending { color: #a1a1aa; }
.status-progress { color: #60a5fa; }
.status-done { color: #34d399; }

/* Hover effects for status options */
.ctx-icon-option:hover .status-progress { color: #fff; }
.ctx-icon-option:hover .status-done { color: #fff; }

/* --- RESPONSIVE ADJUSTMENT --- */
@media (max-width: 1024px) {
    .course-grid { grid-template-columns: 1fr; }
    .widget-assignments, .widget-notes, .widget-course-calendar { grid-column: span 1; }
}

/* --- NOTES WIDGET (Dashboard Grid) --- */
.widget-notes {
    position: relative;
    grid-column: span 1; 
    grid-row: span 1; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 400px;
}

.notes-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-icon-only {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px; 
    transition: 0.2s;
}
.btn-icon-only:hover { background: rgba(255,255,255,0.1); }

/* The Grid for the Widget */
.notes-preview-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.note-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: 0.2s;
    height: 100px; /* Fixed height for uniformity */
    display: flex;
    flex-direction: column;
}
.note-card:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(2px);
    border-color: rgba(255,255,255,0.2);
}

.note-card-title { font-weight: 600; font-size: 0.95rem; color: #fff; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-card-date { font-size: 0.75rem; color: #666; margin-bottom: 6px; }
.note-card-snippet { font-size: 0.8rem; color: #999; line-height: 1.4; overflow: hidden; display: -webkit-box; line-clamp: 1; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }

/* --- FULL SCREEN MODAL (Apple Notes Style) --- */
.modal-full {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.95); /* Start slightly smaller */
    width: 85vw; height: 85vh;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 50px 100px rgba(0,0,0,0.8);
    display: flex;
    overflow: hidden;
    
    /* Animation State: Hidden by default */
    opacity: 0; 
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); /* smooth pop-up */
    z-index: 2001; /* Above overlay */
}

/* WHEN OPEN: The overlay adds 'open', which triggers this child */
.modal-overlay.open .modal-full {
    opacity: 1; 
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

/* Sidebar (List) */
.notes-sidebar {
    width: 300px;
    background: #151515;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}
.notes-search-bar {
    padding: 15px;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notes-search-bar .btn-icon-only {
    flex: 0 0 auto;
}

.notes-search-input {
    width: auto;
    flex: 1;
    min-width: 0;
    background: #252525;
    border: none;
    padding: 8px 12px; border-radius: 6px; color: #fff;
}
.notes-list { flex: 1; overflow-y: auto; }

.note-item { padding: 15px; border-bottom: 1px solid #222; cursor: pointer; transition: 0.2s; }
.note-item:hover { background: rgba(255,255,255,0.03); }
.note-item.active { background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 3px solid var(--accent); }

/* Main Editor Area */
.notes-editor { flex: 1; display: flex; flex-direction: column; background: #1e1e1e; }

.editor-toolbar {
    padding: 10px 20px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #333;
}
.editor-tools { display: flex; gap: 8px; }

.note-meta-info { font-size: 0.8rem; color: #555; }

.editor-canvas {
    flex: 1; padding: 30px 50px; overflow-y: auto;
}
.editor-title {
    width: 100%; background: transparent; border: none;
    font-size: 2rem; font-weight: 700; color: #fff;
    margin-bottom: 20px; outline: none;
}
.editor-body {
    width: 100%; min-height: 50vh;
    background: transparent; border: none;
    color: #ccc; font-size: 1.1rem; line-height: 1.6;
    outline: none;
}

/* Rich Text Styling inside ContentEditable */
.editor-body ul { padding-left: 20px; margin: 10px 0; }
.editor-body li { margin-bottom: 5px; }
.editor-body b { color: #fff; font-weight: 700; }

/* --- RICH TEXT EDITOR TYPOGRAPHY --- */
/* This forces the headers to actually look like headers inside the editor */

.editor-body h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    margin-top: 0.8em;
    margin-bottom: 0.4em;
    line-height: 1.2;
    border-bottom: 1px solid rgba(255,255,255,0.1); /* Optional: nice divider */
    padding-bottom: 4px;
}

.editor-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0f0f0;
    margin-top: 0.8em;
    margin-bottom: 0.4em;
    line-height: 1.3;
}

.editor-body h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #f0f0f0; /* Uses your purple accent */
    margin-top: 0.6em;
    margin-bottom: 0.2em;
}

.editor-body p {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 0.8em;
    line-height: 1.6;
}

.editor-body div {
    /* Fallback for new lines in some browsers */
    margin-bottom: 0.4em; 
}

/* --- EDITOR TOOLBAR & DROPDOWNS --- */
.editor-toolbar {
    position: relative; /* Anchor for dropdowns */
    padding: 10px 20px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #333;
    z-index: 20;
}

/* Container for tool buttons to allow relative positioning of menus */
.tool-group {
    position: relative;
    display: inline-block;
}

/* The Dropdown Menus */
.editor-menu {
    position: absolute;
    top: 120%; left: 0;
    width: 192px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    padding: 8px;
    display: none;
    flex-direction: column;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.editor-menu.visible { display: flex; }

/* Row of Icons (Bold, Italic, etc) */
.style-row {
    display: flex;
    justify-content: space-between;
    padding: 4px;
    margin-bottom: 6px;
    width: 100%;
}

.style-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #ccc;
    width: 32px; height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.style-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.style-btn.active { background: var(--accent); color: #fff; }

/* Separator Line */
.menu-separator {
    height: 1px;
    background: #333;
    margin: 6px 0;
}

/* Typography List (H1, H2, etc) */
.typography-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.type-option {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #ccc;
    transition: 0.2s;
    display: flex; align-items: center;
}
.type-option:hover { background: rgba(255,255,255,0.05); color: #fff; }

/* Visual cues for the types in the menu */
.type-h1 { font-size: 1.4rem; font-weight: 800; }
.type-h2 { font-size: 1.2rem; font-weight: 700; }
.type-h3 { font-size: 1rem; font-weight: 600; }
.type-p  { font-size: 0.9rem; font-weight: 400; }

/* Symbols Grid */
.symbol-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.symbol-btn {
    width: 100%; aspect-ratio: 1;
    background: transparent; border: none; color: #ccc;
    border-radius: 4px; cursor: pointer;
    font-size: 1rem;
}
.symbol-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Button Styles for Toolbar */
.toolbar-btn {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px; 
    transition: 0.2s;
}
.toolbar-btn:hover { background: rgba(255,255,255,0.1); }

/* --- HERO UI INPUTS & SETTINGS --- */

/* The Page Layout */
.settings-container {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two Columns */
    gap: 24px;
    align-items: start;
}

/* Make profile card span full width on mobile, half on desktop */
@media (max-width: 768px) {
    .settings-container { grid-template-columns: 1fr; }
}

/* Card Styling Update */
.settings-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f3f4f6;
    font-weight: 700;
    font-size: 1rem;
}

.hero-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hero-input-group label {
    color: #9ca3af;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.hero-input {
    width: 100%;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #fff;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hero-input::placeholder {
    color: #6b7280;
}

.hero-input:focus {
    border-color: color-mix(in srgb, var(--accent) 60%, #fff 10%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.input-helper {
    font-size: 0.78rem;
    color: #8b8b8b;
}

.license-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.license-status {
    font-size: 0.78rem;
    font-weight: 600;
}

.license-status.unlocked {
    color: #34d399;
}

.license-status.locked {
    color: #f87171;
}

.roman-badge {
    margin-top: 6px;
    width: fit-content;
    min-width: 38px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 50%, #222);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-weight: 700;
}

.theme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.theme-circle {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.theme-circle:hover {
    transform: translateY(-1px) scale(1.06);
}

.theme-circle.active {
    border-color: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.save-bar {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 14px;
    background: #1f1f1f;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- SPA VIEW SWITCHING --- */
.app-view {
    display: none;
}

.app-view.active {
    display: block;
}

[data-license-action][disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- MOBILE NAV (PORTRAIT) --- */
.mobile-top-bar {
    display: none;
    pointer-events: none;
}

.swipe-hint {
    display: none;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(3px);
    z-index: 1190;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 900px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-container {
        min-height: 100vh;
        flex-direction: column;
    }

    /* Phone dashboard: force a single vertical feed and remove non-essential widgets */
    .bento-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
        grid-template-columns: none;
        grid-template-rows: none;
    }

    .bento-grid > * {
        width: 100%;
        min-width: 0;
    }

    .widget-spotify-player,
    .widget-dashboard-calendar {
        display: none !important;
    }

    .swipe-hint {
        display: block;
        position: fixed;
        left: 0;
        top: 50%;
        width: 11px;
        height: 88px;
        transform: translateY(-50%);
        border: none;
        border-radius: 0 999px 999px 0;
        background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 28%, #232732), #1b1d27);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34);
        opacity: 0.64;
        z-index: 1185;
        cursor: pointer;
        padding: 0;
        transition: opacity 0.18s ease, transform 0.18s ease;
        animation: swipeHintPulse 2.3s ease-in-out infinite;
    }

    .swipe-hint::before,
    .swipe-hint::after {
        content: '';
        position: absolute;
        width: 5px;
        height: 5px;
        border-top: 1.5px solid rgba(255, 255, 255, 0.8);
        border-right: 1.5px solid rgba(255, 255, 255, 0.8);
        transform: rotate(45deg);
        right: 3px;
    }

    .swipe-hint::before {
        top: 40%;
    }

    .swipe-hint::after {
        top: 53%;
    }

    @keyframes swipeHintPulse {
        0%, 100% {
            opacity: 0.55;
        }
        50% {
            opacity: 0.88;
        }
    }

    body.mobile-nav-open .swipe-hint {
        opacity: 0;
        transform: translate(-8px, -50%);
        pointer-events: none;
        visibility: hidden;
    }

    body:not(.mobile-nav-open) .swipe-hint {
        visibility: visible;
    }

    .sidebar {
        width: min(84vw, 300px);
        max-width: 300px;
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        z-index: 1200;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: 18px 0 36px rgba(0, 0, 0, 0.52);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .content-area {
        padding: 10px 14px 16px;
        overflow-x: clip;
        max-width: 100%;
    }

    .hero-banner,
    .course-header {
        margin-top: 10px;
    }

    .course-grid {
        height: auto;
        min-height: 0;
    }

    /* Course details on phones: full-width vertical widgets, never side-by-side */
    #view-course-details .course-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
        grid-template-columns: none;
        grid-template-rows: none;
        width: 100%;
    }

    #view-course-details .course-grid > .card {
        width: 100%;
        min-width: 0;
        grid-column: auto !important;
        grid-row: auto !important;
    }

    /* Assignments table: keep card width fixed, scroll table content inside */
    #view-course-details .widget-assignments .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #view-course-details .widget-assignments .hero-table {
        min-width: 620px;
    }

    /* Calendar: horizontal scroll within the widget, not on whole page */
    #view-course-details .widget-course-calendar {
        overflow: hidden;
    }

    #view-course-details .widget-course-calendar .calendar-view {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    #view-course-details .widget-course-calendar .days-header-row,
    #view-course-details .widget-course-calendar .calendar-scroll-area,
    #view-course-details .widget-course-calendar .week-grid {
        min-width: 620px;
    }

    #view-course-details .widget-course-calendar .calendar-scroll-area {
        overflow-x: visible;
    }

    .table-container,
    .calendar-scroll-area {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .hero-table {
        min-width: 520px;
    }

    .days-header-row,
    .week-grid {
        min-width: 620px;
    }
}

/* Hide mobile top bar in landscape and use fixed desktop-like sidebar */
@media (max-width: 900px) and (orientation: landscape) {
    .mobile-top-bar,
    .swipe-hint,
    .sidebar-overlay {
        display: none !important;
    }

    body.mobile-nav-open {
        overflow: auto;
    }

    .app-container {
        flex-direction: row;
    }

    .sidebar {
        position: sticky;
        top: 0;
        transform: none !important;
        width: 220px;
        min-width: 220px;
        height: 100dvh;
        box-shadow: none;
        z-index: 2;
    }

    .content-area {
        padding: 16px;
        max-width: calc(100% - 220px);
    }
}

