:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-border: rgba(255, 255, 255, 0.5);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --danger: #ef4444;
}

[data-theme="dark"] {
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --bg-color: #111827;
    --surface: rgba(31, 41, 55, 0.7);
    --surface-border: rgba(75, 85, 99, 0.4);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}
.theme-toggle:hover {
    transform: scale(1.1);
}

/* Pages */
.page {
    display: none;
    min-height: 100vh;
    width: 100%;
}
.page.active {
    display: flex;
}

/* Login Page */
#loginPage {
    align-items: center;
    justify-content: center;
}
.login-container {
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    text-align: center;
}
.logo h1 {
    margin: 1rem 0 2rem;
    color: var(--primary);
}
.logo i {
    font-size: 3rem;
    color: var(--primary);
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: right;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.input-wrapper {
    position: relative;
}
.input-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    outline: none;
    transition: all 0.3s;
}
.input-wrapper input:focus {
    border-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    width: 100%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

/* Dashboards */
.sidebar {
    width: 280px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    border-radius: 0 16px 16px 0;
    margin: 10px 0 10px 10px;
}
.logo-small {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
}
.nav-links {
    list-style: none;
    flex: 1;
}
.nav-links li {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}
.nav-links li:hover, .nav-links li.active {
    background: var(--primary);
    color: white;
}
.btn-logout {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-logout:hover {
    background: var(--danger);
    color: white;
}

.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}
.section {
    display: none;
    animation: fadeIn 0.4s ease;
}
.section.active {
    display: block;
}

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

.header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.header-action .btn-primary {
    width: auto;
}

.table-container {
    overflow-x: auto;
    padding: 1rem;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid var(--surface-border);
}
.data-table th {
    color: var(--text-muted);
}

.balance-card {
    padding: 2rem;
    text-align: center;
    margin-top: 1rem;
}
.balance-card h3 {
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.balance-card .amount {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal.active {
    display: flex;
}
.modal-content {
    padding: 2rem;
    width: 100%;
    max-width: 500px;
}
.modal-content h3 {
    margin-bottom: 1.5rem;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
}
.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
}
