/* style.css - shared styles for StudyMate */
/* */

:root {
    /* Light theme (default) */
    --bg: #ffffff;
    --bg-color: #ffffff;
    --text-color: #333333;
    --primary: #4a6bff;
    --primary-dark: #3a56cc;
    --border-color: #e0e0e0;
    --card-bg: #ffffff;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --input-bg: #f8f9fa;
    --input-border: #ced4da;
    --input-text: #333333;
    /* Redundant variables merged for consistency */
    --primary: #3182ce;
    --primary-dark: #2c5aa0;
    --bg-secondary: #f8fafc;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --muted: #718096;
    --success: #48bb78;
    --danger: #f56565;
    --glass: rgba(255, 255, 255, 0.9);
    --header-grad: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    --card-radius: 14px;
    --shadow: 0 6px 18px rgba(17, 24, 39, 0.06);
    --header-bg: #fff;
    --header-text: #2d3748;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* Dark theme overrides */
[data-theme="dark"] {
    --bg: #121212;
    --bg-color: #121212;
    --text-color: #f5f5f5;
    --card-bg: #1e1e1e;
    --border-color: #333333;
    --input-bg: #2d2d2d;
    --input-border: #444444;
    --input-text: #f5f5f5;
    
    /* Variables from second root block merged here */
    --bg: #1a202c;
    --bg-secondary: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --card-bg: #2d3748;
    --muted: #a0aec0;
    --glass: rgba(45, 55, 72, 0.9);
    --header-grad: linear-gradient(90deg, #4a5bbf 0%, #5a3a7e 100%);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    --header-bg: #2d3748;
    --header-text: #f7fafc;

    /* FIX 1: Ensure input text is visible in Dark Mode */
    input[type="text"], 
    input[type="email"], 
    input[type="password"], 
    input[type="url"], 
    input[type="date"], 
    select, 
    textarea,
    .input {
        color: var(--input-text);
        background-color: var(--input-bg);
        border-color: var(--input-border);
    }
}

/* FIX 1.1: Fix "Filter Button" (Select) visibility in dark mode */
[data-theme="dark"] .select {
    color: var(--input-text);
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

/* FIX 1.2: Fix "Nav Buttons" visibility in dark mode */
[data-theme="dark"] .nav-links a {
    color: var(--text-secondary); /* Light grey instead of dark grey */
}
[data-theme="dark"] .nav-links a:hover {
    color: var(--primary);
}
[data-theme="dark"] .nav-links a.active {
    color: #fff;
}

/* FIX 1.3: Fix "Priority" text visibility in dark mode */
[data-theme="dark"] .task-meta {
    color: #cbd5e0; /* Brighter than the default muted color */
}

/* FIX 7: Disable transition for initial load (used by theme.js) */
.no-transition, .no-transition * {
    transition: none !important;
}

/* Base styles */
html, body {
    background: var(--bg);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary);
}

/* NAV */
.navbar {
    background: var(--header-bg);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
    color: var(--header-text);
}

.brand {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.35rem
}

.nav-links {
    display: flex;
    gap: 18px;
    align-items: center
}

.nav-links a {
    padding: 8px 12px;
    border-radius: 8px;
    color: #475569; /* Default light mode color */
    font-weight: 600
}

.nav-links a.active {
    background: var(--primary);
    color: #fff
}

/* HERO */
.hero {
    background: var(--header-grad);
    color: white;
    padding: 44px 28px;
    text-align: center;
    margin-top: 8px;
}

.hero h1 {
    font-size: 2.3rem;
    margin: 0 0 8px
}

.hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.85)
}

/* container */
.container {
    max-width: 1180px;
    margin: 40px auto;
    padding: 0 18px
}

/* stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin: -24px 0 18px
}

.stat-card {
    background: var(--card-bg);
    padding: 18px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(15, 23, 42, 0.03)
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary)
}

.stat-label {
    color: var(--muted);
    margin-top: 6px
}

/* main card */
.card {
    background: var(--card-bg);
    padding: 18px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(15, 23, 42, 0.03)
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700
}

.add-btn {
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600
}

.add-btn:hover {
    background: var(--primary-dark)
}

/* task list */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: #f8fafc79;
    border: 1px solid rgba(15, 23, 42, 0.03)
}

.task-item.completed {
    background: #f0fff47c;
    border-color: rgba(72, 187, 120, 0.25);
    opacity: 0.9
}

.task-left {
    display: flex;
    align-items: center;
    gap: 12px
}

.task-title {
    font-weight: 700;
    font-size: 1rem;
    color: rgba(59, 59, 59, 0.85)
}

.task-meta {
    display: flex;
    gap: 10px;
    color: var(--muted);
    font-size: 0.86rem;
    margin-top: 6px
}

.task-subject {
    background: var(--primary);
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.78rem
}

.task-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center
}

/* small buttons */
.icon-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem
}

.complete-btn {
    background: var(--success);
    color: #fff
}

.delete-btn {
    background: var(--danger);
    color: #fff
}

/* empty state */
.empty {
    padding: 28px;
    text-align: center;
    color: var(--muted)
}

/* modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 15, 22, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60
}

.modal {
    width: 680px;
    max-width: 94%;
    background: var(--card-bg);
    padding: 18px;
    border-radius: 12px
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.form-row label {
    font-size: 0.86rem;
    color: #475569
}

.input,
select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e6eef6;
    font-size: 0.98rem
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px
}

/* filter */
.controls {
    display: flex;
    gap: 12px;
    align-items: center
}

.select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #e6eef6
}

/* deadlines page styles */
.deadline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.03)
}

.deadline-item.overdue {
    border-left: 6px solid var(--danger);
    background: #fff6f6
}

/* subjects progress */
.progress {
    height: 10px;
    background: #f2f6fb;
    border-radius: 999px;
    overflow: hidden
}

.progress-bar {
    height: 100%;
    background: var(--primary)
}

/* responsive */
@media (max-width:800px) {
    .form-grid {
        grid-template-columns: 1fr
    }

    .controls {
        flex-direction: column;
        align-items: stretch
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px
    }
}

/* === ANIMATION ADD-ONS FOR STUDYMATE === */

/* 1️⃣ Smooth hover animations for buttons */
.add-btn,
.icon-btn {
    transition: all 0.25s ease;
    transform: scale(1);
}

.add-btn:hover,
.icon-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.05);
}

/* 2️⃣ Card hover lift effect */
.stat-card,
.card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover,
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.1);
}

/* 3️⃣ Task item subtle fade and slide-in */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 4️⃣ Modal pop-up animation */
@keyframes popupScale {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-backdrop {
    animation: fadeSlideIn 0.3s ease both;
}

.modal {
    animation: popupScale 0.3s ease both;
    transition: transform 0.2s ease;
}

/* 5️⃣ Navigation hover underline animation */
.nav-links a {
    position: relative;
    transition: color 0.25s ease;
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* 6️⃣ Smooth transitions when switching pages or elements */
body {
    transition: background 0.4s ease, color 0.4s ease;
}

/* Theme Toggle Styles */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--input-bg);
}

.theme-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.theme-toggle input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.theme-toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}