/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* رأس الصفحة */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* بطاقة الرصيد */
.balance-section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* قسم الرصيد الأولي */
.initial-balance-section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.initial-balance-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.form-hint {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
}

.balance-section h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.balance-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.balance-amount {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
}

.currency {
    font-size: 1.5rem;
    color: #666;
}

/* نموذج المعاملة */
.transaction-form {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.transaction-form h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input[type="number"]:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 10px;
    transition: background-color 0.3s;
}

.radio-label:hover {
    background-color: #f5f5f5;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

/* الأزرار */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.controls {
    margin-bottom: 20px;
}

/* سجل المعاملات */
.history-section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.history-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    border-right: 4px solid;
    transition: transform 0.2s;
    gap: 15px;
}

.transaction-item:hover {
    transform: translateX(-5px);
}

.transaction-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.transaction-actions {
    display: flex;
    gap: 8px;
}

.btn-edit,
.btn-delete {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 5px;
    transition: all 0.2s;
    opacity: 0.7;
}

.btn-edit:hover {
    background: rgba(102, 126, 234, 0.1);
    opacity: 1;
    transform: scale(1.1);
}

.btn-delete:hover {
    background: rgba(220, 53, 69, 0.1);
    opacity: 1;
    transform: scale(1.1);
}

.transaction-item.deposit {
    border-right-color: #28a745;
}

.transaction-item.spend {
    border-right-color: #dc3545;
}

.transaction-info {
    flex: 1;
}

.transaction-type {
    font-weight: bold;
    margin-bottom: 5px;
}

.transaction-type.deposit {
    color: #28a745;
}

.transaction-type.spend {
    color: #dc3545;
}

.transaction-note {
    color: #666;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.transaction-date {
    color: #999;
    font-size: 0.8rem;
}

.transaction-amount {
    font-size: 1.2rem;
    font-weight: bold;
}

.transaction-amount.deposit {
    color: #28a745;
}

.transaction-amount.spend {
    color: #dc3545;
}

.empty-history {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 1.1rem;
}

/* رسائل التنبيه */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 500;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.alert-warning {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

/* تصميم متجاوب */
@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }
    
    .balance-amount {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
}

/* تخصيص شريط التمرير */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* نافذة التعديل - Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    color: #667eea;
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.modal-footer .btn {
    margin: 0;
    flex: 1;
}

