/* style.css - نظام إدارة المصروفات */
:root {
    --primary-color: #3498db;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f1c40f;
    --bg-color: #f4f7f6;
    --text-color: #2c3e50;
    --card-bg: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.05);
    --nav-bg: #ffffff;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

[data-theme="dark"] {
    --primary-color: #2980b9;
    --success-color: #27ae60;
    --danger-color: #c0392b;
    --bg-color: #121212;
    --text-color: #e6e6e6;
    --card-bg: rgba(30, 30, 30, 0.85);
    --border-color: rgba(255, 255, 255, 0.05);
    --nav-bg: #1e1e1e;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-bottom: 70px; /* For mobile nav */
}

/* لمنع اقتراب الزوم التلقائي في الآيفون عند تحديد الحقول */
input, select, textarea {
    font-size: 16px !important;
}

a { text-decoration: none; color: var(--primary-color); }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-primary { color: var(--primary-color) !important; }
.text-muted { color: #95a5a6 !important; }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.float-left { float: left; }
.w-100 { width: 100%; }
.mt-4 { margin-top: 1.5rem; }

/* Navigation */
.top-nav {
    background: var(--nav-bg);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-links a {
    margin: 0 15px;
    color: var(--text-color);
    font-weight: 600;
}
.nav-links a.active { color: var(--primary-color); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout { color: var(--danger-color); font-size: 1.2rem; }

/* Containers */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}
.main-content { padding: 30px 0; }
.page-header { margin-bottom: 25px; }

/* Cards & Glassmorphism */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.card-info h3 { font-size: 1.1rem; margin-bottom: 5px; color: var(--text-color); }
.card-info .amount { font-size: 1.5rem; font-weight: 700; }

.content-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Forms */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; }
.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    outline: none;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Cairo';
    transition: 0.2s;
}
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-success { background: var(--success-color); color: #fff; }
.btn-danger { background: var(--danger-color); color: #fff; }

/* Transaction List */
.transaction-list {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}
/* Scrollbar */
.transaction-list::-webkit-scrollbar { width: 5px; }
.transaction-list::-webkit-scrollbar-track { background: transparent; }
.transaction-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 5px; }

.transaction-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    gap: 15px;
}
.transaction-item:last-child { border-bottom: none; }

.tr-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.tr-details { flex-grow: 1; }
.tr-details h4 { margin: 0; font-size: 1.1rem; }
.tr-date { font-size: 0.8rem; color: var(--text-color); opacity: 0.7; }
.tr-amount { font-weight: 700; font-size: 1.2rem; }

.btn-delete {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 5px;
    opacity: 0.5;
}
.btn-delete:hover { opacity: 1; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}
.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    width: 90%;
    max-width: 400px;
    position: relative;
}
.close-modal {
    position: absolute;
    top: 15px;
    left: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 80px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
    border-right: 4px solid var(--primary-color);
}
.toast.success { border-color: var(--success-color); }
.toast.error { border-color: var(--danger-color); }

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Mobile Nav */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: var(--nav-bg);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    padding: 10px 0;
    z-index: 100;
}

.bottom-nav a {
    flex: 1;
    text-align: center;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    opacity: 0.6;
}
.bottom-nav a.active {
    opacity: 1;
    color: var(--primary-color);
}
.bottom-nav i { font-size: 1.3rem; }

/* Responsive */
@media (max-width: 768px) {
    .desktop-only { display: none; }
    .mobile-only { display: flex; }
    .content-grid { grid-template-columns: 1fr; }
    .nav-user span { display: none; }
    body { padding-bottom: 70px; }
    
    .page-header { margin-bottom: 10px; }
    .page-header h2 { font-size: 1.1rem; margin-bottom: 5px; }
    .filter-group { gap: 5px; }
    .filter-select { padding: 4px; font-size: 13px !important; }
    
    .summary-cards {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 15px;
    }
    .summary-card {
        flex: 1;
        width: 48%;
        flex-direction: column;
        text-align: center;
        justify-content: center;
        gap: 5px;
        padding: 15px 5px;
    }
    .card-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        margin: 0 auto;
    }
    .card-info h3 { font-size: 0.75rem; margin-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .card-info .amount { font-size: 0.9rem; font-weight: bold; }
    
    .dashboard-cards {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    .dashboard-cards .card {
        flex: 1 1 45%;
        padding: 10px;
        text-align: center;
    }
    .dashboard-cards .card-icon {
        margin: 0 auto 5px auto;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    .dashboard-cards h3 { font-size: 0.75rem; margin-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dashboard-cards .amount { font-size: 0.9rem; font-weight: bold; }
}
@media (min-width: 769px) {
    .mobile-only { display: none; }
}
