/* Edusap design kit (es-*): the Study Materials look as reusable pieces.
   Loaded on every page from base.html. Use on rebuilt pages: es-page, es-head, es-btn,
   es-filters, es-chips/es-chip, es-field, es-card, es-table, es-status, es-avatar, es-empty. */

.es-page {
    --es-ink: #1c2340;
    --es-text: #3d4560;
    --es-muted: #6b7590;
    --es-line: #e4e8f0;
    --es-soft: #f6f8fc;
    --es-primary: #317bd9;
    --es-primary-dark: #2264b6;
    --es-tint: #e8f0fd;
    --es-ring: rgba(49, 123, 217, .30);
    color: var(--es-text);
    padding-bottom: 32px;
}

/* ---------- head ---------- */
.es-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 18px;
}
.es-head h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--es-ink);
    letter-spacing: -.01em;
    text-transform: none;
}
.es-sub {
    margin: 4px 0 0;
    color: var(--es-muted);
    font-size: 13px;
}
.es-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* search with icon inside */
.es-search {
    position: relative;
    margin: 0;
}
.es-search .fa {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--es-muted);
    pointer-events: none;
}
.es-search input[type="search"] {
    width: 260px;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--es-line);
    border-radius: 10px;
    background: #fff;
    color: var(--es-ink);
    font-size: 13px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.es-search input[type="search"],
.es-search input[type="search"]::placeholder { text-transform: none; }
.es-search input[type="search"]::placeholder { color: #9aa2b8; }
.es-search input[type="search"]:hover { border-color: #c5cddc; }
.es-search input[type="search"]:focus {
    outline: none;
    border-color: var(--es-primary);
    box-shadow: 0 0 0 3px var(--es-ring);
}

/* buttons */
.es-btn,
a.es-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease, color .15s ease, border-color .15s ease;
}
.es-btn-primary {
    background: var(--es-primary);
    color: #fff;
    border: 1px solid var(--es-primary);
    box-shadow: 0 1px 2px rgba(20, 32, 70, .12);
}
.es-btn-primary:hover {
    background: var(--es-primary-dark);
    border-color: var(--es-primary-dark);
    color: #fff !important;
    box-shadow: 0 6px 14px rgba(49, 123, 217, .28);
}
a.es-btn-ghost,
.es-btn-ghost {
    background: #fff;
    color: var(--es-ink);
    border: 1px solid var(--es-line);
}
a.es-btn-ghost:hover,
.es-btn-ghost:hover {
    background: var(--es-tint);
    border-color: #c9dbf7;
    color: var(--es-primary-dark) !important;
    text-decoration: none;
}
a.es-btn-ghost:focus { text-decoration: none; }
@media (prefers-reduced-motion: no-preference) {
    .es-btn:hover { transform: translateY(-1px); }
    .es-btn:active { transform: translateY(0); }
}

/* ---------- filters ---------- */
.es-filters {
    background: #fff;
    border: 1px solid var(--es-line);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(20, 32, 70, .04);
}
.es-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--es-line);
}
.es-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 14px;
    margin: 0;
    border: 1px solid var(--es-line);
    border-radius: 999px;
    background: var(--es-soft);
    color: var(--es-text);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.es-chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.es-chip:hover {
    background: var(--es-tint);
    border-color: #c9dbf7;
    color: var(--es-primary-dark);
}
.es-chip.is-on {
    background: var(--es-primary);
    border-color: var(--es-primary);
    color: #fff;
}
.es-chip:focus-within {
    box-shadow: 0 0 0 3px var(--es-ring);
}

.es-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}
.es-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    min-width: 190px;
    flex: 0 1 220px;
}
.es-field label {
    margin: 0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--es-muted);
}
.es-field select {
    width: 100%;
    height: 38px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--es-line);
    border-radius: 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%236b7590' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none;
    appearance: none;
    color: var(--es-ink);
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.es-field select:hover { border-color: #c5cddc; }
.es-field select:focus {
    outline: none;
    border-color: var(--es-primary);
    box-shadow: 0 0 0 3px var(--es-ring);
}
.es-field select:disabled {
    background-color: var(--es-soft);
    color: #9aa2b8;
    cursor: not-allowed;
    opacity: 1;
}
.es-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 6px;
    color: var(--es-muted);
    font-weight: 600;
    font-size: 12.5px;
}
.es-clear:hover,
.es-clear:focus {
    color: #d64545;
    text-decoration: none;
}

/* ---------- list card ---------- */
.es-card {
    background: #fff;
    border: 1px solid var(--es-line);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(20, 32, 70, .05), 0 8px 24px rgba(20, 32, 70, .06);
    overflow: hidden;
}
.es-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.es-table thead th {
    padding: 12px 14px;
    background: var(--es-soft);
    border-bottom: 1px solid var(--es-line);
    color: var(--es-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: left;
}
.es-table tbody td {
    padding: 14px;
    border-bottom: 1px solid #eef1f6;
    vertical-align: middle;
    font-size: 13px;
}
.es-table tbody tr:last-child td { border-bottom: none; }
.es-table tbody tr {
    cursor: pointer;
    transition: background-color .12s ease;
}
.es-table tbody tr:hover { background: #f7faff; }
.es-table tbody tr:hover .es-title { color: var(--es-primary); }
.es-table tbody tr:hover .es-open {
    background: var(--es-primary);
    border-color: var(--es-primary);
    color: #fff;
}

/* title cell */
.es-col-title { min-width: 240px; }
.es-title-cell,
.es-title-wrap {
    display: flex;
    gap: 12px;
}
.es-title-cell { align-items: center; }
.es-title-wrap {
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.es-file {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--es-tint);
    color: var(--es-primary);
    font-size: 16px;
}
a.es-title {
    color: var(--es-ink);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    transition: color .12s ease;
}
a.es-title:hover,
a.es-title:focus { text-decoration: none; color: var(--es-primary); }
.es-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.es-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    background: #f0f2f7;
    color: #4f5875;
    font-size: 11.5px;
    font-weight: 600;
}
.es-tag-years {
    background: #eef6f3;
    color: #1f6d58;
}
.es-muted {
    color: var(--es-muted);
    font-size: 12px;
}

/* classes + subject */
.es-pill-class {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 2px 9px;
    border: 1px solid var(--es-line);
    border-radius: 999px;
    background: #fff;
    color: var(--es-text);
    font-size: 12px;
    white-space: nowrap;
}
.es-subject {
    font-weight: 600;
    color: var(--es-ink);
}

/* status pills: icon + word, never colour alone */
.es-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.es-status.is-live { background: #e6f5ee; color: #17704b; }
.es-status.is-scheduled { background: #fdf3e1; color: #8a5a08; }
.es-status.is-draft { background: #f0f2f7; color: #5b6582; }
.es-when {
    display: block;
    margin-top: 4px;
    color: var(--es-muted);
    font-size: 11.5px;
    white-space: nowrap;
}

/* added by */
.es-person {
    display: flex;
    align-items: center;
    gap: 10px;
}
.es-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2d447d;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.es-person-name {
    display: block;
    color: var(--es-ink);
    font-weight: 600;
}
.es-person .es-when { margin-top: 1px; }

/* open button */
.es-col-open {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}
a.es-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--es-line);
    border-radius: 9px;
    color: var(--es-text);
    font-weight: 600;
    font-size: 12.5px;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
a.es-open:hover,
a.es-open:focus { text-decoration: none; }

/* footer + pagination */
.es-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid var(--es-line);
    background: #fcfdfe;
}
.es-foot:empty,
.es-foot:not(:has(*)) { display: none; }
.es-foot .paginated { margin: 0 0 0 auto; }

/* ---------- empty state ---------- */
.es-empty {
    padding: 56px 20px;
    text-align: center;
}
.es-empty-icon {
    display: inline-grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
    border-radius: 18px;
    background: var(--es-tint);
    color: var(--es-primary);
    font-size: 28px;
}
.es-empty h2 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--es-ink);
    text-transform: none;
}
.es-empty p {
    margin: 0 auto 18px;
    max-width: 380px;
    color: var(--es-muted);
}

/* ---------- phone: each row becomes a card ---------- */
@media (max-width: 767px) {
    .es-head { align-items: stretch; }
    .es-head h1 { font-size: 20px; padding-top: 6px; }
    .es-actions { width: 100%; }
    .es-search { flex: 1 1 100%; }
    .es-search input[type="search"] { width: 100%; }
    .es-actions .es-btn { flex: 1 1 0; justify-content: center; }
    .es-field { flex: 1 1 100%; min-width: 0; }
    .es-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 12px; }
    .es-chip { flex: 0 0 auto; }

    .es-card { background: transparent; border: none; box-shadow: none; overflow: visible; }
    .es-table thead { display: none; }
    .es-table,
    .es-table tbody { display: block; }
    .es-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 12px 14px;
        margin-bottom: 12px;
        padding: 14px;
        background: #fff;
        border: 1px solid var(--es-line);
        border-radius: 14px;
        box-shadow: 0 1px 2px rgba(20, 32, 70, .05);
    }
    /* keep the search box's "hide this row" working */
    .es-table tbody tr[style*="none"] { display: none !important; }
    .es-table tbody td {
        display: block;
        padding: 0;
        border: none;
        min-width: 0;
    }
    .es-table tbody td[data-label]:not(.es-col-title)::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--es-muted);
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
    }
    .es-table tbody td.es-col-title,
    .es-table tbody td.es-col-open { grid-column: 1 / -1; }
    .es-col-title { min-width: 0; }
    .es-col-open { width: auto; text-align: left; }
    a.es-open { width: 100%; justify-content: center; }
    .es-when { white-space: normal; }
    .es-foot { border: none; background: transparent; padding: 4px 0; }
}

@media print {
    .es-actions,
    .es-filters,
    .es-col-open { display: none !important; }
    .es-card { box-shadow: none; }
}
