/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    direction: rtl;
    font-size: 14px;
    line-height: 1.6;
}

/* Header */
.header {
    background: #333;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-left {
    display: flex;
    gap: 15px;
    align-items: center;
}

.header-left span {
    color: #ccc;
}

.header a {
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 13px;
}

.header a:hover {
    background: #555;
}

.header a.reports-link {
    background: #c9302c;
    border-color: #c9302c;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Cards */
.card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.card-header {
    background: #f8f8f8;
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
}

.card-body {
    padding: 15px;
}

/* Forms */
.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #666;
}

select.form-control {
    min-width: 120px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: #337ab7;
    color: white;
}

.btn-primary:hover {
    background: #286090;
}

.btn-success {
    background: #5cb85c;
    color: white;
}

.btn-success:hover {
    background: #449d44;
}

.btn-danger {
    background: #d9534f;
    color: white;
}

.btn-danger:hover {
    background: #c9302c;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 12px;
    text-align: right;
    border: 1px solid #ddd;
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

tr:hover {
    background: #fafafa;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    color: #666;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #337ab7;
    border-bottom-color: #337ab7;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Stats */
.stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-box {
    flex: 1;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    text-align: center;
}

.stat-box.income {
    border-top: 3px solid #5cb85c;
}

.stat-box.expense {
    border-top: 3px solid #d9534f;
}

.stat-box.profit {
    border-top: 3px solid #337ab7;
}

.stat-box.loss {
    border-top: 3px solid #d9534f;
}

.stat-label {
    color: #777;
    font-size: 13px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-value.positive {
    color: #5cb85c;
}

.stat-value.negative {
    color: #d9534f;
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-success {
    background: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

.alert-error {
    background: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9e9e9;
}

.login-box {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 30px;
    width: 100%;
    max-width: 360px;
}

.login-box h1 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 5px;
    color: #333;
}

.login-box p {
    text-align: center;
    color: #777;
    margin-bottom: 20px;
}

.login-box .btn {
    width: 100%;
}

/* Period Tabs */
.period-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.period-tab {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    text-decoration: none;
    color: #333;
    border-radius: 4px;
    font-size: 13px;
}

.period-tab:hover {
    background: #f5f5f5;
}

.period-tab.active {
    background: #337ab7;
    color: white;
    border-color: #337ab7;
}

/* Summary */
.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

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

/* Badge */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.badge-success {
    background: #dff0d8;
    color: #3c763d;
}

.badge-danger {
    background: #f2dede;
    color: #a94442;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .stats-row {
        flex-direction: column;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: none;
        border-right: 2px solid transparent;
    }
    
    .tab-btn.active {
        border-bottom: none;
        border-right-color: #337ab7;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px;
    }
}
