/* =========================================
   STUDYBUDDY
   Main Stylesheet
========================================= */


/* =========================================
   CSS VARIABLES
========================================= */

:root {
    --background-color: #f5f7fb;
    --card-background: #ffffff;

    --text-primary: #1f2937;
    --text-secondary: #6b7280;

    --border-color: #e5e7eb;

    --accent-color: #6366f1;
    --accent-hover: #4f46e5;

    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --header-background: rgba(255, 255, 255, 0.92);

    --shadow-small: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-medium: 0 10px 30px rgba(15, 23, 42, 0.08);

    --radius-small: 10px;
    --radius-medium: 16px;
    --radius-large: 22px;
}


/* =========================================
   DARK MODE
========================================= */

body.dark-mode {
    --background-color: #0f172a;
    --card-background: #1e293b;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --border-color: #334155;

    --header-background: rgba(15, 23, 42, 0.92);

    --shadow-small: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.3);
}


/* =========================================
   RESET
========================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


html {
    scroll-behavior: smooth;
}


body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    background: var(--background-color);
    color: var(--text-primary);

    line-height: 1.5;

    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}


/* =========================================
   HEADER
========================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: var(--header-background);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border-bottom: 1px solid var(--border-color);
}


.header-content {
    max-width: 1100px;
    margin: 0 auto;

    padding: 14px 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}


.brand-icon {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #eef2ff;

    border-radius: 12px;

    font-size: 23px;
}


.brand h1 {
    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
}


.brand p {
    margin-top: 2px;

    font-size: 12px;
    color: var(--text-secondary);
}


/* Theme button */

.theme-toggle {
    width: 42px;
    height: 42px;

    border: 1px solid var(--border-color);
    border-radius: 50%;

    background: var(--card-background);

    cursor: pointer;

    font-size: 18px;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease;
}


.theme-toggle:hover {
    transform: translateY(-2px);
}


/* =========================================
   HERO
========================================= */

.hero {
    padding: 70px 24px 60px;

    background:
        radial-gradient(
            circle at top right,
            rgba(99, 102, 241, 0.18),
            transparent 35%
        ),
        radial-gradient(
            circle at bottom left,
            rgba(168, 85, 247, 0.12),
            transparent 35%
        );
}


.hero-content {
    max-width: 1100px;
    margin: 0 auto;
}


.hero-label {
    display: inline-block;

    padding: 7px 12px;

    border-radius: 999px;

    background: #eef2ff;
    color: #4f46e5;

    font-size: 13px;
    font-weight: 600;
}


.hero h2 {
    margin-top: 18px;

    font-size: clamp(40px, 6vw, 64px);

    line-height: 1.05;

    letter-spacing: -2px;
}


.hero p {
    max-width: 650px;

    margin-top: 20px;

    color: var(--text-secondary);

    font-size: 17px;
    line-height: 1.7;
}


/* =========================================
   DASHBOARD
========================================= */

.dashboard {
    max-width: 1100px;

    margin: 0 auto;

    padding: 0 24px 60px;
}


/* =========================================
   OVERVIEW CARD
========================================= */

.overview-card {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    padding: 28px;

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #7c3aed
        );

    color: white;

    border-radius: var(--radius-large);

    box-shadow: var(--shadow-medium);
}


.overview-label {
    font-size: 12px;

    font-weight: 700;

    letter-spacing: 1px;

    opacity: 0.8;
}


.overview-card h2 {
    margin-top: 6px;

    font-size: 25px;
}


.overview-card p {
    margin-top: 5px;

    font-size: 14px;

    opacity: 0.9;
}


/* Progress circle */

.progress-circle {
    width: 92px;
    height: 92px;

    flex-shrink: 0;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        conic-gradient(
            white 0deg,
            rgba(255, 255, 255, 0.2) 0deg
        );

    position: relative;
}


.progress-circle::before {
    content: "";

    position: absolute;

    width: 70px;
    height: 70px;

    border-radius: 50%;

    background: #6366f1;
}


.progress-circle span {
    position: relative;

    font-weight: 700;

    font-size: 16px;
}


/* =========================================
   CARDS
========================================= */

.card {
    margin-top: 24px;

    padding: 26px;

    background: var(--card-background);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-medium);

    box-shadow: var(--shadow-small);

    transition:
        background-color 0.25s ease,
        border-color 0.25s ease;
}


.card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}


.section-label {
    display: block;

    margin-bottom: 5px;

    font-size: 11px;

    font-weight: 700;

    letter-spacing: 1px;

    color: var(--accent-color);
}


.card h2 {
    font-size: 21px;
}


/* =========================================
   TASK INPUT
========================================= */

.task-input {
    display: grid;

    grid-template-columns: 1fr 150px auto;

    gap: 10px;
}


.task-input input,
.task-input select,
.ai-inputs input,
.ai-inputs textarea {
    border: 1px solid var(--border-color);

    border-radius: 10px;

    background: var(--card-background);

    color: var(--text-primary);

    font-family: inherit;

    font-size: 14px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.task-input input {
    padding: 12px 14px;
}


.task-input select {
    padding: 12px;
}


.task-input input:focus,
.task-input select:focus,
.ai-inputs input:focus,
.ai-inputs textarea:focus {
    border-color: var(--accent-color);

    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.12);
}


/* =========================================
   BUTTONS
========================================= */

button {
    font-family: inherit;
}


#addTaskBtn,
.primary-btn {
    border: none;

    border-radius: 10px;

    background: var(--accent-color);

    color: white;

    padding: 11px 17px;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}


#addTaskBtn:hover,
.primary-btn:hover {
    background: var(--accent-hover);

    transform: translateY(-1px);
}


.secondary-btn {
    border: 1px solid var(--border-color);

    border-radius: 10px;

    background: var(--card-background);

    color: var(--text-primary);

    padding: 11px 17px;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}


.secondary-btn:hover {
    background: var(--background-color);

    transform: translateY(-1px);
}


/* =========================================
   TASK TOOLBAR
========================================= */

.task-toolbar {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-top: 18px;
}


.task-filters {
    display: flex;

    flex-wrap: wrap;

    gap: 7px;
}


.filter-btn {
    border: 1px solid var(--border-color);

    background: transparent;

    color: var(--text-secondary);

    padding: 7px 11px;

    border-radius: 8px;

    font-size: 12px;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}


.filter-btn:hover {
    color: var(--text-primary);
}


.filter-btn.active {
    background: var(--accent-color);

    border-color: var(--accent-color);

    color: white;
}


.task-count {
    white-space: nowrap;

    color: var(--text-secondary);

    font-size: 13px;
}


/* =========================================
   TASK LIST
========================================= */

#taskList {
    list-style: none;

    margin-top: 18px;
}


.task-item {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 14px 0;

    border-bottom: 1px solid var(--border-color);
}


.task-item:last-child {
    border-bottom: none;
}


.task-checkbox {
    width: 19px;
    height: 19px;

    flex-shrink: 0;

    cursor: pointer;

    accent-color: var(--accent-color);
}


.task-content {
    flex: 1;

    min-width: 0;
}


.task-text {
    font-size: 14px;

    word-break: break-word;
}


.task-item.completed .task-text {
    text-decoration: line-through;

    color: var(--text-secondary);
}


.priority-badge {
    display: inline-block;

    margin-top: 4px;

    padding: 3px 7px;

    border-radius: 999px;

    font-size: 10px;

    font-weight: 600;
}


.priority-high {
    background: rgba(239, 68, 68, 0.12);

    color: #dc2626;
}


.priority-medium {
    background: rgba(245, 158, 11, 0.12);

    color: #d97706;
}


.priority-low {
    background: rgba(34, 197, 94, 0.12);

    color: #16a34a;
}


.delete-task {
    border: none;

    background: transparent;

    color: var(--text-secondary);

    cursor: pointer;

    font-size: 16px;

    padding: 5px;

    border-radius: 6px;
}


.delete-task:hover {
    color: var(--danger-color);

    background: rgba(239, 68, 68, 0.08);
}


/* Empty task state */

.empty-state {
    padding: 30px 10px;

    text-align: center;

    color: var(--text-secondary);

    font-size: 14px;
}


/* =========================================
   TWO COLUMN LAYOUT
========================================= */

.two-column {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 24px;
}


/* =========================================
   TIMER
========================================= */

.timer-card {
    text-align: center;
}


.timer {
    font-variant-numeric: tabular-nums;
}


#timer {
    margin: 10px 0 12px;

    font-size: clamp(50px, 8vw, 72px);

    line-height: 1;

    font-weight: 700;

    letter-spacing: -2px;
}


.timer-description {
    color: var(--text-secondary);

    font-size: 13px;

    line-height: 1.6;
}


.timer-buttons {
    display: flex;

    justify-content: center;

    gap: 10px;

    margin-top: 20px;
}


/* =========================================
   NOTES
========================================= */

#notes {
    width: 100%;

    min-height: 155px;

    resize: vertical;

    padding: 14px;

    border: 1px solid var(--border-color);

    border-radius: 10px;

    background: var(--card-background);

    color: var(--text-primary);

    font-family: inherit;

    font-size: 14px;

    line-height: 1.6;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


#notes:focus {
    border-color: var(--accent-color);

    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.12);
}


.notes-footer {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    margin-top: 12px;
}


#notesStatus {
    color: var(--text-secondary);

    font-size: 12px;
}


/* =========================================
   AI STUDY PLANNER
========================================= */

.ai-planner-card {
    margin-top: 24px;
}


.ai-description {
    max-width: 750px;

    margin: 0 0 20px;

    color: var(--text-secondary);

    font-size: 14px;

    line-height: 1.7;
}


.ai-inputs {
    display: flex;

    flex-direction: column;

    gap: 12px;
}


.ai-inputs textarea {
    width: 100%;

    min-height: 120px;

    resize: vertical;

    padding: 14px 16px;

    font-family: inherit;

    font-size: 14px;

    line-height: 1.6;
}


.ai-inputs input {
    width: 100%;

    padding: 13px 16px;
}


.ai-inputs textarea::placeholder,
.ai-inputs input::placeholder {
    color: var(--text-secondary);
}


.ai-inputs .primary-btn {
    align-self: flex-start;
}


/* AI loading/status */

.ai-status {
    min-height: 20px;

    margin-top: 14px;

    color: var(--text-secondary);

    font-size: 13px;
}


/* AI result */

.ai-result {
    margin-top: 20px;

    padding: 20px;

    border: 1px solid var(--border-color);

    border-radius: 14px;

    background: var(--background-color);
}


.ai-result h3 {
    margin-bottom: 14px;

    font-size: 18px;
}


#aiPlan {
    color: var(--text-primary);

    font-size: 14px;

    line-height: 1.8;

    white-space: pre-wrap;

    word-break: break-word;
}


/* =========================================
   FOOTER
========================================= */

footer {
    margin-top: 30px;

    border-top: 1px solid var(--border-color);

    background: var(--card-background);
}


.footer-content {
    max-width: 1100px;

    margin: 0 auto;

    padding: 28px 24px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;
}


.footer-content strong {
    font-size: 15px;
}


.footer-content p {
    margin-top: 4px;

    color: var(--text-secondary);

    font-size: 12px;
}


.footer-small {
    text-align: right;
}


/* =========================================
   RESPONSIVE DESIGN
========================================= */

@media (max-width: 800px) {

    .task-input {
        grid-template-columns: 1fr;
    }


    .two-column {
        grid-template-columns: 1fr;
    }


    .overview-card {
        padding: 22px;
    }


    .hero {
        padding-top: 55px;
    }

}


@media (max-width: 600px) {

    .header-content {
        padding: 12px 16px;
    }


    .brand-icon {
        width: 40px;
        height: 40px;

        font-size: 20px;
    }


    .brand h1 {
        font-size: 18px;
    }


    .brand p {
        font-size: 11px;
    }


    .hero {
        padding: 50px 16px 45px;
    }


    .hero h2 {
        font-size: 42px;

        letter-spacing: -1.5px;
    }


    .hero p {
        font-size: 15px;
    }


    .dashboard {
        padding: 0 16px 45px;
    }


    .overview-card {
        padding: 20px;

        border-radius: 18px;
    }


    .overview-card h2 {
        font-size: 21px;
    }


    .progress-circle {
        width: 76px;
        height: 76px;
    }


    .progress-circle::before {
        width: 58px;
        height: 58px;
    }


    .card {
        padding: 20px;

        margin-top: 18px;
    }


    .task-toolbar {
        align-items: flex-start;

        flex-direction: column;
    }


    .task-filters {
        width: 100%;
    }


    .filter-btn {
        font-size: 11px;
    }


    .timer-buttons {
        flex-direction: column;
    }


    .timer-buttons button {
        width: 100%;
    }


    .notes-footer {
        align-items: stretch;

        flex-direction: column;
    }


    .notes-footer button {
        width: 100%;
    }


    .ai-planner-card {
        margin-top: 18px;
    }


    .ai-inputs .primary-btn {
        width: 100%;
    }


    .ai-result {
        padding: 16px;
    }


    .footer-content {
        align-items: flex-start;

        flex-direction: column;

        padding: 24px 16px;
    }


    .footer-small {
        text-align: left;
    }

}