/* EducationGuard — Student profile page */

.eg-profile {
    --eg-primary: #F39318;
    --eg-primary-dark: #d47d0f;
    --eg-primary-light: #ffb347;
    --eg-primary-soft: rgba(243, 147, 24, 0.12);
    --eg-secondary: #461E38;
    --eg-secondary-dark: #2f1018;
    --eg-secondary-light: #6b3456;
    --eg-cream: #faf8f5;
    --eg-parchment: #f7f0e4;
    --eg-parchment-dark: #e8dcc8;
    --eg-surface: #ffffff;
    --eg-text: #1a1a1a;
    --eg-text-muted: #5c5c5c;
    --eg-border: rgba(70, 30, 56, 0.15);
    --eg-radius: 1.25rem;
    --eg-radius-sm: 0.75rem;
    --eg-shadow: 0 8px 32px rgba(70, 30, 56, 0.1);
    --eg-shadow-lg: 0 16px 48px rgba(70, 30, 56, 0.16);
    --eg-font-display: 'Cairo', 'Segoe UI', 'Tajawal', sans-serif;

    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--eg-cream);
    color: var(--eg-text);
    font-family: var(--eg-font-display);
    overflow-x: hidden;
}

html[data-bs-theme="dark"] .eg-profile {
    --eg-cream: #1a1218;
    --eg-parchment: #2a2030;
    --eg-parchment-dark: #1e1620;
    --eg-surface: #322430;
    --eg-text: #faf5f7;
    --eg-text-muted: #d4c4cc;
    --eg-border: rgba(255, 200, 150, 0.16);
    --eg-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --eg-shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
}

/* ---------- Main ---------- */
.eg-profile-main {
    position: relative;
    z-index: 2;
    flex: 1;
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding: 2rem 1.25rem 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

@media (min-width: 768px) {
    .eg-profile-main { padding-inline: 2.5rem; }
}

/* ---------- Hero ---------- */
.eg-profile-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
    padding: 1.75rem;
    border-radius: var(--eg-radius);
    background: linear-gradient(135deg, var(--eg-surface) 0%, var(--eg-parchment) 100%);
    border: 1px solid var(--eg-border);
    box-shadow: var(--eg-shadow-lg);
    overflow: hidden;
    animation: eg-profile-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.eg-profile-hero-glow {
    position: absolute;
    inset-inline-start: -10%;
    top: -60%;
    width: 60%;
    height: 220%;
    background: radial-gradient(circle, var(--eg-primary-soft) 0%, transparent 70%);
    pointer-events: none;
}

.eg-profile-hero::after {
    content: "";
    position: absolute;
    inset-inline-end: -40px;
    bottom: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 2px dashed var(--eg-border);
    opacity: 0.5;
    pointer-events: none;
}

/* Avatar */
.eg-profile-avatar {
    position: relative;
    width: 124px;
    height: 124px;
    flex-shrink: 0;
}

.eg-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--eg-surface);
    box-shadow: var(--eg-shadow);
    position: relative;
    z-index: 2;
}

.eg-profile-avatar-ring {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: conic-gradient(from 180deg, var(--eg-primary), var(--eg-secondary-light), var(--eg-primary-light), var(--eg-primary));
    z-index: 1;
    animation: eg-profile-spin 9s linear infinite;
}

.eg-profile-avatar-badge {
    position: absolute;
    bottom: 4px;
    inset-inline-end: 4px;
    z-index: 3;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--eg-primary);
    color: #fff;
    border: 3px solid var(--eg-surface);
    font-size: 0.95rem;
}

.eg-profile-hero-info {
    flex: 1;
    min-width: 220px;
    position: relative;
    z-index: 2;
}

.eg-profile-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--eg-primary-dark);
    background: var(--eg-primary-soft);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
}

.eg-profile-hero-name {
    margin: 0.6rem 0 0.75rem;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-profile-hero-name { color: var(--eg-text); }

.eg-profile-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.eg-profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--eg-secondary);
    background: var(--eg-parchment-dark);
    border: 1px solid var(--eg-border);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
}

html[data-bs-theme="dark"] .eg-profile-chip { color: var(--eg-text); }

.eg-profile-chip i { color: var(--eg-primary); }

.eg-profile-chip--code {
    letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums;
}

/* Edit button */
.eg-profile-edit-btn {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    border: none;
    padding: 0.7rem 1.3rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(243, 147, 24, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.eg-profile-edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(243, 147, 24, 0.45);
}

/* ---------- Grid ---------- */
.eg-profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 960px) {
    .eg-profile-grid {
        grid-template-columns: 1.6fr 1fr;
        align-items: start;
    }
}

/* ---------- Cards ---------- */
.eg-profile-card {
    background: var(--eg-surface);
    border: 1px solid var(--eg-border);
    border-radius: var(--eg-radius);
    box-shadow: var(--eg-shadow);
    padding: 1.6rem;
    animation: eg-profile-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.eg-profile-details { animation-delay: 0.08s; }
.eg-profile-security { animation-delay: 0.16s; }

.eg-profile-card-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.35rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--eg-border);
}

.eg-profile-card-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 0.85rem;
    font-size: 1.3rem;
    color: var(--eg-primary-dark);
    background: var(--eg-primary-soft);
}

.eg-profile-card-icon--lock {
    color: var(--eg-secondary-light);
    background: rgba(70, 30, 56, 0.1);
}

html[data-bs-theme="dark"] .eg-profile-card-icon--lock {
    color: var(--eg-primary-light);
    background: rgba(255, 200, 150, 0.12);
}

.eg-profile-card-head h2 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-profile-card-head h2 { color: var(--eg-text); }

.eg-profile-card-head p {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: var(--eg-text-muted);
}

/* ---------- Info display ---------- */
.eg-profile-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.4rem 1.2rem;
}

.eg-profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.7rem 0;
    border-bottom: 1px dashed var(--eg-border);
}

.eg-profile-info-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--eg-text-muted);
}

.eg-profile-info-label i { color: var(--eg-primary); }

.eg-profile-info-value {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--eg-text);
    word-break: break-word;
}

/* ---------- Forms ---------- */
.eg-profile-form { margin-top: 0.25rem; }

.eg-profile-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem 1.25rem;
}

@media (min-width: 560px) {
    .eg-profile-form-grid { grid-template-columns: 1fr 1fr; }
}

.eg-profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.eg-profile-field > label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-profile-field > label { color: var(--eg-text); }

.eg-profile-field-line {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.85rem;
    background: var(--eg-parchment);
    border: 1.5px solid var(--eg-border);
    border-radius: var(--eg-radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.eg-profile-field-line:focus-within {
    border-color: var(--eg-primary);
    background: var(--eg-surface);
    box-shadow: 0 0 0 4px var(--eg-primary-soft);
}

.eg-profile-field-line > i {
    color: var(--eg-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.eg-profile-input {
    flex: 1;
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--eg-text);
    padding: 0.7rem 0;
}

.eg-profile-input::placeholder { color: var(--eg-text-muted); font-weight: 500; }

select.eg-profile-input {
    cursor: pointer;
    appearance: none;
}

select.eg-profile-input option {
    color: #1a1a1a;
}

.eg-profile-eye {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--eg-text-muted);
    font-size: 1rem;
    padding: 0.2rem;
    display: grid;
    place-items: center;
}

.eg-profile-eye:hover { color: var(--eg-primary); }

.eg-profile-form .validation-message {
    font-size: 0.74rem;
    color: #d9534f;
    font-weight: 600;
}

/* ---------- Buttons ---------- */
.eg-profile-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.eg-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--eg-radius-sm);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.eg-profile-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.eg-profile-btn--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    box-shadow: 0 8px 20px rgba(243, 147, 24, 0.32);
}

.eg-profile-btn--primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(243, 147, 24, 0.42);
}

.eg-profile-btn--ghost {
    color: var(--eg-secondary);
    background: var(--eg-parchment-dark);
    border: 1px solid var(--eg-border);
}

html[data-bs-theme="dark"] .eg-profile-btn--ghost { color: var(--eg-text); }

.eg-profile-btn--ghost:hover { transform: translateY(-2px); }

.eg-profile-btn--block {
    width: 100%;
    margin-top: 1.6rem;
}

.eg-profile-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: eg-profile-spin 0.7s linear infinite;
}

/* ---------- Animations ---------- */
@keyframes eg-profile-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes eg-profile-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
    .eg-profile-hero { flex-direction: column; text-align: center; }
    .eg-profile-hero-info { min-width: 0; }
    .eg-profile-hero-chips { justify-content: center; }
    .eg-profile-edit-btn { width: 100%; justify-content: center; }
}
