:root {
    --primary-navy: var(--op-navy, #1B365D);
    --primary-navy-dark: var(--op-navy-dark, #0f1f38);
    --accent-gold: var(--op-gold, #C5A059);
    --accent-gold-light: #E8D5A3;
    --accent-blue: #2563eb;
    --bg-light: #f8faff;
    --text-main: var(--op-navy, #1B365D);
    --text-muted: var(--op-text-secondary, #64748b);
    --error-color: #ef4444;
    --border-color: var(--op-border, #e2e8f0);
    --input-bg: var(--op-bg-card, #ffffff);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #e8eeff 100%);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    direction: rtl;
    position: relative;
    color: var(--text-main);
}

/* === DIGITAL THREADS BACKGROUND === */
.neural-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.neural-bg svg { width: 100%; height: 100%; opacity: 0.9; }

.digital-line-gold { fill: none; stroke: var(--accent-gold); stroke-width: 1.5; stroke-opacity: 0.35; stroke-linecap: round; stroke-linejoin: round; }
.digital-line-navy { fill: none; stroke: var(--primary-navy); stroke-width: 1.5; stroke-opacity: 0.25; stroke-linecap: round; stroke-linejoin: round; }

.digital-node-gold { fill: var(--accent-gold); opacity: 0.85; transform-origin: center; }
.digital-node-navy { fill: var(--primary-navy); opacity: 0.75; transform-origin: center; }

.node-pulse { animation: pulseNode 3s infinite alternate; }
.node-pulse-slow { animation: pulseNode 4.5s infinite alternate-reverse; }

.floating-icon { animation: floatIcon 6s ease-in-out infinite; transform-origin: center; }
.floating-icon-delayed { animation: floatIcon 8s ease-in-out infinite reverse; transform-origin: center; }

.tech-icon { fill: none; stroke: var(--accent-gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tech-icon-navy { fill: none; stroke: var(--primary-navy); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.animated-path {
    stroke-dasharray: 40 120;
    stroke-width: 2.5;
    stroke-opacity: 0.8;
    animation: moveDash 10s linear infinite;
}



/* === MAIN CONTAINER === */
.system-container {
    display: flex;
    width: 100%;
    max-width: 1150px;
    min-height: 680px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    box-shadow: 0 25px 60px rgba(27, 54, 93, 0.08), 0 8px 20px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin: 2rem;
    position: relative;
    z-index: 10;
}
.system-container.centered {
    flex-direction: column;
    max-width: 700px;
    min-height: auto;
}

/* === MAIN CARD (Auth/Single View) === */
.auth-card {
    width: 100%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 28px;
    box-shadow: 0 25px 60px rgba(27, 54, 93, 0.08), 0 8px 20px rgba(0, 0, 0, 0.04);
    padding: 3rem 2.5rem;
    position: relative;
    z-index: 10;
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

/* ==========================================================================
   LAYER OWNERSHIP: SYSTEM PAGES MODULE (DOMAIN LAYER)
   SYSTEM-PAGES.CSS
   Styles for installer, error pages, system diagnostics, and db status
   ========================================================================== */

/* === FORM SIDE / CONTENT SIDE === */
.form-side, .content-side {
    flex: 0.45;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.5rem 3rem;
    background: var(--op-bg-card, #ffffff);
    position: relative;
    z-index: 2;
    box-shadow: -10px 0 30px rgba(0,0,0,0.02);
}
.system-container.centered .content-side {
    flex: 1;
    box-shadow: none;
    border-radius: 28px;
    padding: 2.5rem 2rem;
}

/* === VISUAL SIDE === */
.visual-side {
    flex: 0.55;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 3rem 2.5rem;
    position: relative;
    background: linear-gradient(135deg, rgba(248, 250, 255, 0) 0%, rgba(232, 238, 255, 0.5) 100%);
}

/* === LOGO FRAME (CIRCULAR) === */
.logo-frame {
    position: relative;
    width: 170px; height: 170px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
}
.logo-frame.small {
    width: 110px; height: 110px;
}

.logo-frame::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light), var(--accent-gold)) border-box;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
}

.logo-frame::after {
    content: '';
    position: absolute; inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(197,160,89,0.15) 0%, transparent 70%);
    animation: logoGlow 4s ease-in-out infinite;
    z-index: -1;
}

.logo-frame img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 14px;
    position: relative; z-index: 2;
    border-radius: 50%;
    filter: drop-shadow(0 4px 8px rgba(197,160,89,0.25));
}



.visual-title {
    font-size: 2.6rem; font-weight: 800; margin-bottom: 0.5rem; line-height: 1.2;
    color: var(--primary-navy);
}
.visual-desc {
    font-size: 1.1rem; line-height: 1.6; font-weight: 600; color: var(--text-muted);
    margin-bottom: 1rem;
}

/* AI Badge */
.ai-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.15);
    color: var(--accent-blue);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem; font-weight: 700;
    margin-bottom: 2.5rem;
}
.ai-badge svg { width: 16px; height: 16px; animation: pulseSparkle 2s infinite; }


/* === CAROUSEL (Optional, used in Auth) === */
.carousel-wrapper { position: relative; width: 100%; max-width: 420px; z-index: 2; }
.feature-carousel { position: relative; width: 100%; height: 120px; }
.feature-slide { position: absolute; inset: 0; opacity: 0; transform: translateY(12px); transition: all 0.5s ease; pointer-events: none; }
.feature-slide.active { opacity: 1; transform: translateY(0); pointer-events: auto; }

.feature-card {
    border: 1px solid var(--border-color); border-radius: 18px; padding: 1.2rem 1.5rem;
    background: #ffffff; height: 100%;
    display: flex; flex-direction: row; align-items: center; gap: 1.2rem;
    text-align: right; box-shadow: 0 8px 25px rgba(27,54,93,0.05);
}

.feature-icon {
    width: 58px; height: 58px; min-width: 58px;
    background: rgba(197, 160, 89, 0.1); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.feature-icon svg { width: 28px; height: 28px; stroke: var(--accent-gold); fill: none; stroke-width: 1.8; }
.feature-info { flex: 1; }
.feature-title { font-size: 1.05rem; font-weight: 800; color: var(--primary-navy); margin-bottom: 0.25rem; }
.feature-text { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }

.carousel-nav { display: flex; justify-content: center; align-items: center; gap: 0.8rem; margin-top: 1.2rem; direction: ltr; }
.carousel-dots { display: flex; gap: 6px; }
.carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; border: none; cursor: pointer; transition: var(--transition); padding: 0; }
.carousel-dot.active { background: var(--accent-gold); width: 24px; border-radius: 4px; }
.carousel-arrow {
    width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.9);
    border: 1px solid var(--border-color); color: var(--primary-navy); font-size: 1.1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.carousel-arrow:hover { background: var(--primary-navy); color: #fff; border-color: var(--primary-navy); }

/* === FORM ELEMENTS === */
.form-content { width: 100%; max-width: 380px; margin: 0 auto; animation: fadeInUp 0.6s ease-out; }
.system-container.centered .form-content { max-width: 100%; }

.welcome-header { margin-bottom: 2.5rem; text-align: right; }
.welcome-header.center { text-align: center; }
.welcome-title { font-size: 2rem; font-weight: 800; color: var(--primary-navy); margin-bottom: 0.3rem; display: block; }
.welcome-subtitle { color: var(--text-muted); font-size: 1rem; font-weight: 500; }

.input-group { margin-bottom: 1.5rem; position: relative; }
.modern-input {
    width: 100%; height: 56px;
    padding: 0 3.2rem 0 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-main);
    transition: var(--transition);
    font-family: inherit; font-weight: 600;
    text-align: right; box-sizing: border-box;
}
.modern-input::placeholder { color: #cbd5e1; font-weight: 500; }
.password-input { padding-left: 3.2rem !important; direction: ltr; text-align: left; }
.modern-input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.1);
    outline: none;
}
.input-icon-start {
    position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
    color: #cbd5e1; pointer-events: none; transition: var(--transition);
}
.modern-input:focus ~ .input-icon-start { color: var(--accent-gold); }
.input-icon-end {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    color: #cbd5e1; cursor: pointer; background: none; border: none; padding: 0;
    display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.input-icon-end:hover { color: var(--accent-gold); }
.modern-input.error { border-color: var(--error-color); }
.error-message {
    color: var(--error-color); font-size: 0.82rem; margin-top: 0.4rem;
    display: none; align-items: center; gap: 0.4rem; font-weight: 600;
}

/* Alert Box */
.alert-box {
    background: #fef2f2; border: 1px solid #fecaca;
    color: #dc2626; padding: 0.9rem 1rem; border-radius: 12px; margin-bottom: 1.5rem;
    display: flex; align-items: flex-start; gap: 0.8rem; font-size: 0.9rem; font-weight: 600;
}
.alert-box.success {
    background: #f0fdf4; border-color: #bbf7d0; color: #16a34a;
}
.alert-box.warn {
    background: #fffbeb; border-color: #fde68a; color: #d97706;
}
.alert-box svg { flex-shrink: 0; margin-top: 2px; }

/* Buttons */
.submit-btn, .action-btn {
    width: 100%; padding: 1rem;
    background: linear-gradient(135deg, var(--primary-navy) 0%, var(--accent-blue) 100%);
    color: #ffffff; border: none; border-radius: 14px;
    font-size: 1.1rem; font-weight: 700; cursor: pointer;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
    transition: var(--transition);
    margin-top: 1rem;
    display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0.8rem;
    min-height: auto;
    text-decoration: none;
}
.action-btn.secondary {
    background: #f1f5f9 !important; color: var(--primary-navy) !important; box-shadow: none !important; border: 1px solid #e2e8f0 !important;
}
.action-btn.secondary:hover {
    background: #e2e8f0 !important; transform: translateY(-2px) translateZ(0) !important; color: var(--primary-navy) !important;
}
.submit-btn:hover, .action-btn:not(.secondary):hover {
    background: linear-gradient(135deg, var(--primary-navy-dark) 0%, var(--accent-blue) 100%) !important;
    color: #ffffff !important;
    transform: translateY(-2px) translateZ(0) !important;
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.35) !important;
}
.submit-btn:active, .action-btn:not(.secondary):active {
    background: linear-gradient(135deg, var(--primary-navy-dark) 0%, var(--primary-navy) 100%) !important;
    color: #ffffff !important;
    transform: translateY(0) translateZ(0) !important;
}
.action-btn.secondary:active {
    background: #d1d5db !important;
    color: var(--primary-navy) !important;
    transform: translateY(0) translateZ(0) !important;
}

/* Custom Checkbox */
input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 18px; height: 18px; border: 2px solid var(--border-color); border-radius: 4px;
    background-color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
input[type="checkbox"]:checked { background-color: var(--accent-gold); border-color: var(--accent-gold); }
input[type="checkbox"]:checked::after {
    content: ''; width: 5px; height: 10px; border: solid white; border-width: 0 2px 2px 0;
    transform: rotate(45deg); margin-bottom: 2px;
}

/* === FOOTER === */
.system-footer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--op-bg-subtle, #f8fafc);
    border: 1px solid var(--op-border, #e2e8f0);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    color: var(--primary-navy);
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    margin-top: 2rem;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: var(--transition);
}
.system-footer:hover {
    background: var(--op-border-light, #f1f5f9);
    border-color: var(--op-divider, #cbd5e1);
}
.system-footer p { margin: 0; }
.mobile-brand { display: none; }

/* === DIAGNOSTIC / INSTALL SPECIFIC === */
.status-list, .steps {
    margin-bottom: 1.5rem;
    text-align: right;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}
.status-item, .step {
    padding: 12px 16px; margin-bottom: 8px; border-radius: 12px;
    font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; gap: 12px;
    background: rgba(248, 250, 255, 0.8); border: 1px solid var(--border-color);
    color: var(--text-main);
}
.status-item.ok, .step-icon.success { background: rgba(16, 185, 129, 0.05); border-color: rgba(16, 185, 129, 0.2); color: #065f46; }
.status-item.fail, .step-icon.error { background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.2); color: #991b1b; }
.status-item.warn, .step-icon.warn { background: rgba(245, 158, 11, 0.05); border-color: rgba(245, 158, 11, 0.2); color: #92400e; }
.status-item.info, .step-icon.info { background: rgba(59, 130, 246, 0.05); border-color: rgba(59, 130, 246, 0.2); color: #1e40af; }
.step-icon.pending { background: rgba(197, 160, 89, 0.05); border-color: rgba(197, 160, 89, 0.2); color: #92400e; }

.status-icon, .step-icon {
    width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-icon svg { width: 14px; height: 14px; }


.spinner { animation: spin 1.2s linear infinite; stroke: var(--accent-gold); }

.progress-bar { height: 6px; background: rgba(0,0,0,0.05); border-radius: 6px; overflow: hidden; margin-bottom: 1.5rem; }
.progress-fill { height: 100%; border-radius: 6px; transition: width 0.8s ease; background: linear-gradient(90deg, var(--primary-navy), var(--accent-gold)); }

.reveal-late { opacity: 0; transform: translateY(10px); transition: all 0.6s ease; pointer-events: none; }
.reveal-late.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.credentials { margin-bottom: 1.5rem; background: rgba(197,160,89,0.04); border: 1px solid rgba(197,160,89,0.12); border-radius: 16px; padding: 24px; text-align: center; }
.cred-title { font-size: 0.9rem; color: var(--accent-gold); font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.cred-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; direction: ltr;}
.cred-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.cred-value { font-size: 1.1rem; font-weight: 800; color: var(--primary-navy); font-family: monospace; background: rgba(0,0,0,0.04); padding: 4px 16px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.08); letter-spacing: 1px; }

.security-note { padding: 14px 16px; background: rgba(16, 185, 129, 0.05); border: 1px solid rgba(16, 185, 129, 0.2); border-radius: 12px; display: flex; align-items: flex-start; gap: 10px; text-align: right; }
.security-note-text { font-size: 0.85rem; color: #065f46; line-height: 1.8; font-weight: 600; }
.security-note-text strong { color: #047857; font-weight: 800; }

.section-title { font-size: 0.85rem; font-weight: 800; color: var(--accent-gold); padding: 10px 0 4px; letter-spacing: 1px; text-transform: uppercase; text-align: center; }

code.system-code {
    background: rgba(0,0,0,0.04); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.9em; direction: ltr; display: inline-block;
}

.system-pre {
    background: #0f1f38; color: #e2e8f0; padding: 16px; border-radius: 12px; overflow-x: auto; font-size: 0.85rem; direction: ltr; text-align: left; margin: 12px 0;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

/* === RESPONSIVE === */
@media (max-width: 991px) {
    body { padding: 1rem; display: flex; align-items: center; }
    .system-container { flex-direction: column; max-width: 500px; margin: 0 auto; background: rgba(255,255,255,0.95); }
    .visual-side { display: none; }
    .form-side, .content-side { padding: 2.5rem 2rem; flex: 1; border-radius: 28px; box-shadow: none; }
    
    .mobile-brand { display: block; text-align: center; margin-bottom: 2rem; }
    .mobile-brand h1 { font-size: 1.8rem; font-weight: 800; color: var(--primary-navy); margin: 0.5rem 0 0.2rem; }
    .mobile-brand p { color: var(--text-muted); font-size: 0.95rem; margin: 0; font-weight: 600; }
    
    .welcome-header { display: none; }
    .modern-input { height: 52px; font-size: 0.95rem; }
    .submit-btn, .action-btn { padding: 0.9rem; font-size: 1rem; }
}

@media (max-width: 480px) {
    .form-side, .content-side { padding: 2rem 1.2rem; }
    .system-container { border-radius: 24px; }
}

/* === ERROR CODE STYLING === */
.error-code-bg {
    font-size: 7rem;
    font-weight: 900;
    background: linear-gradient(180deg, var(--accent-gold) 0%, #A08040 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    line-height: 1;
    letter-spacing: -2px;
}


