@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* ================================
   GURU PLANNER
   Persian / RTL / Responsive
================================ */

* {
    box-sizing: border-box;
}

html {
    direction: rtl;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;

    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    background: #f5f6f8;
    color: #222;

    direction: rtl;
    max-width: 100%;
    overflow-x: hidden;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}


/* ================================
   MAIN APP
================================ */

.app {
    width: 100%;
    max-width: 1450px;

    margin: 0 auto;
    padding: 18px;
}


/* ================================
   TOP BAR
================================ */

.topbar {
    background: #fff;

    border-radius: 16px;

    padding: 16px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.topbar h1 {
    margin: 0;

    font-size: 25px;
    font-weight: 700;

    letter-spacing: -0.4px;
}

.subtitle {
    color: #777;

    font-size: 13px;

    margin-top: 5px;
}


/* ================================
   TOP ACTIONS
================================ */

.top-actions {
    display: flex;
    align-items: center;

    gap: 7px;

    flex-wrap: wrap;
}

.top-actions button {
    background: #f0f1f3;
}


/* ================================
   BUTTONS
================================ */

button,
.btn {
    border: 0;

    border-radius: 9px;

    padding: 9px 13px;

    cursor: pointer;

    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 13px;

    line-height: 1.5;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
}

.btn {
    display: inline-block;

    text-decoration: none;
}

.primary {
    background: #222;

    color: #fff;
}

.secondary {
    background: #eef0f4;

    color: #222;
}

.danger {
    background: #fff0f0;

    color: #a22;
}


/* ================================
   WEEK HEADER
================================ */

.week-head {
    margin-top: 12px;

    background: #fff;

    border-radius: 16px;

    padding: 16px 20px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 16px;

    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.week-head strong {
    font-size: 17px;

    font-weight: 600;
}

.week-head span {
    color: #888;

    margin-right: 10px;

    font-size: 13px;
}


/* ================================
   VIEW TOGGLE
================================ */

.view-toggle {
    display: flex;

    background: #f0f1f3;

    padding: 3px;

    border-radius: 10px;
}

.view-toggle button {
    background: transparent;

    color: #666;

    padding: 7px 14px;
}

.view-toggle button.active {
    background: #fff;

    color: #222;

    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
}


/* ================================
   WEEK GRID
================================ */

.planner-grid {
    margin-top: 12px;

    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 12px;
}


/* ================================
   DAY CARD
================================ */

.day-card {
    background: #fff;

    border-radius: 14px;

    min-height: 260px;

    overflow: hidden;

    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.03);
}

.day-head {
    padding: 12px 14px;

    border-bottom: 1px solid #eee;

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 10px;
}

.day-head strong {
    font-weight: 600;
}

.day-head small {
    color: #999;

    font-size: 11px;
}


/* ================================
   TASK
================================ */

.task {
    padding: 9px 12px;

    border-bottom: 1px dashed #ddd;

    display: flex;

    gap: 8px;

    align-items: flex-start;

    cursor: pointer;

    transition:
        background 0.15s ease;
}

.task:hover {
    background: #fafafa;
}

.task .dot {
    width: 16px;
    height: 16px;

    border: 2px solid #999;

    border-radius: 50%;

    flex: none;

    margin-top: 3px;
}

.task.done {
    opacity: 0.45;

    text-decoration: line-through;
}

.task.done .dot {
    background: #555;

    border-color: #555;
}

.task-main {
    flex: 1;

    min-width: 0;

    font-size: 13px;

    line-height: 1.7;
}

.task-time {
    font-size: 11px;

    color: #888;

    margin-top: 1px;
}


/* ================================
   ADD BUTTON
================================ */

.add {
    margin: 10px;

    width: calc(100% - 20px);

    background: #f5f6f8;

    color: #555;
}

.add:hover {
    background: #e9ebef;
}


/* ================================
   EMPTY STATE
================================ */

.empty {
    padding: 20px;

    text-align: center;

    color: #aaa;

    font-size: 12px;
}


/* ================================
   DAY VIEW
================================ */

.day-view {
    display: grid;

    grid-template-columns:
        minmax(220px, 280px)
        minmax(0, 1fr);

    gap: 12px;

    margin-top: 12px;
}

.untimed,
.timeline {
    background: #fff;

    border-radius: 14px;

    padding: 14px;

    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.03);
}

.untimed h3,
.timeline h3 {
    margin-top: 0;

    font-size: 15px;

    font-weight: 600;
}


/* ================================
   TIMELINE
================================ */

.timeline {
    overflow-x: auto;

    overflow-y: hidden;
}

.hour {
    height: 60px;

    border-top: 1px dashed #ddd;

    position: relative;

    color: #999;

    font-size: 11px;

    padding-top: 4px;
}

.event {
    position: absolute;

    right: 55px;
    left: 5px;

    background: #eef2ff;

    border-right: 4px solid #5967d8;

    border-radius: 8px;

    padding: 7px 10px;

    color: #222;

    font-size: 12px;

    min-height: 34px;
}

.event small {
    color: #777;

    margin-right: 5px;
}


/* ================================
   MODAL
================================ */

.modal {
    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.35);

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 15px;

    z-index: 1000;
}

.hidden {
    display: none !important;
}

.modal-card {
    background: #fff;

    border-radius: 16px;

    padding: 22px;

    width: min(500px, 100%);

    max-height: calc(100vh - 30px);

    overflow-y: auto;

    position: relative;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.18);
}

.modal-card h2 {
    margin-top: 0;

    margin-bottom: 20px;

    font-size: 19px;

    font-weight: 600;
}

.modal-close {
    position: absolute;

    left: 12px;
    top: 10px;

    font-size: 24px;

    background: transparent;

    color: #777;

    padding: 2px 8px;
}

.modal-card label {
    display: block;

    margin: 12px 0;

    font-size: 13px;

    color: #555;
}

.modal-card input,
.modal-card textarea,
.modal-card select {
    width: 100%;

    margin-top: 5px;

    padding: 10px;

    border: 1px solid #ddd;

    border-radius: 8px;

    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 13px;

    background: #fff;

    color: #222;

    outline: none;
}

.modal-card input:focus,
.modal-card textarea:focus,
.modal-card select:focus {
    border-color: #999;

    box-shadow:
        0 0 0 3px rgba(0, 0, 0, 0.04);
}

.modal-card textarea {
    resize: vertical;
}

.grid2 {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 10px;
}

.check {
    display: flex !important;

    align-items: center;

    gap: 7px;
}

.check input {
    width: auto !important;

    margin: 0 !important;
}

.modal-actions {
    display: flex;

    gap: 8px;

    margin-top: 15px;
}


/* ================================
   AUTH
================================ */

.auth {
    min-height: 100vh;

    display: grid;

    place-items: center;

    padding: 20px;
}

.auth-card {
    background: #fff;

    padding: 28px;

    border-radius: 16px;

    width: min(420px, 100%);

    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
    margin-top: 0;

    margin-bottom: 5px;

    font-size: 24px;
}

.auth-card p {
    color: #777;

    font-size: 13px;

    margin-bottom: 25px;
}

.auth-card label {
    display: block;

    margin: 14px 0;

    font-size: 13px;
}

.auth-card input {
    width: 100%;

    padding: 11px;

    border: 1px solid #ddd;

    border-radius: 8px;

    margin-top: 5px;

    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 13px;

    outline: none;
}

.auth-card input:focus {
    border-color: #999;
}

.auth-card a {
    display: block;

    text-align: center;

    margin-top: 15px;

    color: #555;

    font-size: 13px;

    text-decoration: none;
}

.full {
    width: 100%;
}

.error {
    background: #fff0f0;

    color: #a22;

    padding: 10px;

    border-radius: 8px;

    font-size: 12px;
}


/* ================================
   RESPONSIVE
================================ */

@media (max-width: 1100px) {

    .planner-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


/* ================================
   TABLET
================================ */

@media (max-width: 900px) {

    .app {
        padding: 12px;
    }

    .topbar {
        padding: 15px;
    }

    .planner-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


/* ================================
   MOBILE
================================ */

@media (max-width: 650px) {

    html,
    body {
        width: 100%;

        max-width: 100%;

        overflow-x: hidden;
    }

    .app {
        width: 100%;

        padding: 8px;
    }

    .topbar,
    .week-head {
        align-items: stretch;

        flex-direction: column;

        padding: 13px;
    }

    .topbar h1 {
        font-size: 21px;
    }

    .subtitle {
        font-size: 12px;
    }

    .top-actions {
        width: 100%;

        display: grid;

        grid-template-columns:
            repeat(3, 1fr);

        gap: 6px;
    }

    .top-actions > * {
        width: 100%;

        text-align: center;
    }

    .week-head {
        gap: 12px;
    }

    .week-head strong {
        font-size: 15px;
    }

    .week-head span {
        display: block;

        margin-right: 0;

        margin-top: 4px;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle button {
        flex: 1;
    }

    .planner-grid {
        display: block;

        margin-top: 8px;
    }

    .day-card {
        margin-bottom: 9px;

        min-height: auto;
    }

    .day-head {
        padding: 11px 12px;
    }

    .task {
        padding: 10px 12px;
    }

    .task-main {
        font-size: 13px;
    }

    .day-view {
        display: block;

        margin-top: 8px;
    }

    .untimed {
        margin-bottom: 9px;
    }

    .timeline {
        width: 100%;

        padding: 12px;
    }

    .grid2 {
        grid-template-columns:
            1fr;
    }

    .modal {
        align-items: flex-end;

        padding: 0;
    }

    .modal-card {
        width: 100%;

        max-height: 92vh;

        border-radius:
            18px 18px 0 0;

        padding: 20px 16px;
    }

    .modal-card h2 {
        font-size: 17px;
    }

}


/* ================================
   SMALL PHONES
================================ */

@media (max-width: 380px) {

    .app {
        padding: 6px;
    }

    .topbar h1 {
        font-size: 19px;
    }

    .top-actions {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .week-head {
        padding: 12px;
    }

    .day-head strong {
        font-size: 13px;
    }

}


/* ================================
   ACCESSIBILITY
================================ */

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #555;

    outline-offset: 2px;
}


/* ================================
   RTL FIXES
================================ */

input,
textarea,
select {
    direction: rtl;

    text-align: right;
}

input[type="time"] {
    direction: ltr;

    text-align: center;
}


/* ================================
   PREVENT HORIZONTAL OVERFLOW
================================ */

img,
svg,
video,
canvas {
    max-width: 100%;
}

table {
    max-width: 100%;
}

button,
input,
textarea,
select {
    max-width: 100%;
}