/* ==========================================================================
   TEST ENGINE - STUDENT AUTHENTICATION & DASHBOARD STYLES
   STRICT SCOPED ISOLATION: All rules prefixed with .te-auth-wrapper or .te-student-dashboard-wrap
   Zero global element styles to ensure 100% isolation from exam & admin UI.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. AUTH WRAPPER & CONTAINER (Login, Register, Forgot Password, Reset)
   -------------------------------------------------------------------------- */
.te-auth-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 40px auto;
    padding: 0 16px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #1e293b;
    line-height: 1.5;
}

.te-auth-wrapper * {
    box-sizing: border-box;
}

.te-auth-card {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    padding: 36px 32px;
    transition: all 0.2s ease-in-out;
}

@media (max-width: 480px) {
    .te-auth-card {
        padding: 24px 18px;
        border-radius: 10px;
    }
    .te-auth-wrapper {
        margin: 20px auto;
        padding: 0 10px;
    }
}

/* Header & Branding */
.te-auth-brand {
    text-align: center;
    margin-bottom: 28px;
}

.te-auth-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    margin-bottom: 14px;
}

.te-auth-logo-badge svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.te-auth-brand h1 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.te-auth-brand p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* Alerts / Notices */
.te-auth-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.45;
}

.te-auth-alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.te-auth-alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.te-auth-alert-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.te-auth-alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* Form Controls */
.te-auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.te-auth-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.te-auth-field-group label {
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.te-auth-field-group .te-auth-req {
    color: #dc2626;
    margin-left: 2px;
}

.te-auth-field-row {
    display: flex;
    gap: 12px;
}

@media (max-width: 480px) {
    .te-auth-field-row {
        flex-direction: column;
        gap: 18px;
    }
}

.te-auth-field-row .te-auth-field-group {
    flex: 1;
}

.te-auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.te-auth-input-icon {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.te-auth-input-wrap input[type="text"],
.te-auth-input-wrap input[type="email"],
.te-auth-input-wrap input[type="password"] {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14.5px;
    color: #1e293b;
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.te-auth-input-wrap.no-icon input[type="text"],
.te-auth-input-wrap.no-icon input[type="email"],
.te-auth-input-wrap.no-icon input[type="password"] {
    padding-left: 14px;
}

.te-auth-input-wrap input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.te-auth-toggle-pwd {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.te-auth-toggle-pwd:hover {
    color: #0f172a;
}

.te-auth-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
}

/* Remember & Forgot Row */
.te-auth-options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13.5px;
    margin-top: -4px;
}

.te-auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #475569;
    user-select: none;
    margin: 0;
}

.te-auth-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
    margin: 0;
}

.te-auth-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.te-auth-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Submit Button */
.te-auth-btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    margin-top: 6px;
}

.te-auth-btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.te-auth-btn-primary:active {
    transform: translateY(0);
}

/* Card Footer Links */
.te-auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    font-size: 14px;
    color: #64748b;
}

.te-auth-footer p {
    margin: 6px 0;
}

/* Logged in state card */
.te-auth-logged-in-box {
    text-align: center;
    padding: 10px 0;
}

.te-auth-avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3730a3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.te-auth-actions-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.te-auth-btn-secondary {
    width: 100%;
    padding: 11px 18px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.te-auth-btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

/* --------------------------------------------------------------------------
   2. STUDENT DASHBOARD WRAPPER & COMPONENTS
   -------------------------------------------------------------------------- */
.te-student-dashboard-wrap {
    width: 100%;
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #1e293b;
    line-height: 1.5;
}

.te-student-dashboard-wrap * {
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .te-student-dashboard-wrap {
        margin: 14px auto;
        padding: 0 12px;
    }
}

/* Dashboard Top Header */
.te-dash-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.te-dash-profile-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.te-dash-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.te-dash-user-info h2 {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.te-dash-user-info p {
    margin: 0;
    font-size: 13.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.te-dash-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.te-dash-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.te-dash-btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.te-dash-btn-logout:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* Resume In-Progress Test Banner */
.te-resume-alert {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1.5px solid #f59e0b;
    border-radius: 10px;
    padding: 18px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}

.te-resume-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.te-resume-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f59e0b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.te-resume-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.te-resume-details h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: #92400e;
}

.te-resume-details p {
    margin: 0;
    font-size: 13.5px;
    color: #b45309;
}

.te-btn-resume {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #d97706;
    color: #ffffff !important;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.te-btn-resume:hover {
    background: #b45309;
    transform: translateY(-1px);
}

/* Performance Overview Metrics Grid */
.te-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

@media (max-width: 640px) {
    .te-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 360px) {
    .te-metrics-grid {
        grid-template-columns: 1fr;
    }
}

.te-metric-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.te-metric-card:hover {
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.07);
    transform: translateY(-2px);
}

.te-metric-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.te-metric-title {
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.te-metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.te-metric-val {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    margin: 0;
}

.te-metric-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}

/* Dashboard Tabs Navigation */
.te-dash-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.te-dash-tabs::-webkit-scrollbar {
    display: none;
}

.te-dash-tab-btn {
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 14.5px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.te-dash-tab-btn:hover {
    color: #2563eb;
}

.te-dash-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* Tab Panels */
.te-dash-tab-panel {
    display: none;
}

.te-dash-tab-panel.active {
    display: block;
}

/* Section Containers */
.te-dash-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.te-dash-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.te-dash-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

/* Series Card Grid */
.te-dash-series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.te-dash-series-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.te-dash-series-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

.te-dash-series-thumb {
    width: 100%;
    height: 130px;
    object-fit: cover;
    background: #f1f5f9;
}

.te-dash-series-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.te-dash-series-body h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.te-dash-series-meta {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 12px;
}

.te-dash-series-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
    margin-top: 8px;
}

/* Responsive Tables */
.te-dash-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.te-dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.te-dash-table th {
    background: #f8fafc;
    padding: 12px 16px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1.5px solid #e2e8f0;
    white-space: nowrap;
}

.te-dash-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.te-dash-table tr:hover td {
    background-color: #fafbfc;
}

.te-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.te-status-passed {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.te-status-failed {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.te-status-progress {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* Action Buttons */
.te-btn-table-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #334155;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.te-btn-table-action:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* Profile Form */
.te-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .te-profile-grid {
        grid-template-columns: 1fr;
    }
}

.te-profile-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 22px;
}

.te-profile-card h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

.te-profile-readonly-item {
    margin-bottom: 14px;
}

.te-profile-readonly-item label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.te-profile-readonly-item .te-val {
    font-size: 14.5px;
    color: #1e293b;
    font-weight: 500;
}

/* Empty States */
.te-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.te-empty-state svg {
    width: 48px;
    height: 48px;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.te-empty-state p {
    margin: 0 0 16px 0;
    font-size: 14.5px;
}
