/* ======================================================================
   AConsultIT Academy — Main stylesheet
   Dark elegant theme · Production-ready
   Preserves all original class names from light version (full compat).
   ====================================================================== */

:root {
    /* ─── Brand colors (preserved for backward compat) ─── */
    --azure: #3b82f6;
    --azure-dark: #1e40af;
    --azure-light: #60a5fa;
    --azure-bright: #93c5fd;
    --yellow: #e6b450;
    --green: #10b981;
    --red: #ef4444;

    /* ─── Text colors (DARK) ─── */
    --text: #e8eaed;
    --text-muted: #9ca3af;
    --text-subtle: #6b7280;

    /* ─── Backgrounds (DARK) ─── */
    --bg: #0a0b0e;
    --bg-soft: #11141a;
    --bg-soft-2: #161a22;

    /* ─── Borders ─── */
    --border: #2a3140;
    --border-strong: #3a4154;

    /* ─── Sizes ─── */
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);

    /* ─── Fonts ─── */
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* ─── Surfaces (NEW for dark theme) ─── */
    --surface: #1a1f2a;
    --surface-2: #232733;
    --surface-3: #2c313e;
}

/* ─── RTL: use Cairo for Arabic ─── */
html[dir="rtl"] body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

/* ─── Reset ─── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-stack);
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--azure); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--azure-light); text-decoration: underline; }

h1, h2, h3, h4 {
    line-height: 1.25;
    margin: 0 0 0.5em;
    color: var(--text);
    letter-spacing: -0.01em;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }

.muted { color: var(--text-muted); }
.positive { color: var(--green); }
.negative { color: var(--red); }

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ======================================================================
   Layout
   ====================================================================== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.container-wide {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.row { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.col { flex: 1; min-width: 0; }

/* ======================================================================
   Site Header
   ====================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 11, 14, 0.85);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0;
    height: 64px;
}

.site-header__inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 0.5rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
    margin-right: 1.5rem;
    flex-shrink: 0;
    text-decoration: none;
}
.brand:hover { color: var(--text); text-decoration: none; }
html[dir="rtl"] .brand { margin-right: 0; margin-left: 1.5rem; }

.brand__logo {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.brand__logo--svg svg { width: 100%; height: 100%; }
.brand__logo--img { object-fit: contain; }
.brand__text { letter-spacing: -0.01em; }
.brand__text strong { font-weight: 700; }

/* ======================================================================
   Site Nav
   ====================================================================== */
.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.nav-spacer { flex: 1; }

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s ease;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}
.nav-link:hover {
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
}
.nav-link.is-active {
    color: var(--text);
    background: var(--surface);
    box-shadow: inset 0 -2px 0 var(--azure);
}

/* Admin link — distinct amber accent */
.nav-link--admin {
    color: var(--yellow) !important;
    border: 1px solid rgba(230, 180, 80, 0.25);
    margin-left: 0.25rem;
}
.nav-link--admin:hover {
    background: rgba(230, 180, 80, 0.1);
    border-color: rgba(230, 180, 80, 0.4);
    color: var(--yellow) !important;
}
.nav-link--admin.is-active {
    background: rgba(230, 180, 80, 0.15);
    border-color: rgba(230, 180, 80, 0.5);
    box-shadow: none;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 4px;
    text-transform: uppercase;
    line-height: 1;
}
.nav-badge--new {
    background: linear-gradient(135deg, var(--green), #34d399);
    color: #0a0b0e;
}

.nav-logout-form { display: inline; margin: 0; padding: 0; }
.nav-logout { background: transparent; border: 0; cursor: pointer; }

.nav-user {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-points {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
    background: rgba(230, 180, 80, 0.1);
    border: 1px solid rgba(230, 180, 80, 0.25);
    color: var(--yellow);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: all .15s ease;
}
.nav-points:hover {
    background: rgba(230, 180, 80, 0.18);
    color: var(--yellow);
    text-decoration: none;
}
.nav-points strong { color: var(--yellow); }

/* ======================================================================
   Language Switcher (Pills)
   ====================================================================== */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    background: var(--bg-soft-2);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 3px;
    gap: 2px;
    margin: 0 0.5rem;
}

.lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    padding: 0 0.625rem;
    border-radius: 100px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: all .15s ease;
    user-select: none;
    font-family: 'Inter', sans-serif;
}
.lang-pill:hover:not(.is-active) {
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
}
.lang-pill.is-active {
    background: var(--azure);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.lang-pill.is-active:hover {
    color: #fff;
    text-decoration: none;
}

/* ======================================================================
   Buttons
   ====================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1.125rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}
.btn:hover { text-decoration: none; }

.btn-sm { padding: 0.4375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

.btn-primary {
    background: var(--azure);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
    background: var(--azure-light);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; transform: translateY(-1px); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--surface); color: var(--text); }

/* ======================================================================
   Cards
   ====================================================================== */
.card,
.course-card,
.lab-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    color: var(--text);
}
.card:hover,
.course-card:hover,
.lab-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.card-body { padding: 1.25rem; }
.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text);
}
.card-text { color: var(--text-muted); font-size: 0.9375rem; }

/* Course / Lab card patterns */
.course-card__cover,
.lab-card__cover {
    height: 160px;
    background: linear-gradient(135deg, var(--azure-dark), var(--azure));
    position: relative;
}

.course-card__badge,
.lab-card__badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.25rem 0.625rem;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 4px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

/* ======================================================================
   Forms
   ====================================================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-soft-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color .15s ease, background .15s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--azure);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder, textarea::placeholder { color: var(--text-subtle); }

label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.form-group { margin-bottom: 1rem; }
.form-help { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ======================================================================
   Tables
   ====================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
html[dir="rtl"] th, html[dir="rtl"] td { text-align: right; }
th {
    background: var(--bg-soft-2);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

/* ======================================================================
   Mobile Nav
   ====================================================================== */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    margin-left: auto;
}
.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 100vw);
    height: 100vh;
    background: var(--bg-soft);
    border-left: 1px solid var(--border);
    z-index: 200;
    transform: translateX(110%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;
}
html[dir="rtl"] .mobile-nav {
    right: auto;
    left: 0;
    border-left: 0;
    border-right: 1px solid var(--border);
    transform: translateX(-110%);
}
.mobile-nav.is-open { transform: translateX(0); }

.mobile-nav__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.mobile-nav__close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-nav__close:hover { background: var(--surface); }

.mobile-nav__links {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
}

.m-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.875rem;
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: start;
    width: 100%;
}
.m-link:hover {
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}
.m-link--admin {
    color: var(--yellow);
    border: 1px solid rgba(230, 180, 80, 0.25);
}
.m-link--logout { color: var(--text-muted); }
.m-link--cta {
    background: var(--azure);
    color: #fff;
    justify-content: center;
    margin-top: 0.25rem;
}
.m-link--cta:hover { background: var(--azure-light); color: #fff; }

.m-sep {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 0.5rem 0;
}

.lang-switcher--mobile { margin: 0.25rem 0.875rem; align-self: flex-start; }

.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 150;
    opacity: 0;
    transition: opacity .25s ease;
}
.mobile-nav-backdrop.is-visible { opacity: 1; }

/* ======================================================================
   Flash messages
   ====================================================================== */
.flash {
    margin: 1rem auto;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid;
}
.flash--success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}
.flash--error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}
.flash--info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}
.flash--warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

/* ======================================================================
   Footer
   ====================================================================== */
.site-footer {
    margin-top: 5rem;
    padding: 2.5rem 0 2rem;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}
.site-footer__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem 2.5rem;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}
.site-footer__brand {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.site-footer__brand strong { color: var(--text); font-size: 1rem; }
.site-footer__brand .muted { font-size: 0.8125rem; }

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}
.site-footer__links a {
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 0.25rem 0;
    text-decoration: none;
}
.site-footer__links a:hover { color: var(--text); text-decoration: none; }

.site-footer__copy {
    grid-column: 1 / -1;
    text-align: center;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
}

/* ======================================================================
   Hero / Marketing sections
   ====================================================================== */
.hero {
    padding: 4rem 0;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--text);
}
.hero p { font-size: 1.125rem; color: var(--text-muted); }

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

@media (max-width: 768px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
}

/* ======================================================================
   Pricing cards (Labs page)
   ====================================================================== */
.pricing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem;
    text-align: center;
    transition: transform .2s ease, border-color .2s ease;
}
.pricing-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}
.pricing-card--featured {
    border-color: var(--yellow);
    box-shadow: 0 0 0 1px var(--yellow), 0 8px 24px rgba(230, 180, 80, 0.15);
}
.pricing-card__price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0.5rem 0;
}

/* ======================================================================
   Code blocks
   ====================================================================== */
code, pre {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.875em;
}
code {
    background: var(--surface-2);
    color: var(--azure-light);
    padding: 0.125em 0.375em;
    border-radius: 4px;
}
pre {
    background: var(--bg-soft-2);
    color: var(--text);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border);
}
pre code { background: transparent; padding: 0; color: inherit; }

/* ======================================================================
   Utility classes
   ====================================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none !important; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
}
.badge--success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge--warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge--danger  { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge--info    { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* ======================================================================
   Responsive
   ====================================================================== */
@media (max-width: 900px) {
    .site-nav { display: none; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
}

@media (max-width: 640px) {
    .container, .container-wide { padding: 0 1rem; }
    .brand__text { font-size: 0.875rem; }
    .site-footer__inner { grid-template-columns: 1fr; text-align: center; }
    .site-footer__links { justify-content: center; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.375rem; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


/* ========================================
   Admin Panel - Dark theme compatibility fix
   ======================================== */

.layout-admin,
.layout-admin .admin-main {
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --bg: #080c18;
  --bg-soft: #0d1224;
  --bg-soft-2: #111827;
  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.13);
  --surface: #0d1224;
  --surface-2: #111827;
  --surface-3: #1e293b;
  color: #f1f5f9;
}

.layout-admin table,
.layout-admin table td,
.layout-admin table th,
.layout-admin table tr,
.layout-admin p,
.layout-admin span:not(.badge),
.layout-admin h1,
.layout-admin h2,
.layout-admin h3,
.layout-admin h4,
.layout-admin label,
.layout-admin strong {
  color: #f1f5f9 !important;
}

.layout-admin .muted,
.layout-admin small.muted {
  color: #64748b !important;
}
