:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --sidebar-width: 280px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    direction: rtl;
}

* { box-sizing: border-box; }
a { text-decoration: none; color: inherit; }

/* Dashboard Layout */
.dashboard-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    right: 0;
    top: 0;
    z-index: 100;
}
.sidebar-header { padding: 2rem; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { margin: 0; font-size: 1.8rem; font-weight: 800; display: flex; align-items: center; gap: 0.5rem; }
.sidebar-header i { color: var(--primary); }
.sidebar-header span { color: var(--primary); }

.sidebar-menu { list-style: none; padding: 1.5rem 1rem; margin: 0; flex: 1; }
.sidebar-menu li { margin-bottom: 0.5rem; }
.sidebar-menu a {
    display: flex; align-items: center; gap: 1rem; padding: 1rem;
    border-radius: 12px; color: var(--text-muted); font-weight: 700;
    font-size: 1.05rem; transition: all 0.3s ease;
}
.sidebar-menu a i { font-size: 1.25rem; width: 25px; text-align: center; }
.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(59, 130, 246, 0.15); color: var(--primary);
}

.sidebar-footer { padding: 1.5rem; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; color: var(--text-main); font-weight: 700; }
.logout-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    width: 100%; padding: 0.85rem; border-radius: 12px;
    background-color: rgba(239, 68, 68, 0.1); color: var(--danger);
    font-weight: 700; transition: 0.3s;
}
.logout-btn:hover { background-color: var(--danger); color: #fff; }

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}
.topbar {
    height: 85px; background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border); display: flex;
    align-items: center; justify-content: space-between; padding: 0 2rem;
    position: sticky; top: 0; z-index: 99;
}
.topbar-title { font-size: 1.4rem; font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 1.5rem; }
.icon-btn { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; transition: 0.2s; }
.icon-btn:hover { color: var(--primary); }
.user-profile img { width: 45px; height: 45px; border-radius: 12px; }

.content-wrapper { padding: 2.5rem; flex: 1; }

/* Grid Components */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 1.5rem; }
.card {
    background-color: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 1.5rem; transition: transform 0.3s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2); }
.card-title { font-size: 1.15rem; color: #fff; margin-bottom: 1.5rem; margin-top:0; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; justify-content: space-between; }
.card-icon { width: 55px; height: 55px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; margin-bottom: 1.2rem; }
.bg-primary { background: rgba(59, 130, 246, 0.15); color: var(--primary); }
.bg-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.bg-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-title { font-size: 1rem; color: var(--text-muted); font-weight: 700; margin-bottom: 0.5rem; }
.stat-value { font-size: 2.2rem; font-weight: 800; display:flex; gap:0.3rem; align-items:baseline;}
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* Forms */
.form-group { margin-bottom: 1.8rem; }
.form-label { display: block; margin-bottom: 0.6rem; color: var(--text-muted); font-weight: 700; font-size: 1.05rem; }
.form-control {
    width: 100%; padding: 1rem 1.2rem; background-color: #0d121c;
    border: 1px solid var(--border); border-radius: 10px; color: var(--text-main);
    font-family: inherit; font-size: 1.05rem; transition: 0.3s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 1rem 2rem; border: none; border-radius: 10px; font-weight: 800; font-family: inherit;
    cursor: pointer; transition: 0.3s; font-size: 1.05rem; width: 100%;
}
.btn-primary { background: linear-gradient(to left, var(--primary), var(--primary-hover)); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35); transform: translateY(-2px); }

/* Tables */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1.2rem 1rem; text-align: right; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 700; font-size: 0.95rem; }
tr:hover td { background-color: rgba(255, 255, 255, 0.02); }
.badge { padding: 0.3rem 0.8rem; border-radius: 99px; font-size: 0.85rem; font-weight: 700; }
.badge-income { background-color: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.badge-expense { background-color: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }

/* Auth Layout */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: url('https://www.transparenttextures.com/patterns/cubes.png'), radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
}
.auth-card {
    background-color: var(--bg-card); width: 100%; max-width: 480px; padding: 3rem;
    border-radius: 20px; border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.auth-logo { text-align: center; font-size: 2.2rem; color: #fff; margin-bottom: 2.5rem; font-weight: 800; }
.auth-logo i { color: var(--primary); }
.auth-title { text-align: center; margin-top: 0; font-size: 1.5rem; margin-bottom: 0.5rem;}
.auth- subtitle {text-align: center; color: var(--text-muted); display:block; margin-bottom: 2rem;}

@media (max-width: 768px) {
    .sidebar { width: 80px; }
    .sidebar-header h2 span { display: none; }
    .sidebar-menu a span { display: none; }
    .main-content { margin-right: 80px; }
    .user-info span { display:none;}
    .logout-btn { padding: 0.85rem 0;}
    .logout-btn span { display:none;}
}
