﻿/* ============================================================
   login-modal.css - نافذة تسجيل الدخول الاحترافية
   متوافقة مع هوية Edufiresoft ونظام السمة الحالي
   ============================================================ */

/* ===== Overlay ===== */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
}

.login-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* ===== Modal Container ===== */
.login-modal {
    background: var(--bg-modal, rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 14px;
    border: 1px solid var(--border-light, #E5E7EB);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.login-modal-overlay.active .login-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ===== Close Button ===== */
.login-modal-close {
    position: absolute;
    top: 12px;
    inset-inline-end: 16px;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted, #6B7280);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 10;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-modal-close:hover {
    color: var(--text-primary, #0F172A);
    background: var(--bg-chip-hover, rgba(0, 0, 0, 0.05));
}

/* ============================================================
   LEFT PANEL - Login Section
   ============================================================ */
.login-panel {
    flex: 1;
    padding: 40px 36px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    background: var(--bg-card, #FFFFFF);
}

/* ===== Logo ===== */
.login-panel .login-logo {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 24px;
    font-weight: 700;
    display: inline-flex;
    align-items: flex-end;
    direction: ltr !important;
    unicode-bidi: normal !important;
    margin-bottom: 16px;
    text-decoration: none;
    color: inherit;
    user-select: none;
}

.login-panel .login-logo .edu-part {
    color: var(--orange, #f97316);
    display: inline-block;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-panel .login-logo .fire-soft-part {
    display: inline-flex;
    color: var(--navy, #1e3a8a);
    align-items: flex-end;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-panel .login-logo .fire-soft-part > span {
    display: inline-block;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-panel .login-logo .logo-char {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-panel .login-logo .edu-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    display: inline-block;
    margin-bottom: 2px;
    animation: loginDotBounce 3s ease-in-out infinite;
    direction: ltr !important;
}
.login-panel .login-logo .edu-dot-1 { background-color: #4f46e5; animation-delay: 0s; }
.login-panel .login-logo .edu-dot-2 { background-color: #2563eb; animation-delay: 0.2s; }
.login-panel .login-logo .edu-dot-3 { background-color: #0ea5e9; animation-delay: 0.4s; }
.login-panel .login-logo .edu-dot-4 { background-color: #8b5cf6; animation-delay: 0.6s; }

@keyframes loginDotBounce {
    0%, 60%, 100% { transform: translateY(0) scale(1); }
    20% { transform: translateY(-5px) scale(1.3); }
    40% { transform: translateY(0) scale(1); }
}

/* ===== Welcome Message ===== */
.login-panel .login-welcome {
    margin-bottom: 4px;
}

.login-panel .login-welcome h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary, #0F172A);
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.login-panel .login-welcome p {
    font-size: 0.85rem;
    color: var(--text-muted, #6B7280);
    margin: 0;
    line-height: 1.5;
}

/* ===== User Card (when already logged in) ===== */
.login-panel .login-user-card {
    display: none;
    align-items: center;
    gap: 14px;
    background: var(--bg-chip, #f1f5f9);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 12px 0 14px;
    border: 1px solid var(--border-light, #E5E7EB);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.login-panel .login-user-card.show {
    display: flex;
}

.login-panel .login-user-card .user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light, #E5E7EB);
    flex-shrink: 0;
}

.login-panel .login-user-card .user-info {
    flex: 1;
    min-width: 0;
}

.login-panel .login-user-card .user-info .user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary, #0F172A);
    line-height: 1.2;
}

.login-panel .login-user-card .user-info .user-email {
    font-size: 0.75rem;
    color: var(--text-muted, #6B7280);
    line-height: 1.3;
    word-break: break-all;
}

/* ===== Buttons ===== */
.login-panel .login-btn-primary {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    background: var(--orange, #f97316);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.25);
    margin-top: 8px;
}

.login-panel .login-btn-primary:hover {
    background: #e8630e;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}

.login-panel .login-btn-primary:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}

.login-panel .login-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-panel .login-btn-primary .google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ===== Terms & Privacy ===== */
.login-panel .login-terms {
    margin-top: 24px;
    font-size: 0.7rem;
    color: var(--text-muted, #6B7280);
    text-align: center;
    line-height: 1.6;
}

.login-panel .login-terms a {
    color: var(--color-brand, #2563EB);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.login-panel .login-terms a:hover {
    color: var(--color-brand-hover, #1d4ed8);
    text-decoration: underline;
}

.login-panel .login-terms .separator {
    margin: 0 4px;
    color: var(--border-medium, #D1D5DB);
}

/* ============================================================
   RIGHT PANEL - Interactive Universe
   ============================================================ */
.login-universe {
    flex: 1;
    min-width: 0;
    background: linear-gradient(145deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border-radius: 0 14px 14px 0;
    min-height: 400px;
}

/* ===== Background Glow ===== */
.login-universe .universe-glow {
    position: absolute;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ===== Stars ===== */
.login-universe .star {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    animation: starPulse 3s ease-in-out infinite;
}

@keyframes starPulse {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* ===== Orbit Container ===== */
.login-universe .orbit-container {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Center Logo ===== */
.login-universe .orbit-center {
    position: relative;
    z-index: 2;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 28px;
    font-weight: 700;
    direction: ltr !important;
    unicode-bidi: normal !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    line-height: 1;
}

.login-universe .orbit-center .edu-part {
    color: #f97316;
    display: inline-block;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-universe .orbit-center .fire-soft-part {
    display: inline-flex;
    color: #FFFFFF;
    align-items: flex-end;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-universe .orbit-center .fire-soft-part > span {
    display: inline-block;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-universe .orbit-center .logo-char {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    direction: ltr !important;
    unicode-bidi: normal !important;
}

.login-universe .orbit-center .edu-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    display: inline-block;
    margin-bottom: 2px;
    animation: loginDotBounce 3s ease-in-out infinite;
    direction: ltr !important;
}
.login-universe .orbit-center .edu-dot-1 { background-color: #4f46e5; animation-delay: 0s; }
.login-universe .orbit-center .edu-dot-2 { background-color: #2563eb; animation-delay: 0.2s; }
.login-universe .orbit-center .edu-dot-3 { background-color: #0ea5e9; animation-delay: 0.4s; }
.login-universe .orbit-center .edu-dot-4 { background-color: #8b5cf6; animation-delay: 0.6s; }

.login-universe .orbit-center .center-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ===== Orbit Ring ===== */
.login-universe .orbit-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ===== Orbit Item ===== */
.login-universe .orbit-item {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.login-universe .orbit-item .orbit-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
    line-height: 1.1;
    text-align: center;
    transition: transform 0.3s ease;
}

.login-universe .orbit-item .orbit-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.85);
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #FFFFFF;
    padding: 8px 14px;
    border-radius: 10px;
    min-width: 150px;
    max-width: 220px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    font-family: inherit;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.login-universe .orbit-item .orbit-tooltip .tooltip-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #f97316;
    margin-bottom: 2px;
    direction: ltr;
}

.login-universe .orbit-item .orbit-tooltip .tooltip-desc {
    display: block;
    font-size: 0.6rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}

/* Arrow for tooltip */
.login-universe .orbit-item .orbit-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.92);
}

.login-universe .orbit-item:hover .orbit-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.login-universe .orbit-item:hover {
    transform: scale(1.12) !important;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-universe .orbit-item:hover .orbit-label {
    transform: scale(1.05);
}

/* ===== Orbit Item Colors ===== */
.login-universe .orbit-item.color-indigo { background: #4f46e5; }
.login-universe .orbit-item.color-blue { background: #2563eb; }
.login-universe .orbit-item.color-sky { background: #0ea5e9; }
.login-universe .orbit-item.color-violet { background: #8b5cf6; }
.login-universe .orbit-item.color-orange { background: #f97316; }
.login-universe .orbit-item.color-navy { background: #1e3a8a; }

/* ===== Connection Lines ===== */
.login-universe .connection-line {
    position: absolute;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    transform-origin: center center;
}

.login-universe .connection-line .line-glow {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    top: -1.5px;
    left: 0;
    animation: lineGlow 8s ease-in-out infinite;
}

@keyframes lineGlow {
    0% { left: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* ============================================================
   DARK MODE - Tooltip
   ============================================================ */
body.dark-mode .login-universe .orbit-item .orbit-tooltip {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .login-universe .orbit-item .orbit-tooltip::after {
    border-top-color: rgba(15, 23, 42, 0.95);
}

body.dark-mode .login-universe .orbit-item .orbit-tooltip .tooltip-name {
    color: #60a5fa;
}

/* ============================================================
   RTL Support
   ============================================================ */
[dir="rtl"] .login-universe {
    border-radius: 14px 0 0 14px;
}

[dir="rtl"] .login-modal-close {
    inset-inline-end: auto;
    inset-inline-start: 16px;
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark-mode .login-modal {
    background: var(--bg-modal, rgba(30, 41, 59, 0.95));
    border-color: var(--border-light, #334155);
}

body.dark-mode .login-panel {
    background: transparent;
}

body.dark-mode .login-panel .login-welcome h2 {
    color: var(--text-primary, #E8EDF5);
}

body.dark-mode .login-panel .login-welcome p {
    color: var(--text-muted, #9AA8C0);
}

body.dark-mode .login-panel .login-user-card {
    background: var(--bg-chip, #1e293b);
    border-color: var(--border-light, #334155);
}

body.dark-mode .login-panel .login-user-card .user-info .user-name {
    color: var(--text-primary, #E8EDF5);
}

body.dark-mode .login-panel .login-user-card .user-info .user-email {
    color: var(--text-muted, #9AA8C0);
}

body.dark-mode .login-panel .login-terms {
    color: var(--text-muted, #9AA8C0);
}

body.dark-mode .login-panel .login-logo .fire-soft-part {
    color: #60a5fa;
}

body.dark-mode .login-modal-close {
    color: var(--text-muted, #94a3b8);
}

body.dark-mode .login-modal-close:hover {
    color: var(--text-primary, #E8EDF5);
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .login-modal {
        flex-direction: column;
        max-width: 420px;
        max-height: 95vh;
        border-radius: 16px;
    }

    .login-universe {
        display: none;
    }

    .login-panel {
        padding: 28px 24px 24px;
        border-radius: 16px;
    }

    .login-panel .login-logo {
        font-size: 20px;
    }

    .login-panel .login-welcome h2 {
        font-size: 1.05rem;
    }

    .login-panel .login-welcome p {
        font-size: 0.8rem;
    }

    .login-panel .login-btn-primary {
        font-size: 0.85rem;
        min-height: 44px;
    }

    .login-panel .login-btn-primary .google-icon {
        width: 18px;
        height: 18px;
    }

    .login-modal-close {
        top: 10px;
        inset-inline-end: 14px;
        font-size: 1.4rem;
        min-width: 36px;
        min-height: 36px;
    }

    [dir="rtl"] .login-modal-close {
        inset-inline-end: auto;
        inset-inline-start: 14px;
    }

    .login-panel .login-user-card {
        padding: 10px 14px;
        margin: 10px 0 12px;
    }

    .login-panel .login-user-card .user-avatar {
        width: 38px;
        height: 38px;
    }

    .login-panel .login-user-card .user-info .user-name {
        font-size: 0.8rem;
    }

    .login-panel .login-user-card .user-info .user-email {
        font-size: 0.7rem;
    }

    .login-panel .login-terms {
        font-size: 0.65rem;
    }

    .login-universe .orbit-item .orbit-tooltip {
        min-width: 120px;
        max-width: 180px;
        padding: 6px 12px;
        bottom: calc(100% + 8px);
    }
    
    .login-universe .orbit-item .orbit-tooltip .tooltip-name {
        font-size: 0.7rem;
    }
    
    .login-universe .orbit-item .orbit-tooltip .tooltip-desc {
        font-size: 0.55rem;
    }
    
    .login-universe .orbit-item {
        width: 40px;
        height: 40px;
    }
    
    .login-universe .orbit-item .orbit-label {
        font-size: 0.5rem;
    }
}

@media (max-width: 480px) {
    .login-modal {
        max-width: 100%;
        border-radius: 14px;
        max-height: 98vh;
    }

    .login-panel {
        padding: 20px 16px 18px;
    }

    .login-panel .login-logo {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .login-panel .login-welcome h2 {
        font-size: 0.95rem;
    }

    .login-panel .login-welcome p {
        font-size: 0.75rem;
    }

    .login-panel .login-btn-primary {
        font-size: 0.8rem;
        min-height: 40px;
        padding: 10px 16px;
    }

    .login-panel .login-btn-primary .google-icon {
        width: 16px;
        height: 16px;
    }

    .login-modal-close {
        top: 8px;
        inset-inline-end: 10px;
        font-size: 1.2rem;
        min-width: 32px;
        min-height: 32px;
    }

    [dir="rtl"] .login-modal-close {
        inset-inline-end: auto;
        inset-inline-start: 10px;
    }

    .login-universe .orbit-item .orbit-tooltip {
        min-width: 100px;
        max-width: 150px;
        padding: 4px 10px;
    }
    
    .login-universe .orbit-item .orbit-tooltip .tooltip-name {
        font-size: 0.65rem;
    }
    
    .login-universe .orbit-item .orbit-tooltip .tooltip-desc {
        font-size: 0.5rem;
    }
}

/* ============================================================
   SUCCESS STATE
   ============================================================ */
.login-panel .login-success {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px 0;
}

.login-panel .login-success.show {
    display: flex;
}

.login-panel .login-success .checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    animation: loginCheckPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginCheckPop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.login-panel .login-success .checkmark svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: #FFFFFF;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-panel .login-success .success-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #0F172A);
}

/* ============================================================
   KEYBOARD NAVIGATION
   ============================================================ */
.login-panel .login-btn-primary:focus-visible,
.login-modal-close:focus-visible {
    outline: 3px solid var(--color-brand, #2563EB);
    outline-offset: 2px;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .login-modal,
    .login-modal-overlay,
    .login-modal-overlay.active .login-modal,
    .login-universe .orbit-item,
    .login-universe .connection-line .line-glow {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
    
    .login-universe .orbit-item:hover {
        transform: scale(1) !important;
    }
}