/* =====================================================
   Components - buttons, cards, forms, tables, badges, toasts
   ===================================================== */

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.card-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.card-body { padding: var(--space-5); }

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border-soft);
    background: var(--color-bg-soft);
}

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    position: relative;
    padding: var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-300));
}

.stat-card.accent-red::before { background: linear-gradient(90deg, var(--color-accent-red), #F87C84); }
.stat-card.accent-orange::before { background: linear-gradient(90deg, var(--color-accent-orange), #FFD0A3); }
.stat-card.accent-green::before { background: linear-gradient(90deg, var(--color-accent-green), #6EE7B7); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary-100), var(--color-primary-200));
    color: var(--color-primary-700);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}
.stat-card.accent-red .stat-icon { background: linear-gradient(135deg, #FFE3E5, #FFC9CD); color: var(--color-accent-red); }
.stat-card.accent-orange .stat-icon { background: linear-gradient(135deg, #FFEFD9, #FFDDB0); color: var(--color-accent-orange-d); }
.stat-card.accent-green .stat-icon { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); color: var(--color-accent-green); }

.stat-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* Dashboard / landing sections (shared across all role dashboards) */
.dash-section {
    margin-bottom: var(--space-6);
}

.dash-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.dash-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.dash-section-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.dash-section-action {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary-700);
    text-decoration: none;
}

.dash-section-action:hover {
    text-decoration: underline;
}

.dash-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}

.dash-metrics {
    margin-bottom: 0;
}

.dash-metric-link {
    display: inline-block;
    margin-top: var(--space-3);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary-700);
    text-decoration: none;
}

.dash-metric-link:hover {
    text-decoration: underline;
}

.dash-metric-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.dash-list {
    display: flex;
    flex-direction: column;
}

.dash-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 12px var(--space-5);
    border-bottom: 1px solid var(--color-border-soft);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease);
}

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

.dash-list-item:hover {
    background: var(--color-bg-soft);
}

.dash-list-item.is-urgent {
    box-shadow: inset 3px 0 0 0 rgba(245, 158, 11, 0.85);
}

.dash-list-name {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.dash-list-count {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    color: var(--color-text);
    flex: 0 0 auto;
}

.dash-list-count.is-empty {
    color: var(--color-text-muted);
    font-weight: 600;
}

.dash-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    padding: var(--space-4);
}

.dash-action {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease);
}

.dash-action:hover {
    border-color: var(--color-primary-300);
    background: var(--color-primary-50);
    transform: translateY(-1px);
}

.dash-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(19, 120, 116, 0.10);
    color: var(--color-primary-700);
}

.dash-action-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dash-action-text strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
}

.dash-action-text small {
    font-size: 11px;
    line-height: 1.45;
    color: var(--color-text-muted);
}

.dash-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
}

.dash-mini-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    background: var(--color-bg-soft);
}

.dash-mini-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
}

.dash-mini-value {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.1;
}

/* Compact section list rows (default grouped views) */
.section-list {
    display: flex;
    flex-direction: column;
}

.section-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 10px var(--space-5);
    border-bottom: 1px solid var(--color-border-soft);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease);
}

.section-list-row:last-child {
    border-bottom: none;
}

.section-list-row:hover {
    background: var(--color-bg-soft);
}

.section-list-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.section-list-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-list-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.section-list-side {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.section-empty {
    padding: 14px var(--space-5);
    font-size: 12px;
    color: var(--color-text-muted);
}

.section-list-cta {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary-700);
    white-space: nowrap;
}

.section-list-row:hover .section-list-cta {
    text-decoration: underline;
}

.section-list-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 10px var(--space-5);
    border-top: 1px solid var(--color-border-soft);
    background: var(--color-bg-soft);
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Active filter chips */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-4);
}

.filter-chips-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease);
}

.filter-chip:hover {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.06);
    color: #b91c1c;
}

.filter-chip-clear {
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
}

/* Clickable stat strips */
a.stat-tile {
    text-decoration: none;
    color: inherit;
    transition: all var(--duration-fast) var(--ease);
}

a.stat-tile:hover {
    border-color: var(--color-primary-300);
    transform: translateY(-1px);
}

a.stat-tile.is-active {
    border-color: var(--color-primary-700);
    box-shadow: 0 0 0 2px rgba(19, 120, 116, 0.18);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--duration-fast) var(--ease);
    white-space: nowrap;
    line-height: 1;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
    color: var(--color-text-invert);
    box-shadow: 0 2px 6px rgba(19, 120, 116, 0.30);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(19, 120, 116, 0.40);
    color: var(--color-text-invert);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-soft);
    border-color: var(--color-primary-300);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-accent-red), var(--color-accent-red-d));
    color: var(--color-text-invert);
    box-shadow: 0 2px 6px rgba(230, 57, 70, 0.25);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.35);
    color: var(--color-text-invert);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-accent-green), #059669);
    color: var(--color-text-invert);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
}

.btn-ghost:hover { background: rgba(19, 120, 116, 0.06); color: var(--color-text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--color-bg-soft);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-icon:hover { background: var(--color-primary-50); color: var(--color-primary-700); border-color: var(--color-primary-200); }

/* Forms */
.form-group { margin-bottom: var(--space-4); }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}

.form-label .required { color: var(--color-accent-red); margin-left: 2px; }

.form-control,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease);
    font-family: inherit;
}

.form-control::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-soft);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 4px rgba(38, 175, 165, 0.15);
    background: var(--color-surface);
}

.form-control.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--color-accent-red);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.10);
}

.searchable-select {
    position: relative;
}

.searchable-select-trigger {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease);
}

.searchable-select-trigger:hover {
    border-color: var(--color-primary-300);
}

.searchable-select.is-open .searchable-select-trigger,
.searchable-select-trigger:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 4px rgba(38, 175, 165, 0.15);
}

.searchable-select-trigger.has-value {
    color: var(--color-text);
}

.searchable-select-trigger-icon {
    flex: 0 0 auto;
    color: var(--color-text-muted);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 120;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    display: none;
}

.searchable-select.is-open .searchable-select-dropdown {
    display: block;
}

.searchable-select-search {
    margin-bottom: 10px;
}

.searchable-select-options {
    max-height: min(680px, 72vh);
    overflow: auto;
    display: grid;
    gap: 6px;
}

.searchable-select-option {
    width: 100%;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text);
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.searchable-select-option:hover,
.searchable-select-option.is-selected {
    background: rgba(38, 175, 165, 0.10);
    color: var(--color-primary-700);
}

.searchable-select-empty {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--color-bg-soft);
    color: var(--color-text-muted);
    font-size: 13px;
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transform: translateY(-50%);
    transition: color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--color-primary-700);
    background: rgba(38, 175, 165, 0.10);
    outline: none;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

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

.form-help {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--color-accent-red);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 14px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary-600);
    cursor: pointer;
}

/* Select wrapper with custom arrow */
.select-wrap {
    position: relative;
}

.select-wrap::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-25%) rotate(45deg);
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
    pointer-events: none;
}

.select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    cursor: pointer;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Student profile grid (staff detail views) */
.student-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    margin-top: 10px;
}

.student-profile-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.06);
}

.student-profile-row.is-wide {
    grid-column: 1 / -1;
}

.student-profile-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-soft, #64748b);
}

.student-profile-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    word-break: break-word;
}

/* Student feedback / remarks blocks */
.student-feedback-block {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 14px 16px;
    background: rgba(148, 163, 184, 0.06);
    margin-bottom: 12px;
}

.student-feedback-block:last-child {
    margin-bottom: 0;
}

.student-feedback-block.is-danger {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
}

.student-feedback-block.is-warning {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.06);
}

.student-feedback-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-soft, #64748b);
    margin-bottom: 6px;
}

.student-feedback-text {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--color-text);
}

.student-feedback-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-soft, #64748b);
}

/* Prominent review feedback card (student view) */
.review-feedback-card {
    border: 1px solid rgba(20, 184, 166, 0.35);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.08);
    overflow: hidden;
}

.review-feedback-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(20, 184, 166, 0.2);
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(20, 184, 166, 0.04));
}

.review-feedback-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(20, 184, 166, 0.18);
    color: #0f766e;
}

.review-feedback-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.review-feedback-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-soft, #64748b);
}

.review-feedback-card .student-feedback-text {
    font-size: 15px;
}

@media (max-width: 640px) {
    .student-profile-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Tables */
.table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-soft);
    vertical-align: middle;
}

.table thead th {
    background: var(--color-bg-soft);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody tr {
    transition: background var(--duration-fast) var(--ease);
}

.table tbody tr:hover {
    background: var(--color-bg-soft);
}

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

.table-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--color-text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: var(--color-bg-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-soft);
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.empty-state-text {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

/* Toast */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - var(--space-8));
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary-500);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s var(--ease-out);
    font-size: 14px;
}

.toast-success { border-left-color: var(--color-accent-green); }
.toast-danger  { border-left-color: var(--color-accent-red); }
.toast-warning { border-left-color: var(--color-accent-orange); }

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    color: var(--color-text-invert);
    background: var(--color-primary-500);
}

.toast-success .toast-icon { background: var(--color-accent-green); }
.toast-danger .toast-icon  { background: var(--color-accent-red); }
.toast-warning .toast-icon { background: var(--color-accent-orange); }

.toast-msg { flex: 1; color: var(--color-text); }

.toast-close {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: background var(--duration-fast) var(--ease);
}

.toast-close:hover { background: var(--color-bg-soft); }

.toast-hide {
    animation: toast-out 0.3s var(--ease) forwards;
}

@keyframes toast-in {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(20px); opacity: 0; }
}

/* Alerts */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    border: 1px solid;
    margin-bottom: var(--space-4);
}

.alert-success { background: rgba(16, 185, 129, 0.10); border-color: rgba(16, 185, 129, 0.30); color: #047857; }
.alert-danger  { background: rgba(230, 57, 70, 0.08);  border-color: rgba(230, 57, 70, 0.30);  color: #B91C2A; }
.alert-warning { background: rgba(244, 162, 97, 0.12); border-color: rgba(244, 162, 97, 0.40); color: #9A4D1A; }
.alert-info    { background: rgba(59, 130, 246, 0.10); border-color: rgba(59, 130, 246, 0.30); color: #1D4ED8; }

/* Auth card */
.auth-wrap {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
    max-height: calc(100vh - var(--space-6) * 2);
    display: flex;
    flex-direction: column;
    margin: auto;
}

.auth-card {
    padding: var(--space-8);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 80px rgba(6, 47, 56, 0.30), 0 12px 30px rgba(6, 47, 56, 0.20);
    border: 1px solid rgba(255, 255, 255, 0.6);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /* Clip content + scrollbar to rounded shape so right corners stay rounded */
    clip-path: inset(0 round var(--radius-xl));
    -webkit-clip-path: inset(0 round var(--radius-xl));
}

/* Custom scrollbar for auth card */
.auth-card {
    scrollbar-width: thin;
    scrollbar-color: rgba(19, 120, 116, 0.25) transparent;
}
.auth-card::-webkit-scrollbar { width: 6px; }
.auth-card::-webkit-scrollbar-track {
    background: transparent;
    margin: var(--radius-xl) 0;
}
.auth-card::-webkit-scrollbar-thumb {
    background: rgba(19, 120, 116, 0.25);
    border-radius: 6px;
}
.auth-card::-webkit-scrollbar-thumb:hover {
    background: rgba(19, 120, 116, 0.40);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.auth-logo {
    width: 100px;
    height: 40px;
    margin: 0 auto var(--space-4);
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: var(--color-primary-900);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-5);
    font-size: 13px;
    color: var(--color-text-muted);
}

.auth-lang {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 10;
}

.auth-lang .lang-switch {
    background: rgba(255, 255, 255, 0.20);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.30);
    padding: 4px;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(6, 47, 56, 0.20);
}

.auth-lang .lang-btn {
    color: rgba(255, 255, 255, 0.85);
    padding: 7px 14px;
    font-size: 13px;
    gap: 8px;
}

.auth-lang .lang-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.15);
}

.auth-lang .lang-btn.active {
    background: #FFFFFF;
    color: var(--color-primary-800);
    box-shadow: 0 2px 8px rgba(6, 47, 56, 0.20);
}

/* Timeline (application status) */
.timeline {
    position: relative;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--color-primary-200), var(--color-primary-100));
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-5);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 2px solid var(--color-primary-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--color-text-muted);
    z-index: 1;
}

.timeline-item.active .timeline-dot,
.timeline-item.completed .timeline-dot {
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
    border-color: var(--color-primary-500);
    color: var(--color-text-invert);
    box-shadow: 0 0 0 4px rgba(38, 175, 165, 0.20);
}

.timeline-item.rejected .timeline-dot {
    background: linear-gradient(135deg, var(--color-accent-red), var(--color-accent-red-d));
    border-color: var(--color-accent-red);
    color: var(--color-text-invert);
}

.timeline-item.current .timeline-dot {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    border-color: #3B82F6;
    color: var(--color-text-invert);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

.timeline-item.blocked .timeline-dot {
    background: var(--color-bg-soft);
    border-color: var(--color-border);
    color: var(--color-text-soft);
}

.timeline-content h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.timeline-content p {
    font-size: 13px;
    color: var(--color-text-muted);
}

.timeline-time {
    font-size: 11px;
    color: var(--color-text-soft);
    margin-top: 4px;
}

/* Student application detail */
.application-view-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: 20px;
}

.application-summary-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.application-summary-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.application-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(38, 175, 165, 0.10);
    color: var(--color-primary-700);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.application-summary-head h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

.application-summary-meta {
    display: grid;
    gap: 12px;
    min-width: 240px;
}

.summary-chip {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 76, 92, 0.10);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 250, 252, 0.96));
}

.summary-chip span,
.info-item span,
.handler-card span,
.application-note span,
.progress-state-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-soft);
}

.summary-chip strong,
.info-item strong,
.handler-card strong {
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.4;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.info-item,
.handler-card,
.application-note,
.progress-state {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 76, 92, 0.10);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 252, 0.98));
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 88px;
}

.info-item small,
.handler-card small,
.application-note p,
.progress-state p {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.handler-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.application-note {
    margin-top: 18px;
}

.application-note p,
.progress-state p {
    margin: 8px 0 0;
}

.progress-state {
    margin-bottom: 18px;
}

.progress-state strong {
    display: block;
    margin-top: 6px;
    font-size: 18px;
    line-height: 1.3;
}

.progress-state-info {
    border-color: rgba(59, 130, 246, 0.18);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(247, 250, 252, 0.98));
}

.progress-state-success {
    border-color: rgba(16, 185, 129, 0.18);
    background: linear-gradient(180deg, rgba(236, 253, 245, 0.96), rgba(247, 250, 252, 0.98));
}

.progress-state-danger {
    border-color: rgba(239, 68, 68, 0.18);
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.96), rgba(247, 250, 252, 0.98));
}

.application-status-timeline .timeline-content h4 {
    margin-bottom: 4px;
}

@media (max-width: 1024px) {
    .application-view-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .application-summary-head,
    .application-summary-meta {
        grid-template-columns: 1fr;
        display: grid;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .application-summary-head h2 {
        font-size: 22px;
    }
}

/* File upload */
.file-upload {
    display: block;
    padding: var(--space-6);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease);
    background: var(--color-bg-soft);
}

.file-upload:hover {
    border-color: var(--color-primary-400);
    background: var(--color-primary-50);
}

.file-upload input[type="file"] { display: none; }

.file-upload-text {
    font-size: 14px;
    color: var(--color-text);
    font-weight: 500;
    margin-top: var(--space-2);
}

.file-upload-hint {
    font-size: 12px;
    color: var(--color-text-soft);
    margin-top: 4px;
}

/* Loader */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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