:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #10b981;
    --border: #334155;
    --vip-gold: #f59e0b;
    --vip-gold-glow: #fbbf24;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ================= Preloader الفاخر بالدوائر الثلاثية واللوجو الكبير ================= */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #0b1329;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
}

.preloader-large-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    z-index: 10;
    filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.4));
    animation: logoPulse 2s ease-in-out infinite;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

.ring-1 {
    width: 170px;
    height: 170px;
    border-top-color: #10b981;
    border-bottom-color: #10b981;
    animation: spinClockwise 2s linear infinite;
}

.ring-2 {
    width: 155px;
    height: 155px;
    border-right-color: #3b82f6;
    border-left-color: #3b82f6;
    animation: spinCounterClockwise 1.5s linear infinite;
}

.ring-3 {
    width: 140px;
    height: 140px;
    border-top-color: #f59e0b;
    border-left-color: #f59e0b;
    animation: spinClockwise 1s linear infinite;
}

@keyframes spinClockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinCounterClockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes logoPulse {
    0%, 100% { transform: scale(0.96); }
    50% { transform: scale(1.04); }
}

.preloader-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.preloader-slogan {
    font-size: 15px;
    color: var(--vip-gold-glow);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.dots-loading {
    font-size: 13px;
    color: var(--text-muted);
}

.dots-loading span {
    animation: blink 1.4s infinite both;
    font-size: 16px;
}

.dots-loading span:nth-child(2) { animation-delay: .2s; }
.dots-loading span:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--card-bg);
    border-left: 1px solid var(--border);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.logo-text h2 { font-size: 15px; color: var(--accent); }
.logo-text span { font-size: 11px; color: var(--text-muted); }

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--accent);
    color: #fff;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.stat-title { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 15px; font-weight: bold; }

.text-green { color: #10b981; }
.text-red { color: #ef4444; }
.text-orange { color: #f59e0b; }
.text-blue { color: #3b82f6; }

/* VIP Client Styling */
.vip-client-name {
    color: var(--vip-gold-glow) !important;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.normal-client-name {
    color: #ffffff !important;
}

/* أزرار الفلترة فوق جدول العملاء */
.filter-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.filter-btn:hover {
    color: #fff;
}

.filter-btn.active {
    background: var(--card-bg);
    color: var(--accent);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Double Grids */
.double-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.table-card {
    background-color: var(--card-bg);
    padding: 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.table-card h3 { font-size: 15px; margin-bottom: 12px; color: var(--accent); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 10px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th { color: var(--text-muted); }

/* Buttons & Badges */
.btn-primary {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.badge {
    background: #334155;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Custom Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center;
    z-index: 100000;
    opacity: 0; visibility: hidden;
    transition: 0.3s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%; max-width: 500px; padding: 25px;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-close { font-size: 24px; color: var(--text-muted); cursor: pointer; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-control {
    background-color: var(--bg-color);
    border: 1px solid var(--border);
    color: var(--text-color);
    padding: 10px; border-radius: 6px; outline: none;
}

/* Calendar Grid Customization */
.calendar-grid-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.calendar-day-box {
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 95px;
    padding: 8px;
    cursor: pointer;
    transition: 0.2s;
    overflow: hidden;
}

.calendar-day-box:hover {
    border-color: var(--accent);
}

.calendar-day-box.past-day {
    opacity: 0.55;
    background-color: #162032;
}

.calendar-day-box.past-day::after {
    content: "✕";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50px;
    color: rgba(239, 68, 68, 0.25);
    font-weight: bold;
    pointer-events: none;
}

.calendar-day-box.vip-day {
    background: linear-gradient(135deg, #2a2010 0%, #1e293b 100%) !important;
    border: 1px solid var(--vip-gold) !important;
    box-shadow: inset 0 0 10px rgba(245, 158, 11, 0.2);
}

.calendar-day-box.vip-day .day-number {
    color: var(--vip-gold-glow) !important;
    text-shadow: 0 0 5px rgba(245, 158, 11, 0.5);
}

.day-number { font-weight: bold; color: var(--accent); margin-bottom: 5px; }

.task-pill {
    background: #334155;
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-pill.vip-task {
    background: var(--vip-gold);
    color: #000;
    font-weight: bold;
}