@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&family=Tajawal:wght@300;400;500;700;800&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navy:       #0d1b2e;
    --navy-mid:   #132238;
    --navy-light: #1a3050;
    --gold:       #c9a84c;
    --gold-light: #e8c97a;
    --gold-pale:  #f5e8c0;
    --cream:      #fdf8ef;
    --white:      #ffffff;
    --text:       #1a1a2e;
    --text-soft:  #4a5568;
    --border:     rgba(201,168,76,0.25);
    --shadow:     0 8px 32px rgba(13,27,46,0.15);
    --shadow-lg:  0 20px 60px rgba(13,27,46,0.22);
}

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    direction: rtl;
    background: var(--navy);
    color: var(--text);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ─── Animated Background ─── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(201,168,76,0.07) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 90%, rgba(26,48,80,0.8) 0%, transparent 60%),
        linear-gradient(160deg, #0d1b2e 0%, #132238 40%, #0a1520 100%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(201,168,76,0.08) 1px, transparent 0);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 50px;
}

/* ─── Header ─── */
.site-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(201,168,76,0.15);
    position: relative;
    overflow: hidden;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 200px; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(201,168,76,0.04));
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(201,168,76,0.3));
    flex: 0 0 auto;
    border-radius: 12px;
}

.header-title h1 {
    color: var(--white);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.header-title p {
    color: var(--gold-light);
    font-size: 13px;
    font-weight: 400;
    margin-top: 3px;
    opacity: 0.85;
}

/* ─── Card ─── */
.card {
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(201,168,76,0.1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
    border-radius: 20px 20px 0 0;
}

.card-title {
    color: var(--navy);
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 5px;
}

.card-subtitle {
    color: var(--text-soft);
    font-size: 14px;
    margin: 0 0 24px;
}

/* ─── Alerts ─── */
.alert {
    padding: 13px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert::before {
    font-size: 18px;
    flex: 0 0 auto;
}

.alert-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-success::before { content: '✅'; }

.alert-error {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6);
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.alert-error::before { content: '⚠️'; }

/* ─── Form ─── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full {
    grid-column: span 2;
}

label {
    font-weight: 600;
    color: var(--navy);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.required {
    color: #dc2626;
    font-size: 16px;
}

input[type="text"],
input[type="url"],
input[type="file"],
select {
    width: 100%;
    min-height: 48px;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    background: #fafbfc;
    color: var(--text);
    transition: all 0.25s ease;
}

input:focus,
select:focus {
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(201,168,76,0.12);
}

input:hover,
select:hover {
    border-color: #a0aec0;
}

.note {
    color: var(--text-soft);
    font-size: 12px;
}

/* Radio Options */
.radio-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-option {
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 150px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    color: var(--navy);
    font-size: 14px;
}

.radio-option:hover {
    border-color: var(--gold);
    background: #fffbf0;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    min-height: auto;
    accent-color: var(--gold);
    cursor: pointer;
}

/* ─── Buttons ─── */
.actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 11px 22px;
    border-radius: 12px;
    border: 0;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s ease;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--navy-light), var(--navy));
    color: #fff;
    box-shadow: 0 4px 14px rgba(13,27,46,0.25);
}

.btn:hover {
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(13,27,46,0.35);
}

.btn:active {
    transform: translateY(0);
}

.btn.gold {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    color: var(--navy);
    box-shadow: 0 4px 14px rgba(201,168,76,0.35);
}

.btn.gold:hover {
    background: linear-gradient(135deg, var(--gold), #b8922e);
    box-shadow: 0 8px 22px rgba(201,168,76,0.45);
}

.btn.secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: #fff;
    box-shadow: 0 4px 14px rgba(71,85,105,0.3);
}

.btn.secondary:hover {
    background: linear-gradient(135deg, #475569, #334155);
}

.btn.light {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: none;
    backdrop-filter: blur(10px);
}

.btn.light:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(201,168,76,0.5);
}

/* ─── Toolbar & Table ─── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search {
    min-width: 280px;
    flex: 1;
    max-width: 420px;
}

.search input {
    background: #f8fafc;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
    border: 1.5px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

th {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: var(--gold-light);
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

th:first-child { border-radius: 0 12px 0 0; }
th:last-child  { border-radius: 12px 0 0 0; }

td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f3f5;
    text-align: right;
    font-size: 14px;
    color: var(--text);
    transition: background 0.15s;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
    background: linear-gradient(135deg, #fdf8ef, #fefce8);
}

.name-link {
    color: var(--navy);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s;
}

.name-link:hover {
    color: var(--gold);
    text-decoration: underline;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--gold-pale), #f0dba0);
    color: #7a4f00;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid rgba(201,168,76,0.3);
}

.empty {
    padding: 40px;
    text-align: center;
    color: var(--text-soft);
    font-size: 15px;
}

/* ─── Row number ─── */
td:first-child {
    color: #9ca3af;
    font-size: 13px;
}

/* ─── A4 Print ─── */
.print-actions {
    width: 210mm;
    margin: 20px auto 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.a4 {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 40px;
    background: #fff;
    padding: 14mm;
    box-shadow: var(--shadow-lg);
    border-radius: 4px;
    position: relative;
    z-index: 1;
}

.a4-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 3px solid var(--navy);
    padding-bottom: 12px;
    margin-bottom: 20px;
    position: relative;
}

.a4-header::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    left: 0;
    height: 1.5px;
    background: linear-gradient(90deg, var(--gold), transparent);
}

.a4-logo {
    width: 75px;
    height: 75px;
    object-fit: contain;
}

.a4-header h2 {
    color: var(--navy);
    font-size: 24px;
    font-weight: 800;
    margin: 0;
}

.a4-header p {
    color: var(--gold);
    font-size: 14px;
    margin: 4px 0 0;
    font-weight: 600;
}

.a4-body {
    display: grid;
    grid-template-columns: 4cm 1fr;
    gap: 18px;
    align-items: start;
}

.photo {
    width: 4cm;
    height: 6cm;
    border: 2px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 13px;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-item {
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 60px;
    background: #fafbfc;
}

.info-item.full {
    grid-column: span 2;
}

.info-item strong {
    display: block;
    color: var(--navy);
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.info-item span {
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    font-weight: 600;
    color: var(--text);
}

.a4-footer {
    margin-top: 22px;
    border-top: 1px dashed #d1d5db;
    padding-top: 10px;
    color: var(--text-soft);
    text-align: center;
    font-size: 12px;
}

/* ─── Section separator in card ─── */
.section-sep {
    height: 1px;
    background: linear-gradient(90deg, var(--gold-pale), transparent);
    margin: 20px 0;
}

/* ─── Print media ─── */
@page {
    size: A4;
    margin: 10mm;
}

@media print {
    body {
        background: #fff;
    }

    body::before,
    body::after {
        display: none;
    }

    .print-actions {
        display: none;
    }

    .a4 {
        box-shadow: none;
        margin: 0;
        width: 100%;
        min-height: auto;
        padding: 0;
        border-radius: 0;
    }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 20px;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .header-title h1 {
        font-size: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: span 1;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search {
        min-width: unset;
        max-width: 100%;
    }

    .a4,
    .print-actions {
        width: calc(100% - 16px);
    }

    .a4-body {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-item.full {
        grid-column: span 1;
    }

    .a4-header {
        align-items: center;
    }
}

/* ─── Action Buttons in Table ─── */
.action-btns {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-sm {
    min-height: 36px;
    padding: 7px 13px;
    font-size: 13px;
    border-radius: 9px;
}

.btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}

.btn.danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 6px 18px rgba(220,38,38,0.4);
}

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

/* ─── Responsive table columns ─── */
@media (max-width: 900px) {
    .hide-sm { display: none; }
    table { min-width: 500px; }
}

@media (max-width: 600px) {
    .hide-mobile { display: none; }
    table { min-width: 320px; }

    .action-btns {
        flex-direction: column;
        gap: 5px;
    }

    .btn-sm {
        width: 100%;
        justify-content: center;
        min-height: 34px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ─── Confirm Dialog ─── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13,27,46,0.75);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.confirm-box {
    background: #fff;
    border-radius: 20px;
    padding: 36px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 30px 80px rgba(13,27,46,0.4);
    animation: slideUp 0.25s ease;
    border-top: 4px solid #ef4444;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 14px;
    line-height: 1;
}

.confirm-title {
    color: var(--navy);
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 10px;
}

.confirm-msg {
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 26px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.confirm-actions .btn {
    min-width: 130px;
}

.btn.light-outline {
    background: transparent;
    color: var(--text-soft);
    border: 1.5px solid #d1d5db;
    box-shadow: none;
}

.btn.light-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: none;
}

/* ─── Mobile header: hide subtitle on very small ─── */
@media (max-width: 480px) {
    .header-title p {
        display: none;
    }
    .header-title h1 {
        font-size: 16px;
    }
    .logo {
        width: 52px;
        height: 52px;
    }
    .card {
        padding: 18px 14px;
    }
    .confirm-box {
        padding: 28px 20px;
    }
}

/* ─── Status badges ─── */
.status-badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.status-pending  { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.status-approved { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.status-rejected { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ─── Approve / Reject / Undo buttons ─── */
.approve-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 3px 10px rgba(22,163,74,0.3);
}
.approve-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    box-shadow: 0 5px 14px rgba(22,163,74,0.4);
}
.reject-btn {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
    box-shadow: 0 3px 10px rgba(239,68,68,0.3);
}
.reject-btn:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 5px 14px rgba(239,68,68,0.4);
}
.undo-btn {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #fff;
    box-shadow: 0 3px 10px rgba(100,116,139,0.25);
}
.undo-btn:hover {
    background: linear-gradient(135deg, #64748b, #475569);
}

/* ─── Approved page header ─── */
.approved-header {
    border-top: 6px solid #22c55e !important;
}
.approved-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(22,163,74,0.35) !important;
}
.approved-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
}

/* ─── Approved page banner ─── */
.approved-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(135deg, rgba(34,197,94,0.12), rgba(22,163,74,0.06));
    border: 1.5px solid rgba(34,197,94,0.35);
    border-radius: 18px;
    padding: 20px 28px;
    margin-bottom: 22px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(22,163,74,0.1);
}
.approved-banner-icon {
    font-size: 44px;
    line-height: 1;
}
.approved-banner-num {
    color: #fff;
    font-size: 38px;
    font-weight: 900;
    line-height: 1;
}
.approved-banner-label {
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    margin-top: 4px;
}

/* ─── Approved rows highlight ─── */
.approved-row:hover td {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7) !important;
}

/* ─── Stats bar ─── */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 24px;
    margin-bottom: 22px;
    backdrop-filter: blur(12px);
    flex-wrap: wrap;
    row-gap: 10px;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    gap: 3px;
}
.stat-num {
    color: #fff;
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
}
.stat-label {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    text-align: center;
}
.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.12);
    flex: 0 0 auto;
    margin: 0 8px;
}
.approved-color  { color: #4ade80 !important; }
.rejected-color  { color: #f87171 !important; }
.pending-color   { color: #fbbf24 !important; }

@media (max-width: 500px) {
    .stats-bar { padding: 12px 14px; }
    .stat-num  { font-size: 22px; }
    .stat-divider { height: 30px; }
    .approved-banner { padding: 16px 18px; }
    .approved-banner-num { font-size: 28px; }
    .approved-banner-icon { font-size: 32px; }
}
