/* ==========================================================================
   JAMIA ASHRAFIA LAHORE - LMS COMPONENTS
   Tables, Modals, Forms, Fee Challan, Result Cards, Toasts, Badges
   ========================================================================== */

/* CARDS & PANELS */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast);
}

.card:hover {
    border-color: var(--border-prominent);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--primary-600);
}

/* DATA TABLES */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.data-table th {
    background: var(--bg-surface-elevated);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-prominent);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--bg-surface-hover);
}

/* BADGES & STATUS PILLS */
.status-pill, .badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-pill.success, .badge-pill.success {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
    border: 1px solid rgba(13, 148, 136, 0.25);
}

.status-pill.warning, .badge-pill.warning {
    background: var(--gold-50);
    color: var(--gold-700);
    border: 1px solid var(--gold-200);
}

.status-pill.danger, .badge-pill.danger {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.status-pill.info, .badge-pill.info {
    background: rgba(2, 132, 199, 0.12);
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.25);
}

.status-pill.primary, .badge-pill.primary {
    background: var(--primary-100);
    color: var(--primary-800);
    border: 1px solid var(--primary-200);
}

.status-pill.gold, .badge-pill.gold {
    background: var(--gold-100);
    color: var(--gold-700);
    border: 1px solid var(--gold-200);
}

/* FORMS & INPUT CONTROLS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label,
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

::placeholder {
    color: var(--text-muted);
    opacity: 0.9;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.9;
}

.form-control {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-prominent);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(50, 142, 160, 0.18);
    background: #ffffff;
}

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

/* SEARCH & FILTER BAR */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrap input {
    padding-left: 40px;
    width: 100%;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* STEPPER WIZARD (ADMISSIONS) */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--border-prominent);
    z-index: 1;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.step-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface-elevated);
    border: 2px solid var(--border-prominent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition-normal);
}

.wizard-step.active .step-indicator {
    border-color: var(--primary-600);
    background: var(--primary-600);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(50, 142, 160, 0.35);
}

.wizard-step.completed .step-indicator {
    border-color: var(--primary-500);
    background: var(--primary-700);
    color: #ffffff;
}

.step-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 8px;
}

.wizard-step.active .step-label {
    color: var(--primary-700);
}

/* MODAL SYSTEM */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 34, 41, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    padding: 20px;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-window {
    background: var(--bg-surface);
    border: 1px solid var(--border-prominent);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-backdrop.open .modal-window {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

/* TOAST NOTIFICATION */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface-elevated);
    border-left: 4px solid var(--primary-500);
    border-top: 1px solid var(--border-prominent);
    border-right: 1px solid var(--border-prominent);
    border-bottom: 1px solid var(--border-prominent);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    min-width: 300px;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.gold { border-left-color: var(--gold-400); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   PRINTABLE 3-PART FEE CHALLAN VOUCHER
   ========================================================================== */

.challan-voucher-container {
    background: #ffffff;
    color: #111827;
    padding: 24px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    font-family: 'Inter', sans-serif;
    border: 2px dashed #94a3b8;
}

.challan-part {
    border: 1px solid #cbd5e1;
    padding: 16px;
    border-radius: 6px;
    font-size: 0.76rem;
    display: flex;
    flex-direction: column;
}

.challan-part-title {
    text-align: center;
    font-weight: 700;
    color: var(--primary-800);
    border-bottom: 2px solid var(--primary-800);
    padding-bottom: 4px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.challan-head {
    text-align: center;
    margin-bottom: 10px;
}

.challan-head h3 {
    font-size: 0.88rem;
    color: var(--primary-800);
    font-weight: 800;
}

.challan-head p {
    font-size: 0.68rem;
    color: #4b5563;
}

.challan-barcode {
    text-align: center;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px;
    font-weight: 700;
    background: #f1f5f9;
    padding: 6px;
    margin: 8px 0;
    border: 1px solid #e2e8f0;
}

.challan-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.challan-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #e2e8f0;
}

.challan-table tr:last-child td {
    font-weight: 800;
    border-top: 2px solid var(--primary-800);
    border-bottom: none;
    color: var(--primary-800);
}

.challan-footer-signatures {
    margin-top: auto;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #64748b;
}

/* ==========================================================================
   PRINTABLE WIFAQ SANAD & RESULT CARD
   ========================================================================== */

.sanad-certificate {
    background: radial-gradient(circle at center, #ffffff 60%, #fdfaf4 100%);
    color: #0f172a;
    border: 8px double var(--primary-800);
    padding: 32px;
    border-radius: 8px;
    position: relative;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.sanad-inner-border {
    border: 2px solid var(--gold-500);
    padding: 24px;
    border-radius: 4px;
}

.sanad-bismillah {
    font-family: 'Amiri', serif;
    font-size: 1.6rem;
    color: var(--primary-800);
    margin-bottom: 10px;
}

.sanad-title-urdu {
    font-family: 'Amiri', serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--gold-600);
    margin-bottom: 6px;
}

.sanad-title-eng {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-800);
    margin-bottom: 18px;
}

.sanad-student-details {
    font-size: 0.95rem;
    line-height: 1.9;
    color: #1e293b;
    margin-bottom: 24px;
}

.sanad-grade-seal {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid var(--gold-500);
    margin: 0 auto 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gold-50);
    color: var(--primary-800);
    font-weight: 800;
}

.sanad-grade-seal .grade-urdu {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
    color: var(--gold-600);
}

.sanad-signatures {
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-top: 30px;
    border-top: 1px solid #cbd5e1;
    padding-top: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-800);
}

@media print {
    /* Hide everything by default */
    body * {
        visibility: hidden;
    }

    /* Make the entire modal ancestor chain visible for printable content */
    .modal-backdrop,
    .modal-backdrop .modal-window,
    .modal-backdrop .modal-window .modal-body,
    .modal-backdrop .modal-window .modal-body * {
        visibility: visible;
    }

    /* Reset modal backdrop so it doesn't show overlay/blur in print */
    .modal-backdrop {
        position: absolute !important;
        background: none !important;
        backdrop-filter: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        padding: 0 !important;
        display: block !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
    }

    .modal-backdrop .modal-window {
        box-shadow: none !important;
        border: none !important;
        transform: none !important;
        max-height: none !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Hide modal header (title bar) and footer (buttons) during print */
    .modal-header,
    .modal-footer {
        display: none !important;
    }

    .modal-body {
        padding: 0 !important;
        overflow: visible !important;
    }

    /* Make printable content containers visible and positioned */
    .challan-voucher-container, .challan-voucher-container *,
    .sanad-certificate, .sanad-certificate *,
    .student-id-card-wrap, .student-id-card-wrap * {
        visibility: visible !important;
    }

    .challan-voucher-container, .sanad-certificate, .student-id-card-wrap {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: 420px !important;
        margin: 0 auto !important;
        background: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Hide sidebar, header, and main content area */
    .sidebar,
    .main-header,
    .main-content,
    #toast-container {
        display: none !important;
    }
}

/* ==========================================================================
   USER PROFILE DROPDOWN MENU & RBAC 403 STYLES
   ========================================================================== */
.user-menu-wrapper {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-prominent);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-profile-btn:hover {
    border-color: var(--primary-400);
    background: var(--bg-surface-hover);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 250px;
    background: #ffffff;
    border: 1px solid var(--border-prominent);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 30px rgba(15, 34, 41, 0.12), 0 0 16px rgba(50, 142, 160, 0.1);
    padding: 8px 0;
    z-index: 1000;
    display: none;
    animation: dropdownFade 0.2s ease;
}

.user-dropdown-menu.open {
    display: block;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
    padding: 10px 16px 8px;
    background: var(--bg-surface-elevated);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 0;
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-item i {
    width: 18px;
    font-size: 0.95rem;
    color: var(--primary-600);
}

.dropdown-item:hover {
    background: var(--bg-surface-hover);
    color: var(--primary-800);
}

.dropdown-item.danger {
    color: #dc2626;
}

.dropdown-item.danger i {
    color: #ef4444;
}

.dropdown-item.danger:hover {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
}

/* 403 FORBIDDEN STYLING */
.forbidden-wrapper {
    animation: fadeIn 0.3s ease;
}

/* PERMISSIONS TOGGLE SWITCH */
.switch-toggle input[type="checkbox"] {
    cursor: pointer;
}

