/* Shared icon font */
.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 1.25em;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'liga';
}
.btn .material-symbols-rounded {
    font-size: 1.1rem;
    vertical-align: -0.18em;
}
.badge .material-symbols-rounded,
.empty-icon.material-symbols-rounded,
.stat-icon.material-symbols-rounded {
    vertical-align: -0.16em;
}

.icon-students { color: #2563eb; }
.icon-study { color: #7c3aed; }
.icon-success { color: var(--ea-success); }
.icon-money { color: #059669; }
.icon-docs { color: #0ea5e9; }
.icon-orders { color: #d97706; }
.icon-warning { color: var(--ea-warning); }
.icon-info { color: var(--ea-info); }
.icon-danger { color: var(--ea-error); }

.portal-lang {
    display: flex;
    gap: 4px;
    align-items: center;
}
.portal-lang a {
    color: var(--ea-primary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 999px;
    text-decoration: none;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition);
    border: 1px solid transparent;
}
.portal-lang a:hover {
    color: var(--ea-primary);
    background: rgba(255,210,0,.22);
}
.portal-lang a.active {
    color: var(--ea-primary);
    background: var(--ea-yellow);
    border-color: rgba(11,30,73,.12);
}

/* ============================================================
   European Academy — Design System
   Based on school-web.html design language
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────── */

:root {
    --ea-primary:     #0b1e49;
    --ea-primary-600: #12336f;
    --ea-primary-700: #091535;
    --ea-accent:      #1e3a8a;
    --ea-yellow:      #ffd200;
    --ea-yellow-600:  #e6bf00;
    --ea-yellow-700:  #ccaa00;

    --ea-bg:          #f3f6fb;
    --ea-white:       #ffffff;
    --ea-text:        #0e1a2b;
    --ea-text-light:  #374151;
    --ea-muted:       #6b7280;
    --ea-border:      #e5e7eb;
    --ea-border-dark: #d1d5db;

    --ea-success:     #168f45;
    --ea-success-bg:  #ecfdf5;
    --ea-error:       #b91c1c;
    --ea-error-bg:    #fef2f2;
    --ea-warning:     #d97706;
    --ea-warning-bg:  #fffbeb;
    --ea-info:        #0369a1;
    --ea-info-bg:     #eff6ff;

    --radius:         16px;
    --radius-sm:      10px;
    --radius-xs:      6px;
    --shadow:         0 4px 16px rgba(11,30,73,.07);
    --shadow-lg:      0 10px 30px rgba(11,30,73,.10);
    --shadow-sm:      0 2px 8px rgba(11,30,73,.05);
    --transition:     .2s ease;

    --font-sans:      'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:      'Cascadia Code', 'Fira Code', monospace;
}

/* ── Reset & Base ───────────────────────────────────────── */

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

/* ── Skip Link (Accessibility) ──────────────────────────── */

.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 10px 20px;
    background: var(--ea-yellow);
    color: var(--ea-primary);
    font-weight: 700;
    border-radius: var(--radius-xs);
    text-decoration: none;
}
.skip-link:focus {
    top: 8px;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ea-text);
    background: var(--ea-bg);
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
}

.admin-main,
.portal-main {
    opacity: 1;
    transition: opacity .18s ease;
    will-change: opacity;
}

.i18n-blur-target {
    display: inline;
    filter: blur(0);
    transition: filter .16s ease;
    will-change: filter;
}

.i18n-blur-target.i18n-blur-sized {
    display: inline-block;
    max-width: 100%;
    overflow: visible;
    transition: filter .16s ease, width .18s ease;
    vertical-align: baseline;
    white-space: nowrap;
}

.i18n-blur-target.i18n-blur-active {
    filter: blur(6px);
}

body.shell-transition-out .admin-main,
body.shell-transition-out .portal-main {
    opacity: 0;
}

html.shell-arriving .admin-main,
html.shell-arriving .portal-main {
    opacity: 0;
}

html.shell-arriving body.shell-transition-ready .admin-main,
html.shell-arriving body.shell-transition-ready .portal-main {
    opacity: 1;
}

html.auth-arriving body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: #fff;
    pointer-events: none;
    animation: appAuthWhiteReveal .42s ease forwards;
}

.auth-arrival-transition {
    position: fixed;
    inset: 0;
    z-index: 2147483001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

html.auth-arriving .auth-arrival-transition {
    visibility: visible;
    animation: appAuthLoaderExit .46s ease forwards;
}

html.auth-arriving body:not(.auth-body) > :not(.auth-arrival-transition) {
    animation: appAuthContentQuickIn .34s ease .1s both;
}

.auth-transition-logo {
    width: clamp(72px, 14vw, 104px);
    height: auto;
    display: block;
    filter: drop-shadow(0 12px 18px rgba(11, 30, 73, .12));
}

.auth-transition-logo-shield,
.auth-transition-logo-chevron,
.auth-transition-logo-bar {
    fill: var(--ea-yellow);
    fill-rule: nonzero;
}

.auth-transition-logo-bar {
    transform-box: fill-box;
    transform-origin: center;
    animation: appAuthLogoBarLoop 1.56s cubic-bezier(.55, .02, .2, 1) infinite;
}

.auth-transition-logo-bar-2 { animation-delay: .26s; }
.auth-transition-logo-bar-3 { animation-delay: .52s; }

@keyframes appAuthWhiteReveal {
    0%, 18% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes appAuthLoaderExit {
    0%, 28% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes appAuthContentQuickIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes appAuthLogoBarLoop {
    0%, 12% { opacity: 1; transform: translateX(0) scaleX(1); }
    34% { opacity: 0; transform: translateX(-24px) scaleX(.12); }
    58% { opacity: 0; transform: translateX(24px) scaleX(.12); }
    82%, 100% { opacity: 1; transform: translateX(0) scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
    html.auth-arriving body::before {
        animation-duration: .01ms;
    }

    html.auth-arriving .auth-arrival-transition,
    html.auth-arriving body:not(.auth-body) > :not(.auth-arrival-transition),
    .auth-transition-logo-bar {
        animation: none;
    }

    .admin-main,
    .portal-main,
    body.shell-transition-out .admin-main,
    body.shell-transition-out .portal-main,
    html.shell-arriving .admin-main,
    html.shell-arriving .portal-main,
    html.shell-arriving body.shell-transition-ready .admin-main,
    html.shell-arriving body.shell-transition-ready .portal-main {
        transition: none;
        transform: none;
        opacity: 1;
    }

    .i18n-blur-target,
    .i18n-blur-target.i18n-blur-active {
        transition: none;
        filter: none;
    }

    .i18n-blur-target.i18n-blur-sized {
        transition: none;
        width: auto !important;
    }
}

a {
    color: var(--ea-accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--ea-primary); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--ea-primary);
}

h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.6rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.3rem); }
h4 { font-size: 1.1rem; }

/* ── Utility ────────────────────────────────────────────── */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--ea-muted); }
.text-success { color: var(--ea-success); }
.text-error   { color: var(--ea-error); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.font-bold    { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

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

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.hidden { display: none !important; }

/* ── Card ───────────────────────────────────────────────── */

.card {
    background: var(--ea-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    transition: box-shadow var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-lg);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ea-border);
}
.card-header h2, .card-header h3 {
    margin: 0;
}
.card-body {
    padding: 0;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:focus-visible {
    outline: 3px solid var(--ea-yellow);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--ea-yellow);
    color: var(--ea-primary);
    border-color: var(--ea-yellow);
}
.btn-primary:hover {
    background: var(--ea-yellow-600);
    border-color: var(--ea-yellow-600);
    color: var(--ea-primary);
}

.btn-secondary {
    background: var(--ea-primary);
    color: #fff;
    border-color: var(--ea-primary);
}
.btn-secondary:hover {
    background: var(--ea-primary-600);
    border-color: var(--ea-primary-600);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--ea-primary);
    border-color: var(--ea-primary);
}
.btn-outline:hover {
    background: var(--ea-primary);
    color: #fff;
}

.btn-danger {
    background: var(--ea-error);
    color: #fff;
    border-color: var(--ea-error);
}
.btn-danger:hover {
    background: #991b1b;
    border-color: #991b1b;
    color: #fff;
}

.btn-success {
    background: var(--ea-success);
    color: #fff;
    border-color: var(--ea-success);
}

.btn-success:hover {
    background: #12743a;
    border-color: #12743a;
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-xs);
}
.btn-xs {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: var(--radius-xs);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Forms ──────────────────────────────────────────────── */

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ea-text);
    margin-bottom: 6px;
}
.form-group .hint {
    font-size: 0.8rem;
    color: var(--ea-muted);
    margin-top: 4px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: var(--ea-text);
    background: var(--ea-white);
    border: 1.5px solid var(--ea-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--ea-accent);
    box-shadow: 0 0 0 3px rgba(30,58,138,.12);
}
.form-control::placeholder {
    color: var(--ea-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--ea-accent);
    cursor: pointer;
}
.form-check label {
    font-weight: 400;
    margin-bottom: 0;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.form-error {
    font-size: 0.8rem;
    color: var(--ea-error);
    margin-top: 4px;
}

/* ── Tables ─────────────────────────────────────────────── */

.table-wrap,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table.table th {
    background: var(--ea-primary);
    color: #fff;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    white-space: nowrap;
    vertical-align: middle;
}

table.table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}
table.table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

table.table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--ea-border);
    vertical-align: middle;
}

table.table tbody tr:hover {
    background: rgba(30,58,138,.03);
}

table.table tbody tr:last-child td {
    border-bottom: none;
}

table.table .actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* ── Badges ─────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    line-height: 1.4;
}
.badge-success { background: var(--ea-success-bg); color: var(--ea-success); }
.badge-error   { background: var(--ea-error-bg);   color: var(--ea-error); }
.badge-warning { background: var(--ea-warning-bg); color: var(--ea-warning); }
.badge-info    { background: var(--ea-info-bg);    color: var(--ea-info); }
.badge-neutral { background: #f3f4f6; color: var(--ea-muted); }
.badge-primary { background: rgba(30,58,138,.1); color: var(--ea-accent); }
.badge-danger  { background: var(--ea-error-bg);   color: var(--ea-error); }
.badge-muted   { background: #f3f4f6; color: var(--ea-muted); }

/* ── Action Menus ───────────────────────────────────────── */

.action-menu-wrap {
    position: relative;
    display: inline-block;
}
.action-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--ea-white);
    border: 1px solid var(--ea-border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--ea-primary);
}
.action-menu-btn:hover,
.action-menu-btn.is-open {
    background: var(--ea-bg);
    border-color: var(--ea-primary);
}
.action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 170px;
    padding: 4px 0;
    background: var(--ea-white);
    border: 1px solid var(--ea-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
}
.action-menu.open { display: block; z-index: 10000; }
.action-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    color: var(--ea-text);
    font: inherit;
    font-size: .9rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.action-menu-item:hover { background: var(--ea-bg); }
.action-menu-item.danger { color: var(--ea-error); }
.action-menu-item.success { color: var(--ea-success); }
.action-menu-item-muted { color: var(--ea-muted); cursor: default; }
.action-menu-form { margin: 0; }

/* ── Confirm Modal ──────────────────────────────────────── */

.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.confirm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.confirm-modal-dialog {
    background: var(--ea-white);
    border-radius: 14px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
    text-align: center;
    transform: scale(.95);
    transition: transform .2s;
}
.confirm-modal-overlay.active .confirm-modal-dialog { transform: scale(1); }
.confirm-modal-icon {
    font-size: 2.4rem;
    color: var(--ea-warning);
    margin-bottom: .5rem;
}
.confirm-modal-dialog h3 {
    margin: 0 0 .5rem;
    font-size: 1.1rem;
    color: var(--ea-primary);
}
.confirm-modal-dialog p {
    margin: 0 0 1.5rem;
    color: var(--ea-muted);
    font-size: .95rem;
}
.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Alerts ─────────────────────────────────────────────── */

.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    line-height: 1.55;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: var(--ea-success-bg); color: var(--ea-success); border-left: 4px solid var(--ea-success); }
.alert-error,
.alert-danger  { background: var(--ea-error-bg);   color: var(--ea-error);   border-left: 4px solid var(--ea-error); }
.alert-warning { background: var(--ea-warning-bg); color: var(--ea-warning); border-left: 4px solid var(--ea-warning); }
.alert-info    { background: var(--ea-info-bg);    color: var(--ea-info);    border-left: 4px solid var(--ea-info); }

/* ── Toast notifications ───────────────────────────────── */
.ea-toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.ea-toast {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    border: 1px solid rgba(11, 30, 73, .12);
    border-left: 4px solid var(--ea-primary, #0b1e49);
    border-radius: 10px;
    background: #fff;
    color: var(--ea-text, #0f172a);
    box-shadow: 0 18px 45px rgba(11, 30, 73, .18);
    text-decoration: none;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px) scale(.98);
    transition: opacity .2s ease, transform .2s ease;
}

.ea-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ea-toast.is-removing {
    opacity: 0;
    transform: translateY(8px) scale(.98);
}

.ea-toast-icon {
    color: var(--ea-primary, #0b1e49);
    font-size: 24px;
}

.ea-toast-body {
    min-width: 0;
}

.ea-toast-body strong,
.ea-toast-body small {
    display: block;
}

.ea-toast-body strong {
    font-size: .92rem;
    line-height: 1.25;
}

.ea-toast-body small {
    margin-top: 2px;
    color: var(--ea-muted, #64748b);
    font-size: .8rem;
    line-height: 1.35;
}

.ea-toast-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ea-muted, #64748b);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.ea-toast-close:hover {
    background: rgba(15, 23, 42, .08);
    color: var(--ea-text, #0f172a);
}

/* ── Stat Cards ─────────────────────────────────────────── */

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

.stat-card {
    background: var(--ea-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card[href],
a.stat-card {
    display: block;
    color: inherit;
    text-decoration: none;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--ea-primary);
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--ea-muted);
    margin-top: 6px;
}
.stat-card .stat-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

/* ── Book Cards ─────────────────────────────────────────── */

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.book-card {
    background: var(--ea-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}
.book-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.book-card .book-cover {
    width: 100%;
    height: 340px;
    background: var(--ea-border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.book-card .book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.book-card .book-cover-placeholder {
    font-size: 3rem;
    color: var(--ea-muted);
}

.book-card .book-info {
    padding: 14px 16px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.book-card .book-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ea-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 4px;
    line-height: 1.3;
}
.book-card .book-subtitle {
    font-size: 0.8rem;
    color: var(--ea-muted);
    margin: 0 0 4px;
}
.book-card .book-author {
    font-size: 0.8rem;
    color: var(--ea-muted);
    margin: 0 0 8px;
}
.book-card .book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: auto;
    font-size: 0.78rem;
    color: var(--ea-muted);
}
.book-card .book-actions {
    padding: 0 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}
.book-card .book-actions .btn {
    flex: 0 0 auto;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    white-space: normal;
}

.dashboard-section-title-spaced {
    margin-top: 40px;
}

.book-card-cta {
    text-decoration: none;
    border: 2px dashed rgba(11,30,73,.16);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.book-card-cta .book-title,
.book-card-cta .book-subtitle {
    text-align: center;
}

.book-card-cta .book-cover-cta {
    background: linear-gradient(135deg, rgba(30,58,138,.08) 0%, rgba(255,210,0,.16) 100%);
}

.book-card-cta .book-cover-placeholder {
    font-size: 4rem;
}

.book-card-cta .book-actions {
    padding-top: 0;
}

.book-card .book-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.book-card .book-footer {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
    .book-card .book-cover {
        height: 220px;
    }
    .book-card .book-info {
        padding: 10px 10px 6px;
    }
    .book-card .book-title {
        font-size: 0.82rem;
    }
    .book-card .book-author,
    .book-card .book-subtitle {
        font-size: 0.72rem;
    }
    .book-card .book-actions {
        padding: 0 10px 10px;
        gap: 6px;
    }
    .book-card .book-actions .btn {
        font-size: 0.72rem;
        padding: 6px 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
@media (max-width: 400px) {
    .books-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .book-card .book-cover {
        height: 260px;
    }
    .book-card .book-actions {
        flex-direction: column;
    }
}

/* ── Pagination ─────────────────────────────────────────── */

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
    list-style: none;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.85rem;
    color: var(--ea-text);
    background: var(--ea-white);
    border: 1px solid var(--ea-border);
    border-radius: var(--radius-xs);
    text-decoration: none;
    transition: all var(--transition);
}
.pagination a:hover {
    background: var(--ea-primary);
    color: #fff;
    border-color: var(--ea-primary);
}
.pagination .active span {
    background: var(--ea-primary);
    color: #fff;
    border-color: var(--ea-primary);
}
.pagination .disabled span {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Search Box ─────────────────────────────────────────── */

.search-box {
    position: relative;
    max-width: 400px;
    margin-bottom: 24px;
}
.search-box input {
    padding-left: 40px;
}
.search-box::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    pointer-events: none;
}

/* ── Filter Bar ─────────────────────────────────────────── */

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.filter-bar select {
    max-width: 220px;
}
.form-control-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}
.form-control-static {
    padding: 10px 0;
    font-size: 0.95rem;
}
.inline-form {
    display: inline;
}
.view-all-btn {
    margin-left: auto;
}
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mt-lg { margin-top: 1.5rem; }
.duration-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
}
.duration-field {
    width: 70px;
}

/* ── Empty State ────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--ea-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-state p {
    font-size: 1rem;
    margin-bottom: 16px;
}

/* ── Progress ───────────────────────────────────────────── */

.progress-bar {
    height: 8px;
    background: var(--ea-border);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar .progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.progress-bar .progress-fill.success { background: var(--ea-success); }
.progress-bar .progress-fill.warning { background: var(--ea-warning); }
.progress-bar .progress-fill.error   { background: var(--ea-error); }
.progress-bar .progress-fill.primary { background: var(--ea-accent); }

/* ── Breadcrumb ─────────────────────────────────────────── */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    font-size: 0.85rem;
    margin-bottom: 20px;
}
.breadcrumb li + li::before {
    content: '›';
    margin-right: 6px;
    color: var(--ea-muted);
}
.breadcrumb li a {
    color: var(--ea-muted);
}
.breadcrumb li a:hover {
    color: var(--ea-primary);
}
.breadcrumb li.active {
    color: var(--ea-text);
    font-weight: 600;
}
.breadcrumb-sep {
    color: var(--ea-muted);
    margin: 0 6px;
    font-size: 0.85rem;
}

/* ── Tooltips ───────────────────────────────────────────── */

[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 6px 10px;
    font-size: 0.75rem;
    color: #fff;
    background: var(--ea-primary-700);
    border-radius: var(--radius-xs);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    z-index: 100;
}
[data-tooltip]:hover::after {
    opacity: 1;
}

/* ── Modal ──────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11,30,73,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal {
    background: var(--ea-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 560px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform var(--transition);
}
.modal-overlay.active .modal {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ea-border);
}
.modal-header h3 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--ea-muted);
    padding: 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--ea-text); }
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--ea-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Programs Grid ───────────────────────────────────────── */

.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}
.program-card {
    display: flex;
    flex-direction: column;
}
.program-card-locked {
    border-color: #facc15;
    background: #fffbeb;
}
.program-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.program-card-header .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.program-card-header .material-symbols-rounded {
    font-size: 16px;
}
.locked-program-notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    margin: 12px 0;
    border: 1px solid #facc15;
    border-radius: 8px;
    background: #fff7d6;
    color: #713f12;
}
.locked-program-notice .material-symbols-rounded {
    font-size: 22px;
    color: #a16207;
}
.locked-program-notice p {
    margin: 4px 0;
}
.locked-program-notice small {
    display: block;
    color: #854d0e;
}
.price-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ea-primary);
}
.price-period {
    font-size: 0.85rem;
    color: var(--ea-muted);
    font-weight: 400;
}

/* ── Orders Catalog Cards ───────────────────────────────── */

.orders-page .orders-catalog-tools {
    margin-bottom: 18px;
}

.orders-page .orders-catalog-controls {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(120px, 1fr)) auto;
    gap: 10px;
    align-items: center;
}

.orders-page .orders-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.orders-page .orders-filter-search {
    min-width: 220px;
}

.orders-page .orders-filter-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ea-muted);
    font-weight: 700;
}

.orders-page .orders-filter-actions .btn {
    height: 42px;
}

.orders-page .orders-catalog-results {
    margin-top: 10px;
    color: var(--ea-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.orders-page .orders-no-results {
    margin-top: 8px;
}

.orders-page .orders-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.orders-page .order-catalog-card {
    display: flex;
    flex-direction: column;
    height: auto;
    border: 1px solid var(--ea-border);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.orders-page .order-catalog-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.orders-page .order-catalog-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.orders-page .order-catalog-no {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--ea-border);
    background: var(--ea-bg-alt);
    color: var(--ea-primary);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.orders-page .order-catalog-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.orders-page .order-catalog-name {
    font-size: 1.02rem;
    line-height: 1.35;
    margin: 0 0 14px;
    min-height: 54px;
}

.orders-page .order-catalog-details {
    position: relative;
    overflow: visible;
    max-height: none;
    padding-right: 2px;
}

.orders-page .order-detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 12px;
    align-items: start;
    margin-bottom: 10px;
}

.orders-page .order-detail-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ea-muted);
    font-weight: 700;
}

.orders-page .order-detail-value {
    font-size: 0.9rem;
    color: var(--ea-text);
    line-height: 1.45;
}

.orders-page .order-catalog-price {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--ea-border);
}

.orders-page .order-catalog-price-eur {
    margin-top: 4px;
    color: var(--ea-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.orders-page .order-card-actions {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

/* ── Payment Grid ───────────────────────────────────────── */

.payment-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}
.payment-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--ea-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}
.payment-total-label {
    font-size: 0.95rem;
    font-weight: 600;
}
.payment-total-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

/* ── Upload Form Grid ───────────────────────────────────── */

.upload-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

/* ── Drag Over ──────────────────────────────────────────── */

.drag-over {
    border-color: var(--ea-accent) !important;
    background: rgba(30,58,138,.04) !important;
}

/* ── Section ────────────────────────────────────────────── */

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ea-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .card { padding: 20px; }
    .form-row, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .btn { padding: 9px 18px; font-size: 0.9rem; }
    .programs-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card .stat-value { font-size: 1.6rem; }
    .stat-card .stat-icon { font-size: 1.3rem; margin-bottom: 4px; }
    .stat-card .stat-label { font-size: 0.78rem; }
    table.table { font-size: 0.82rem; }
    table.table th, table.table td { padding: 8px 10px; }
    .section-title { font-size: 1.1rem; }
    .books-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .book-card .book-info { padding: 10px 12px 4px; }
    .book-card .book-title { font-size: 0.88rem; }
    .book-card .book-author { font-size: 0.78rem; }
    .orders-page .orders-catalog-controls { grid-template-columns: 1fr 1fr; }
    .orders-page .orders-filter-actions { grid-column: span 2; }
    .orders-page .orders-filter-actions .btn { width: 100%; }
    .orders-page .orders-catalog-grid { grid-template-columns: 1fr; gap: 16px; }
    .orders-page .order-catalog-card { height: auto; }
    .orders-page .order-catalog-name { min-height: 0; }
    .orders-page .order-detail-row { grid-template-columns: 1fr; gap: 4px; margin-bottom: 12px; }
}

@media (max-width: 480px) {
    .card { padding: 16px; border-radius: var(--radius-sm); }
    .stat-card { padding: 14px 10px; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .stat-card .stat-icon { font-size: 1.1rem; }
    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.15rem; }
    .section-title { font-size: 1rem; margin-bottom: 12px; }
    .books-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .orders-page .orders-catalog-controls { grid-template-columns: 1fr; }
    .orders-page .orders-filter-actions { grid-column: auto; }
    .orders-page .order-catalog-card { height: auto; }
}

/* ── Modal Dialog (shared: used in teacher portal + admin) ─── */
.modal-dialog {
    background: var(--ea-white, #fff);
    border-radius: 12px;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    opacity: 0;
    transform: translateY(14px) scale(.985);
    transition: opacity .18s ease, transform .18s ease;
}
.modal-overlay.active .modal-dialog,
.modal-overlay:target .modal-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.modal-dialog h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}
.modal-dialog p {
    color: var(--ea-muted, #94a3b8);
    margin-bottom: 1.5rem;
}
.modal-dialog-wide  { max-width: 760px; }
.modal-dialog-form  { max-width: 680px; }

.modal-form-sections {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.modal-form-section {
    border: 1px solid var(--ea-border, #e2e8f0);
    border-radius: 10px;
    padding: 1.25rem;
    background: rgba(248,250,252,.8);
}
.modal-form-section h4 {
    margin: 0 0 .75rem;
    font-size: 1rem;
    color: var(--ea-primary, #0b1e49);
}
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding-top: .5rem;
}
.modal-actions .btn { flex: 1 1 auto; text-align: center; }
.modal-actions .btn-outline,
.modal-actions .modal-close {
    background: #fff;
    color: var(--ea-primary, #0b1e49);
    border-color: var(--ea-primary, #0b1e49);
}
.modal-actions .btn-outline:hover,
.modal-actions .modal-close:hover {
    background: var(--ea-primary, #0b1e49);
    color: #fff;
}

/* ── Table Sort Icons ────────────────────────────────────────── */
.table th.th-sortable {
    position: relative;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background-color var(--transition), box-shadow var(--transition);
}
.table th.th-sortable .sort-indicator,
.table thead th .sort-link .sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    margin-left: .45rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    font-size: .72rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), opacity var(--transition);
}
.table th.th-sortable .sort-indicator.material-symbols-rounded,
.table thead th .sort-link .sort-icon.material-symbols-rounded {
    font-size: 1rem;
    font-weight: normal;
}
/* Keep the header text readable (white) on the dark navy <thead>
   background in all sort states. The yellow underline signals the
   sort direction without changing the text colour. */
.table th.th-sortable,
.table th.th-sortable:hover,
.table th.th-sortable:focus,
.table th.th-sortable:focus-visible,
.table th.th-sortable.sort-asc,
.table th.th-sortable.sort-desc {
    color: #fff;
}
.table th.th-sortable:hover {
    background-color: #12336e;
}
.table th.th-sortable:focus-visible {
    outline: 2px solid var(--ea-yellow, #ffd200);
    outline-offset: -2px;
}
.table th.th-sortable.sort-asc,
.table th.th-sortable.sort-desc {
    box-shadow: inset 0 -3px 0 var(--ea-yellow, #ffd200);
}
.table th.th-sortable:hover .sort-indicator,
.table th.th-sortable:focus-visible .sort-indicator,
.table th.th-sortable.sort-asc .sort-indicator,
.table th.th-sortable.sort-desc .sort-indicator,
.table thead th .sort-link:hover .sort-icon,
.table thead th .sort-link:focus-visible .sort-icon,
.table thead th .sort-link .sort-icon.active {
    background: var(--ea-yellow, #ffd200);
    border-color: var(--ea-yellow, #ffd200);
    color: var(--ea-primary, #0b1e49);
    opacity: 1;
    transform: translateY(-1px);
}
/* Ensure any <a> inside a header stays white too. */
.table thead th a,
.table thead th a:hover,
.table thead th a:focus,
.table thead th a:visited {
    color: #fff;
    text-decoration: none;
}
.table thead th .sort-link {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    gap: .15rem;
    border-radius: 6px;
    outline-offset: 2px;
}
.table thead th .sort-link:hover,
.table thead th .sort-link:focus-visible {
    color: #fff;
}
.sort-icon {
    display: inline-flex;
}
.sort-icon.active { opacity: 1; }
