:root {
    --bg-main: #020617;
    --bg-card: rgba(15, 23, 42, 0.88);
    --bg-input: rgba(255, 255, 255, 0.06);
    --border-color: rgba(148, 163, 184, 0.18);
    --primary: #38bdf8;
    --primary-dark: #0ea5e9;
    --text-main: #f8fafc;
    --text-soft: #94a3b8;
    --text-muted: #64748b;
    --error: #ef4444;
    --success: #22c55e;
    --warning-bg: rgba(239, 68, 68, 0.12);
    --success-bg: rgba(34, 197, 94, 0.12);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', sans-serif;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 25%),
        radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.12), transparent 30%),
        linear-gradient(135deg, #020617, #0f172a 45%, #111827);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.container {
    width: min(1100px, 92%);
    margin-inline: auto;
}

.page-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.25;
}

.shape-1 {
    width: 260px;
    height: 260px;
    background: #38bdf8;
    top: 80px;
    right: 40px;
}

.shape-2 {
    width: 220px;
    height: 220px;
    background: #0ea5e9;
    bottom: 100px;
    left: 40px;
}

.shape-3 {
    width: 180px;
    height: 180px;
    background: #1d4ed8;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.main-header {
    position: relative;
    z-index: 2;
    padding: 22px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    background: rgba(2, 6, 23, 0.45);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 22px;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.35);
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

.logo-title strong {
    color: var(--primary);
}

.logo-text small {
    color: var(--text-soft);
    font-size: 13px;
}

.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-soft);
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
}

/* صفحة التسجيل */
.login-page {
    position: relative;
    z-index: 2;
    min-height: calc(100vh - 170px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 15px;
}

.login-section {
    width: 100%;
    display: flex;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 720px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 35px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-circle {
    width: 90px;
    height: 90px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 36px;
    color: var(--primary);
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.18);
    box-shadow: inset 0 0 25px rgba(56, 189, 248, 0.08);
}

.login-header h1 {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.8;
}

.flash-wrapper {
    margin-bottom: 18px;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
    margin-bottom: 10px;
}

.flash-message.error {
    background: var(--warning-bg);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fecaca;
}

.flash-message.success {
    background: var(--success-bg);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #bbf7d0;
}

.login-form {
    width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 600;
}

.input-group label i {
    color: var(--primary);
}

.input-group input {
    width: 100%;
    height: 52px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    padding: 0 16px;
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.input-group input::placeholder {
    color: #7c8aa0;
}

.input-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.input-group.error input {
    border-color: var(--error);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.hint {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
    padding-right: 3px;
}

.error-text {
    color: #fca5a5;
    font-size: 12px;
    min-height: 16px;
}

.form-actions {
    margin-top: 28px;
}

.login-btn,
.back-btn {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 14px 30px rgba(14, 165, 233, 0.3);
    text-decoration: none;
}

.login-btn:hover,
.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 35px rgba(14, 165, 233, 0.38);
}

.login-btn.loading {
    opacity: 0.8;
    pointer-events: none;
}

.main-footer {
    position: relative;
    z-index: 2;
    padding: 20px 0 28px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.footer-content p {
    color: var(--text-soft);
    font-size: 14px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    flex-wrap: wrap;
    justify-content: center;
}

.separator {
    opacity: 0.5;
}

/* صفحة الفيديو */
.training-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
    position: relative;
    z-index: 2;
}

.training-card {
    width: 100%;
    max-width: 900px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.training-header {
    margin-bottom: 24px;
}

.training-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.training-header p {
    color: #94a3b8;
    line-height: 2;
    font-size: 16px;
}

.video-wrapper {
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: #000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.video-wrapper video {
    width: 100%;
    display: block;
    max-height: 520px;
    background: #000;
}

.video-note {
    margin-top: 18px;
    color: #cbd5e1;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}

.certificate-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.hidden-btn {
    opacity: 0.45;
    pointer-events: none;
}

/* صفحة الشهادة */
.certificate-page-body {
    background: #f8fafc;
    font-family: 'Tajawal', sans-serif;
}

.certificate-page {
    min-height: 100vh;
    padding: 30px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.certificate-box {
    width: 100%;
    max-width: 1100px;
}

.certificate-border {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 14px solid #d4af37;
    padding: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.certificate-content {
    border: 3px solid #1e293b;
    padding: 50px 40px;
    text-align: center;
    background: white;
}

.certificate-top h1 {
    font-size: 52px;
    color: #0f172a;
    margin-bottom: 10px;
    font-weight: 800;
}

.certificate-top h2 {
    font-size: 24px;
    color: #64748b;
    margin-bottom: 35px;
    font-weight: 700;
}

.certificate-text {
    font-size: 22px;
    color: #334155;
    margin: 16px 0;
}

.trainee-name {
    font-size: 42px;
    color: #0ea5e9;
    margin: 20px 0;
    font-weight: 800;
}

.trainee-id {
    font-size: 30px;
    color: #0f172a;
    margin: 18px 0;
    font-weight: 700;
}

.certificate-course {
    font-size: 30px;
    color: #16a34a;
    margin: 26px 0 36px;
    font-weight: 800;
}

.certificate-meta {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 40px;
    text-align: center;
    flex-wrap: wrap;
}

.certificate-meta div {
    flex: 1;
    min-width: 250px;
}

.certificate-meta span {
    display: block;
    font-size: 16px;
    color: #64748b;
    margin-bottom: 10px;
}

.certificate-meta strong {
    font-size: 22px;
    color: #0f172a;
}

.certificate-signature {
    margin-top: 50px;
    display: flex;
    justify-content: center;
}

.sign-box {
    border-top: 2px solid #334155;
    padding-top: 12px;
    min-width: 220px;
}

.sign-box span {
    display: block;
    color: #64748b;
    margin-bottom: 8px;
}

.sign-box strong {
    color: #0f172a;
    font-size: 20px;
}

.certificate-print-actions {
    margin-top: 22px;
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.print-btn,
.back-btn {
    width: auto;
    min-width: 220px;
    padding: 0 22px;
}

/* صفحة النجاح */
.success-page-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.success-card {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    box-shadow: var(--shadow);
    text-align: center;
}

.success-icon {
    font-size: 72px;
    color: var(--success);
    margin-bottom: 20px;
}

.success-card h1 {
    font-size: 32px;
    margin-bottom: 14px;
}

.success-card p {
    color: var(--text-soft);
    line-height: 2;
    margin-bottom: 26px;
    font-size: 16px;
}

@media print {
    body {
        background: white !important;
    }

    .no-print {
        display: none !important;
    }

    .certificate-page {
        padding: 0;
    }

    .certificate-border {
        box-shadow: none;
        margin: 0;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-card,
    .training-card {
        padding: 24px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .login-header h1,
    .success-card h1,
    .training-header h1 {
        font-size: 24px;
    }

    .logo-title {
        font-size: 20px;
    }

    .certificate-content {
        padding: 30px 20px;
    }

    .certificate-top h1 {
        font-size: 34px;
    }

    .certificate-top h2 {
        font-size: 18px;
    }

    .trainee-name {
        font-size: 28px;
    }

    .certificate-text,
    .certificate-course,
    .trainee-id {
        font-size: 20px;
    }

    .certificate-meta {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .login-page {
        padding: 30px 12px;
    }

    .login-card,
    .success-card {
        padding: 20px 16px;
        border-radius: 18px;
    }

    .logo-circle {
        width: 76px;
        height: 76px;
        font-size: 30px;
    }

    .login-btn,
    .back-btn {
        height: 52px;
        font-size: 15px;
    }
}


/* admin login */
.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 2;
}

.admin-login-card {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 35px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

/* dashboard */
.dashboard-page {
    min-height: 100vh;
    padding: 30px 15px;
    position: relative;
    z-index: 2;
}

.dashboard-container {
    width: min(1400px, 95%);
    margin: 0 auto;
}

.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.dashboard-topbar h1 {
    font-size: 34px;
    margin-bottom: 8px;
}

.dashboard-topbar p {
    color: var(--text-soft);
}

.dashboard-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.small-btn {
    width: auto;
    min-width: 160px;
    padding: 0 18px;
    height: 48px;
}

.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 14px 30px rgba(220, 38, 38, 0.28);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-card strong {
    font-size: 38px;
    display: block;
    margin-top: 12px;
}

.stat-label {
    color: var(--text-soft);
    font-size: 15px;
}

.success-card-lite strong {
    color: #22c55e;
}

.warning-card-lite strong {
    color: #f59e0b;
}

.search-card,
.table-card {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.search-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1;
    min-width: 250px;
    height: 50px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    padding: 0 16px;
    font-size: 15px;
    outline: none;
}

.table-responsive {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.dashboard-table thead th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    padding: 16px 14px;
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-table tbody td {
    padding: 16px 14px;
    text-align: center;
    color: var(--text-soft);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

.status-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-badge.done {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.table-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 110px;
    height: 40px;
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.view-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.watch-btn {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.empty-cell {
    padding: 30px !important;
    text-align: center;
    color: var(--text-soft);
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.admin-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s ease;
}

.admin-link-btn:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: var(--primary);
    color: var(--primary);
}