/* ===== GhaniCode System - Main Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --primary-dark: #0d1562;
    --secondary: #00bcd4;
    --accent: #ff6f00;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #f57f17;
    --info: #0277bd;
    --light: #f8f9fa;
    --dark: #1a1a2e;
    --sidebar-width: 260px;
    --topbar-height: 65px;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 32px rgba(0,0,0,0.14);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', sans-serif;
    background: #f0f2f8;
    color: #2c3e50;
    direction: rtl;
    text-align: right;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
#sidebar {
    position: fixed;
    top: 0; right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 40%, var(--primary-light) 100%);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.15);
}

.sidebar-brand .logo-text {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    display: block;
    line-height: 1.2;
}

.sidebar-brand .logo-sub {
    color: rgba(255,255,255,0.6);
    font-size: 0.72rem;
    font-weight: 400;
}

.sidebar-brand .logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-left: 10px;
    flex-shrink: 0;
}

.sidebar-user {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--secondary), #0097a7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user .user-info .name {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-user .user-info .role {
    color: rgba(255,255,255,0.55);
    font-size: 0.72rem;
}

.sidebar-menu { padding: 10px 0 20px; }

.menu-section {
    padding: 12px 20px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.8) !important;
    text-decoration: none !important;
    transition: var(--transition);
    border-radius: 0;
    font-size: 0.88rem;
    font-weight: 500;
    position: relative;
    margin: 1px 8px;
    border-radius: 8px;
}

.nav-link:hover, .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.12);
}

.nav-link.active {
    background: linear-gradient(90deg, var(--secondary), #0097a7) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0,188,212,0.3);
}

.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-link .badge-count {
    margin-right: auto;
    margin-left: 0;
    background: var(--accent);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
}

/* ===== MAIN CONTENT ===== */
#main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ===== TOPBAR ===== */
#topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e8eaf0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    gap: 12px;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid #e8eaf0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.topbar-btn .notif-dot {
    position: absolute;
    top: 4px; left: 4px;
    width: 8px; height: 8px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid #eef0f8;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }
.stat-card.info::before    { background: var(--info); }
.stat-card.accent::before  { background: var(--accent); }

.stat-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 14px;
}

.stat-icon.primary { background: rgba(26,35,126,0.1); color: var(--primary); }
.stat-icon.success { background: rgba(46,125,50,0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245,127,23,0.1); color: var(--warning); }
.stat-icon.danger  { background: rgba(198,40,40,0.1); color: var(--danger); }
.stat-icon.info    { background: rgba(2,119,189,0.1); color: var(--info); }
.stat-icon.accent  { background: rgba(255,111,0,0.1); color: var(--accent); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.82rem;
    color: #888;
    font-weight: 500;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: var(--border-radius) !important;
    border: 1px solid #eef0f8 !important;
    box-shadow: var(--shadow) !important;
}

.card-header {
    background: #fff !important;
    border-bottom: 1px solid #eef0f8 !important;
    padding: 16px 20px !important;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-body { padding: 20px !important; }

/* ===== TABLE ===== */
.table-wrapper {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid #eef0f8;
    overflow: hidden;
}

.table { margin-bottom: 0 !important; }

.table thead th {
    background: #f5f7ff;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.82rem;
    border-bottom: 2px solid #e0e4f8;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 0.88rem;
    border-color: #f0f2f8;
}

.table tbody tr:hover { background: #f8f9ff; }

/* ===== FORMS ===== */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 6px;
}

.form-control, .form-select {
    border: 1.5px solid #e0e4f0;
    border-radius: 8px !important;
    padding: 9px 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: 8px !important;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    padding: 8px 18px;
    font-size: 0.88rem;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
    border: none !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important;
    box-shadow: 0 4px 14px rgba(26,35,126,0.35) !important;
    transform: translateY(-1px);
}

.btn-sm { padding: 5px 12px !important; font-size: 0.8rem !important; }
.btn-icon { width: 32px; height: 32px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; }

/* ===== BADGES ===== */
.badge { font-family: 'Tajawal', sans-serif; font-weight: 600; font-size: 0.75rem; padding: 4px 10px; border-radius: 20px; }

/* ===== SEARCH BAR ===== */
.search-bar {
    position: relative;
}
.search-bar .form-control {
    padding-right: 38px;
}
.search-bar .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 0.9rem;
}

/* ===== PROGRESS BARS ===== */
.progress { border-radius: 10px; background: #eef0f8; }
.progress-bar { border-radius: 10px; font-size: 0.7rem; font-weight: 700; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-circle {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 12px;
}

.login-logo h2 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.login-logo p {
    font-size: 0.82rem;
    color: #888;
}

/* ===== CLIENT PORTAL ===== */
.client-topbar {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.client-content { padding: 24px; max-width: 1100px; margin: 0 auto; }

.plan-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 16px;
    padding: 28px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.plan-card::before {
    content: '💎';
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 3rem;
    opacity: 0.15;
}

.phase-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f2f8;
}

.phase-item:last-child { border-bottom: none; }

.phase-number {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.phase-number.done { background: var(--success); color: #fff; }
.phase-number.active { background: var(--primary); color: #fff; }
.phase-number.pending { background: #e0e4f0; color: #888; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #sidebar { transform: translateX(100%); }
    #sidebar.show { transform: translateX(0); }
    #main-content { margin-right: 0; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.4s ease forwards; }

/* ===== MISC ===== */
.text-primary { color: var(--primary) !important; }
.bg-primary   { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }
hr { border-color: #eef0f8; }
.cursor-pointer { cursor: pointer; }
.fs-xs { font-size: 0.75rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ===== CHART WRAPPER ===== */
.chart-container { position: relative; height: 260px; }

/* ===== NOTIFICATION ===== */
.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f8;
    transition: var(--transition);
}
.notif-item:hover { background: #f8f9ff; }
.notif-item.unread { background: #f0f4ff; }
.notif-dot { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
