/* =================================================================
   BASELINE v3.0.0 — Unified Design (Emirati Identity)
   Project: نظام إدارة الحكام والبطولات
   Theme:   Dark Navy + Emirati Gold + Cairo Arabic
   ================================================================= */

/* --- Cairo Font (Local Only) --- */
@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo-Light.ttf') format('truetype');
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo-Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo-Black.ttf') format('truetype');
    font-weight: 900;
    font-display: swap;
}

/* --- Design Tokens (UAE Identity) --- */
:root {
    /* Primary Palette */
    --uae-gold:        #c8a84e;
    --uae-gold-light:  #e0c060;
    --uae-gold-dark:   #a8882e;
    --uae-green:       #00732f;       /* UAE flag green */
    --uae-red:         #ce1126;       /* UAE flag red */
    --uae-black:       #000000;
    --uae-white:       #ffffff;

    /* Surfaces */
    --bg-primary:      #0a0f1a;
    --bg-card:         #111827;
    --bg-input:        #0d1321;
    --bg-elevated:     #1a2332;

    /* Text */
    --text-white:      #f0f0f0;
    --text-muted:      #7a8ba0;
    --text-dim:        #4a5568;

    /* Borders */
    --border-color:    #1e2a42;
    --border-light:    #2a3a55;

    /* Status */
    --success:         #22c55e;
    --warning:         #f59e0b;
    --danger:          #ef4444;
    --info:            #3b82f6;

    /* Spacing & radius */
    --radius-sm:       6px;
    --radius-md:       10px;
    --radius-lg:       16px;
    --radius-xl:       24px;

    /* Shadows */
    --shadow-sm:       0 2px 8px rgba(0,0,0,0.2);
    --shadow-md:       0 4px 20px rgba(0,0,0,0.3);
    --shadow-lg:       0 20px 60px rgba(0,0,0,0.4);
    --shadow-gold:     0 0 30px rgba(200, 168, 78, 0.25);

    /* Layout */
    --header-h:        70px;
    --sidebar-w:       260px;
    --content-max:     1400px;
}

/* --- Bootstrap variable overrides --- */
:root {
    --bs-primary:        var(--uae-gold);
    --bs-primary-rgb:    200, 168, 78;
    --bs-body-font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bs-body-bg:        var(--bg-primary);
    --bs-body-color:     var(--text-white);
    --bs-border-color:   var(--border-color);
    --bs-border-radius:  var(--radius-md);
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-white);
    direction: rtl;
    text-align: right;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--uae-gold); text-decoration: none; transition: color .2s; }
a:hover { color: var(--uae-gold-light); }

h1, h2, h3, h4, h5, h6 { color: var(--text-white); font-weight: 700; }

/* --- Cards --- */
.card,
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    color: var(--text-white);
}
.card-header,
.app-card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
    color: var(--uae-gold);
    font-weight: 700;
}

/* --- Buttons (gold) --- */
.btn {
    font-family: inherit;
    border-radius: var(--radius-md);
    padding: 10px 22px;
    font-weight: 600;
    transition: all .25s;
    border: 1.5px solid transparent;
}
.btn-primary, .btn-gold {
    background: linear-gradient(135deg, var(--uae-gold), var(--uae-gold-light));
    color: var(--bg-primary);
    border-color: var(--uae-gold);
}
.btn-primary:hover, .btn-gold:hover {
    background: linear-gradient(135deg, var(--uae-gold-light), var(--uae-gold));
    color: var(--bg-primary);
    box-shadow: var(--shadow-gold);
    transform: translateY(-1px);
}
.btn-outline-gold {
    background: transparent;
    color: var(--uae-gold);
    border-color: var(--uae-gold);
}
.btn-outline-gold:hover {
    background: rgba(200, 168, 78, 0.1);
    color: var(--uae-gold-light);
}
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #000; }
.btn-secondary {
    background: var(--bg-elevated);
    border-color: var(--border-light);
    color: var(--text-white);
}

/* --- Forms --- */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-white);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all .25s;
}
.form-control:focus, .form-select:focus {
    background: var(--bg-input);
    border-color: var(--uae-gold);
    color: var(--text-white);
    box-shadow: 0 0 0 3px rgba(200, 168, 78, 0.15);
    outline: none;
}
.form-control::placeholder { color: var(--text-dim); }
.form-label {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
}

/* --- Tables --- */
.table {
    color: var(--text-white);
    background: transparent;
    border-collapse: separate;
    border-spacing: 0;
}
.table thead th {
    background: var(--bg-elevated);
    color: var(--uae-gold);
    border-bottom: 2px solid var(--uae-gold);
    font-weight: 700;
    padding: 14px;
    text-align: right;
}
.table tbody td {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 14px;
    color: var(--text-white);
}
.table tbody tr:hover td {
    background: var(--bg-elevated);
}

/* --- Alerts --- */
.alert {
    border-radius: var(--radius-md);
    padding: 14px 18px;
    border: 1px solid;
    font-weight: 600;
}
.alert-success { background: rgba(34, 197, 94, 0.1);  border-color: rgba(34, 197, 94, 0.4);  color: #86efac; }
.alert-danger  { background: rgba(239, 68, 68, 0.1);  border-color: rgba(239, 68, 68, 0.4);  color: #fca5a5; }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
.alert-info    { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.4); color: #93bbfd; }

/* --- Badges --- */
.badge {
    border-radius: 20px;
    padding: 4px 12px;
    font-weight: 600;
    font-size: 0.78rem;
}
.badge.bg-gold { background: var(--uae-gold) !important; color: var(--bg-primary); }

/* --- Navbar / Header --- */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.app-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--uae-gold);
    font-weight: 800;
    font-size: 1.15rem;
}
.app-header .brand .logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--uae-gold), var(--uae-gold-dark));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
    font-size: 1.2rem;
}

/* --- Container --- */
.app-container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 28px 20px;
}

/* --- Stat tiles --- */
.stat-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    text-align: center;
    transition: transform .25s, border-color .25s;
}
.stat-tile:hover {
    transform: translateY(-3px);
    border-color: var(--uae-gold);
}
.stat-tile .num {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--uae-gold);
    margin: 6px 0;
}
.stat-tile .lbl {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* --- Modal --- */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-white);
}
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }

/* --- Scrollbars --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--uae-gold-dark); }

/* --- Utilities --- */
.text-gold    { color: var(--uae-gold) !important; }
.text-muted2  { color: var(--text-muted) !important; }
.bg-elevated  { background: var(--bg-elevated) !important; }
.border-gold  { border-color: var(--uae-gold) !important; }

/* --- Top decorative gold bar (page header) --- */
.app-card.has-gold-top { position: relative; overflow: hidden; }
.app-card.has-gold-top::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--uae-gold-dark), var(--uae-gold), var(--uae-gold-dark));
}

/* --- Logout / icon button --- */
.icon-btn {
    width: 42px; height: 42px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .25s;
}
.icon-btn:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root { --header-h: 60px; }
    .app-container { padding: 18px 12px; }
    .card, .app-card { padding: 18px; }
    .stat-tile .num { font-size: 1.8rem; }
}
