/* ----------------------------------------------------
   Dashboard CSS (Admin, Student, Teacher)
   Desktop App Modern Panel Design
   ---------------------------------------------------- */

/* === Progress Bars === */
.progress-container {
    background: var(--border);
    border-radius: var(--radius-full);
    height: 8px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary), var(--success));
    height: 100%;
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-full);
}

.progress-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    text-align: right;
    font-weight: 500;
}

/* === Badge Showcase === */
.badge-case {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 0.85rem;
    padding: 1rem;
    background: var(--bg-inset);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.badge-item {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: var(--shadow-sm);
    cursor: help;
    transition: all var(--transition-spring);
    position: relative;
    border: 2px solid var(--border);
}

.badge-item:hover {
    transform: scale(1.12);
    z-index: 10;
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.badge-item.locked {
    filter: grayscale(100%);
    opacity: 0.4;
    background: var(--bg-inset);
    border-color: transparent;
}

/* === Dashboard Tables === */
.dashboard-table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

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

.dashboard-table thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.85rem 1.25rem;
    text-align: left;
    letter-spacing: 0.06em;
    background: var(--bg-inset);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

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

.dashboard-table tbody tr:hover {
    background: var(--bg-inset);
}

.dashboard-table td {
    padding: 0.85rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.dashboard-table td:first-child {
    font-weight: 500;
}

.dashboard-table td:last-child {
    text-align: right;
}

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

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* === Admin Form Card === */
.admin-card {
    background: white;
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}

/* Admin card containing tables - remove constraints */
.admin-card:has(.dashboard-table-container),
.admin-card:has(.dashboard-table) {
    max-width: 100%;
    overflow: visible;
}

.admin-form-group {
    margin-bottom: 1.25rem;
}

.admin-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.admin-input {
    display: block;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.925rem;
    transition: all var(--transition-fast);
    background: white;
    color: var(--text-main);
}

.admin-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.admin-input.flair {
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--secondary);
    border-radius: var(--radius-sm);
}

.admin-input.flair:focus {
    border-bottom-color: var(--primary);
}

/* === Save / Cancel Buttons === */
.btn-save {
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

.btn-save:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.3);
}

.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    padding: 0.6rem 1.25rem;
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    transition: color var(--transition-fast);
}

.btn-cancel:hover {
    color: var(--text-main);
}

/* === Action Buttons === */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    background: transparent;
    border: none;
    cursor: pointer;
}

.action-btn:hover {
    color: var(--primary);
    background: var(--primary-subtle);
}

.action-btn.delete:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* === Calendar === */
.calendar-container {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
    text-align: center;
}

.calendar-weekday {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.5rem 0;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    position: relative;
    font-weight: 500;
    font-size: 0.88rem;
}

.calendar-day:hover:not(.empty) {
    background: var(--bg-inset);
    border-color: var(--primary);
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.today {
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 700;
    border: 1px solid var(--primary);
}

.calendar-day.has-event::after {
    content: '';
    width: 5px;
    height: 5px;
    background: var(--success);
    border-radius: 50%;
    position: absolute;
    bottom: 5px;
}

.calendar-day.selected {
    background: var(--primary) !important;
    color: white !important;
}

.calendar-day.selected::after {
    background: white;
}

/* === Modal Overlay === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    animation: modalShow 0.2s ease-out;
}

/* === Search & Autocomplete === */
.search-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    font-size: 0.9rem;
}

.search-wrapper .admin-input {
    padding-left: 2.5rem;
}

.autocomplete-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.autocomplete-item {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition-fast);
    font-size: 0.9rem;
}

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

.autocomplete-item:hover {
    background: var(--bg-inset);
}

/* === Enrollment Manager === */
.manager-card {
    min-height: 500px;
    overflow: visible;
}

.selected-student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: var(--bg-inset);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.student-avatar {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.15rem;
}

.enrollment-grid {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.enrollment-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
}

.enrollment-card:hover {
    border-color: rgba(5, 150, 105, 0.2);
    box-shadow: var(--shadow-sm);
}

.enrollment-title {
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    font-size: 0.9rem;
}

.enrollment-remove-btn {
    background: var(--danger-light);
    color: var(--danger);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.enrollment-remove-btn:hover {
    background: var(--danger);
    color: white;
}

.section-divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

.context-panel {
    animation: fadeIn 0.3s ease-out;
}