/* Reset و تنظیمات پایه */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    line-height: 1.6;
}

/* کلاس‌های کمکی */
.hidden {
    display: none !important;
}

/* بخش احراز هویت */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

.auth-form .form-group {
    margin-bottom: 20px;
    text-align: right;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.auth-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

/* دکمه‌ها */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Vazirmatn', sans-serif;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* داشبورد */
.dashboard-section {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.dashboard-header h1 {
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

/* کارت‌های موجودی */
.balance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.balance-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
    border-left: 5px solid transparent;
}

.balance-card:hover {
    transform: translateY(-5px);
}

.balance-card.debt {
    border-left-color: #ef4444;
}

.balance-card.credit {
    border-left-color: #10b981;
}

.balance-card i {
    font-size: 48px;
    margin-bottom: 15px;
}

.balance-card.debt i {
    color: #ef4444;
}

.balance-card.credit i {
    color: #10b981;
}

.balance-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
}

.balance-card .amount {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

/* بخش دوستان */
.friends-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.friends-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
}

.friends-list {
    display: grid;
    gap: 15px;
}

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-right: 4px solid #667eea;
}

.friend-info h4 {
    color: #333;
    margin-bottom: 5px;
    font-size: 18px;
    font-weight: 600;
}

.balance-info {
    color: #666;
    font-size: 14px;
}

.balance-info .debt {
    color: #ef4444;
    font-weight: 600;
}

.balance-info .credit {
    color: #10b981;
    font-weight: 600;
}

.balance-info .settled {
    color: #6c757d;
    font-weight: 600;
}

/* بخش هزینه */
.expense-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.expense-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 600;
}

.expense-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.expense-form .form-group {
    margin-bottom: 20px;
}

.expense-form label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.expense-form input,
.expense-form select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.expense-form input:focus,
.expense-form select:focus {
    outline: none;
    border-color: #667eea;
}

.participants-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.checkbox-label:hover {
    background: #e9ecef;
}

.checkbox-label input[type="checkbox"] {
    margin-left: 10px;
    width: auto;
}

.split-options {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    margin-left: 8px;
    width: auto;
}

.custom-splits-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.custom-splits-section h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* بخش تاریخچه */
.history-section {
    text-align: center;
    margin-bottom: 30px;
}

/* مودال‌ها */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
}

.modal-header h2 {
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 30px;
}

/* تب‌ها */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e1e5e9;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    color: #666;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* آیتم‌های تاریخچه */
.expense-item,
.settlement-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-right: 4px solid #667eea;
}

.expense-header,
.settlement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.expense-header h4,
.settlement-header h4 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.date {
    color: #666;
    font-size: 14px;
}

.expense-item p,
.settlement-item p {
    color: #555;
    margin-bottom: 8px;
}

.expense-item strong,
.settlement-item strong {
    color: #333;
    font-weight: 600;
}

/* فرم تسویه حساب */
.settlement-form {
    max-width: 400px;
}

.settlement-form .form-group {
    margin-bottom: 20px;
}

.settlement-form label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.settlement-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.settlement-form input:focus {
    outline: none;
    border-color: #667eea;
}

/* پیام‌ها */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .dashboard-section {
        padding: 15px;
    }
    
    .balance-cards {
        grid-template-columns: 1fr;
    }
    
    .expense-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .participants-list {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: center;
        border-bottom: none;
        border-right: 2px solid transparent;
    }
    
    .tab-btn.active {
        border-right-color: #667eea;
        border-bottom-color: transparent;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 20px;
        margin: 10px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .friend-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .balance-card {
        padding: 20px;
    }
    
    .expense-section,
    .friends-section {
        padding: 20px;
    }
}
