@font-face {
    font-family: "Vazir";
    src: url("../../public/fonts/Vazir-Regular.woff2") format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "Cinema";
    src: url("../../public/fonts/Cinema Full.ttf") format("truetype");
    font-display: swap;
}

:root {
    color-scheme: dark;
    --ink: #28303f;
    --muted: #727887;
    --page: #1b1a23;
    --surface: #ffffff;
    --soft: #f6f6f8;
    --line: #e9e9ef;
    --purple: #6d5bd0;
    --green: #24a865;
    --green-soft: #e9f8f0;
    --orange: #e78a28;
    --orange-soft: #fff3e6;
    --red: #d9545d;
    --red-soft: #fdecee;
    --shadow: 0 24px 70px rgba(9, 8, 14, 0.24);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% 8%, rgba(109, 91, 208, 0.2), transparent 24rem),
        var(--page);
    color: var(--ink);
    font-family: "Vazir", Tahoma, sans-serif;
}

button,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

svg {
    width: 1.5rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.changes-app {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
}

.topbar {
    min-height: 78px;
    padding: 14px 22px;
    border-radius: 30px 30px 12px 12px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: var(--shadow);
}

.brand,
.topbar__actions,
.back-link,
.live-badge {
    display: flex;
    align-items: center;
}

.brand {
    gap: 12px;
}

.brand__mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: #fff;
    font: 30px/1 "Cinema", sans-serif;
    box-shadow: 0 8px 20px rgba(40, 48, 63, 0.2);
}

.brand__text {
    display: grid;
    gap: 2px;
}

.brand__text strong {
    font: 27px/1 "Cinema", "Vazir", sans-serif;
}

.brand__text small {
    color: var(--muted);
    font-size: 11px;
}

.topbar__actions {
    gap: 12px;
}

.live-badge {
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--green-soft);
    color: #187a4a;
    font-size: 13px;
}

.live-badge__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(36, 168, 101, 0.13);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    50% { box-shadow: 0 0 0 8px rgba(36, 168, 101, 0); }
}

.back-link {
    gap: 7px;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    transition: transform 180ms ease, background 180ms ease;
}

.back-link:hover {
    transform: translateY(-2px);
    background: #3b4557;
}

.back-link svg {
    width: 18px;
}

main {
    margin-top: 10px;
}

.hero {
    min-height: 230px;
    padding: 42px 52px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(118deg, rgba(40, 48, 63, 0.98), rgba(55, 51, 77, 0.96)),
        var(--ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 18px 18px;
    mask-image: linear-gradient(to left, #000, transparent 65%);
}

.hero > div:first-child {
    position: relative;
    z-index: 1;
    max-width: 620px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #bfb6ff;
    font-size: 13px;
}

.hero h1 {
    margin: 0;
    font: 48px/1.25 "Cinema", "Vazir", sans-serif;
    letter-spacing: -0.03em;
}

.hero__description {
    max-width: 560px;
    margin: 16px 0 0;
    color: #d7d9df;
    font-size: 15px;
    line-height: 2;
}

.hero__visual {
    width: 180px;
    height: 150px;
    position: relative;
    display: grid;
    place-items: center;
}

.hero__visual svg {
    width: 62px;
    color: #fff;
    position: relative;
    z-index: 2;
}

.hero__ring {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.19);
    border-radius: 50%;
}

.hero__ring--one {
    width: 120px;
    height: 120px;
    background: rgba(109, 91, 208, 0.25);
}

.hero__ring--two {
    width: 180px;
    height: 180px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 12px 0;
}

.stat-card {
    min-height: 104px;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-card__icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.stat-card__icon svg {
    width: 23px;
}

.stat-card--all .stat-card__icon {
    color: var(--purple);
    background: #efecff;
}

.stat-card--added .stat-card__icon {
    color: var(--green);
    background: var(--green-soft);
}

.stat-card--updated .stat-card__icon {
    color: var(--orange);
    background: var(--orange-soft);
}

.stat-card--removed .stat-card__icon {
    color: var(--red);
    background: var(--red-soft);
}

.stat-card div {
    display: grid;
    gap: 3px;
}

.stat-card strong {
    font-size: 25px;
    line-height: 1.2;
}

.stat-card div span {
    color: var(--muted);
    font-size: 12px;
}

.changes-card {
    min-height: 370px;
    padding: 28px;
    border-radius: 18px 18px 30px 30px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.changes-card__header {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 22px;
    padding-bottom: 24px;
}

.changes-card h2 {
    margin: 0;
    font: 30px/1.2 "Cinema", "Vazir", sans-serif;
}

#last-updated {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.changes-filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.day-picker,
.department-picker,
.all-days-filter,
.search-filter {
    min-width: 250px;
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    position: relative;
}

.all-days-filter {
    min-width: 145px;
}

.search-filter {
    min-width: 275px;
    flex: 1;
}

.search-filter__field {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #dedee6;
    border-radius: 13px;
    background: #fff;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 9px;
}

.search-filter__field svg {
    width: 20px;
    color: var(--purple);
    flex: 0 0 auto;
}

.search-filter input {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
}

.search-filter input::placeholder {
    color: #a1a4ad;
}

.search-filter input:disabled {
    cursor: wait;
}

.all-days-toggle {
    height: 46px;
    padding: 0 14px;
    border: 1px solid #dedee6;
    border-radius: 13px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 11px;
}

.all-days-toggle__track {
    width: 38px;
    height: 22px;
    padding: 3px;
    border-radius: 999px;
    background: #d5d6dc;
    display: flex;
    justify-content: flex-start;
    transition: background 180ms ease;
}

.all-days-toggle__thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(20, 19, 28, 0.2);
    transition: transform 180ms ease;
}

.all-days-toggle[aria-checked="true"] {
    border-color: rgba(109, 91, 208, 0.45);
    background: #f7f5ff;
    color: var(--purple);
}

.all-days-toggle[aria-checked="true"] .all-days-toggle__track {
    background: var(--purple);
}

.all-days-toggle[aria-checked="true"] .all-days-toggle__thumb {
    transform: translateX(-16px);
}

.all-days-toggle:disabled {
    cursor: wait;
    opacity: 0.6;
}

.day-picker__field,
.department-picker__field {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #dedee6;
    border-radius: 13px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    position: relative;
    text-align: right;
    cursor: pointer;
}

.day-picker__field > svg:first-child,
.department-picker__field > svg:first-child {
    width: 20px;
    color: var(--purple);
}

.day-picker__field > span {
    flex: 1;
}

.day-picker__field:disabled {
    cursor: wait;
    color: var(--muted);
    background: #fafafd;
}

.department-picker__field {
    padding: 0 14px;
}

.department-picker select {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    appearance: none;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.department-picker select:disabled {
    cursor: wait;
    color: var(--muted);
}

.department-picker__chevron {
    width: 17px;
    pointer-events: none;
}

.day-picker__chevron {
    width: 17px;
    transition: transform 180ms ease;
}

.day-picker__field[aria-expanded="true"] .day-picker__chevron {
    transform: rotate(180deg);
}

.shamsi-calendar {
    width: 310px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 16px;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 50;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 18px 50px rgba(19, 17, 29, 0.2);
}

.shamsi-calendar[hidden] {
    display: none;
}

.shamsi-calendar__header {
    min-height: 38px;
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
}

.shamsi-calendar__header strong {
    text-align: center;
    font-size: 14px;
}

.shamsi-calendar__header button {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--soft);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.shamsi-calendar__header button:hover {
    background: #ece9ff;
    color: var(--purple);
}

.shamsi-calendar__header svg {
    width: 17px;
}

.shamsi-calendar__weekdays,
.shamsi-calendar__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.shamsi-calendar__weekdays {
    margin: 10px 0 5px;
    color: #969aa5;
    text-align: center;
    font-size: 11px;
}

.shamsi-calendar__weekdays span {
    padding: 6px 0;
}

.shamsi-calendar__days {
    gap: 3px;
    direction: rtl;
}

.calendar-day,
.calendar-day-spacer {
    aspect-ratio: 1;
}

.calendar-day {
    border: 0;
    border-radius: 10px;
    position: relative;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 12px;
}

.calendar-day:hover {
    background: #efecff;
    color: var(--purple);
}

.calendar-day.has-events::after {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
    background: var(--orange);
}

.calendar-day.is-selected {
    background: var(--purple);
    color: #fff;
    box-shadow: 0 7px 15px rgba(109, 91, 208, 0.26);
}

.calendar-day.is-selected::after {
    background: #fff;
}

.calendar-day.is-today:not(.is-selected) {
    box-shadow: inset 0 0 0 1px var(--purple);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 15px;
}

.changes-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    text-align: right;
}

.changes-table th {
    padding: 14px 18px;
    background: var(--soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: normal;
    white-space: nowrap;
}

.changes-table td {
    padding: 17px 18px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    vertical-align: middle;
}

.event-row {
    transition: background 160ms ease;
}

.event-row:hover,
.event-row.is-open {
    background: #fbfbfd;
}

.event-row__time {
    color: var(--muted);
    white-space: nowrap;
}

.event-row__code {
    direction: ltr;
    text-align: right;
    font-family: Tahoma, sans-serif;
    color: #5d6472;
    white-space: nowrap;
}

.event-row__course {
    max-width: 280px;
    font-weight: bold;
}

.event-row__department {
    color: var(--muted);
    white-space: nowrap;
}

.event-row__professor {
    max-width: 210px;
    color: #555c69;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
}

.type-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.type-badge--added {
    color: #187a4a;
    background: var(--green-soft);
}

.type-badge--added::before {
    background: var(--green);
}

.type-badge--updated {
    color: #9a5715;
    background: var(--orange-soft);
}

.type-badge--updated::before {
    background: var(--orange);
}

.type-badge--removed {
    color: #a7353f;
    background: var(--red-soft);
}

.type-badge--removed::before {
    background: var(--red);
}

.details-button {
    width: 36px;
    height: 36px;
    border: 1px solid #dedee6;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 180ms ease, border-color 180ms ease;
}

.details-button:hover {
    border-color: var(--purple);
}

.details-button svg {
    width: 17px;
    transition: transform 180ms ease;
}

.event-row.is-open .details-button svg {
    transform: rotate(180deg);
}

.detail-row[hidden] {
    display: none;
}

.detail-row td {
    padding: 0;
    background: #f8f8fb;
}

.change-list {
    padding: 20px 22px;
    display: grid;
    gap: 10px;
}

.change-item {
    padding: 13px 15px;
    border: 1px solid #e3e3eb;
    border-radius: 12px;
    background: #fff;
    display: grid;
    grid-template-columns: minmax(100px, 0.55fr) 1fr 26px 1fr;
    align-items: center;
    gap: 12px;
}

.change-item__label {
    color: var(--ink);
    font-size: 12px;
    font-weight: bold;
}

.change-item__value {
    min-height: 38px;
    padding: 9px 11px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    line-height: 1.8;
    word-break: break-word;
}

.change-item__value--old {
    background: var(--red-soft);
    color: #95333b;
}

.change-item__value--new {
    background: var(--green-soft);
    color: #176c43;
}

.change-item__arrow {
    color: var(--muted);
    text-align: center;
}

.change-item__empty {
    opacity: 0.55;
}

.status-message {
    min-height: 230px;
    padding: 40px 20px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 15px;
    color: var(--muted);
    text-align: center;
}

.status-message[hidden] {
    display: none;
}

.status-message p {
    margin: 0;
}

.status-message strong {
    color: var(--ink);
    font-size: 17px;
}

.status-message--error {
    color: var(--red);
}

.loader {
    width: 34px;
    height: 34px;
    border: 3px solid #e6e4f0;
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 750ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

footer {
    padding: 19px 28px;
    color: #aaa8b3;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 12px;
}

footer a {
    color: #d5cffb;
}

.noscript {
    margin: 20px;
    padding: 18px;
    border-radius: 12px;
    background: var(--red-soft);
    color: var(--red);
    text-align: center;
}

@media (max-width: 900px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .changes-card__header {
        align-items: stretch;
        flex-direction: column;
    }

    .changes-filters > * {
        flex: 1;
    }

    .hero {
        padding: 36px;
    }

    .hero__visual {
        width: 130px;
    }
}

@media (max-width: 640px) {
    .changes-app {
        width: min(100% - 18px, 1180px);
        margin: 10px auto;
    }

    .topbar {
        padding: 12px 14px;
        border-radius: 20px 20px 10px 10px;
    }

    .brand__text small,
    .live-badge {
        display: none;
    }

    .back-link {
        padding: 10px;
    }

    .back-link svg {
        display: none;
    }

    .hero {
        min-height: 220px;
        padding: 30px 24px;
    }

    .hero h1 {
        font-size: 40px;
    }

    .hero__description {
        font-size: 13px;
    }

    .hero__visual {
        display: none;
    }

    .stats {
        gap: 8px;
    }

    .stat-card {
        min-height: 92px;
        padding: 13px;
        gap: 10px;
    }

    .stat-card__icon {
        width: 39px;
        height: 39px;
    }

    .stat-card strong {
        font-size: 21px;
    }

    .changes-card {
        padding: 20px 14px;
        border-radius: 14px 14px 24px 24px;
    }

    .changes-card__header {
        align-items: stretch;
        flex-direction: column;
    }

    .changes-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .day-picker,
    .department-picker,
    .all-days-filter,
    .search-filter {
        min-width: 0;
    }

    footer {
        align-items: center;
        flex-direction: column;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
