* {
    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;
    direction: rtl;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.5s ease;
}

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

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

p {
    color: #666;
    margin-bottom: 25px;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border 0.3s;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    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 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* شاشة التحقق */
.verification-inputs {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 25px;
}

.code-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin: 0;
}

.code-input:focus {
    border-color: #667eea;
}

/* الواجهة الرئيسية */
#mainScreen {
    background: #f5f5f5;
    min-height: 100vh;
    padding-bottom: 80px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    color: white;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.header h2 {
    margin-bottom: 15px;
    font-size: 24px;
}

.header-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    color: white;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

.tab-btn span {
    font-size: 20px;
}

/* بطاقات الملخص */
.summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 20px;
    margin-top: -20px;
}

.summary-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.summary-card.income {
    border-right: 5px solid #4caf50;
}

.summary-card.expense {
    border-right: 5px solid #f44336;
}

.card-icon {
    font-size: 40px;
}

.card-content h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.card-content .amount {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

/* قسم البحث */
.search-section {
    padding: 0 20px 20px;
}

#searchInput {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* قائمة الأشخاص */
.list-section {
    padding: 0 20px;
}

.person-item {
    background: white;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.person-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.person-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #333;
}

.person-info p {
    font-size: 14px;
    color: #999;
    margin: 0;
}

.person-balance {
    text-align: left;
}

.balance-label {
    font-size: 12px;
    color: #999;
}

.balance-value {
    font-size: 18px;
    font-weight: bold;
}

.balance-value.positive {
    color: #4caf50;
}

.balance-value.negative {
    color: #f44336;
}

/* زر الإضافة العائم */
.fab {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
    transition: all 0.3s;
    z-index: 10;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
}

/* القائمة السفلية */
.bottom-nav {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    border-radius: 20px 20px 0 0;
}

.nav-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.nav-btn span {
    font-size: 24px;
}

.nav-btn p {
    font-size: 12px;
    color: #999;
    margin: 0;
}

.nav-btn.active p {
    color: #667eea;
    font-weight: bold;
}

/* النوافذ المنبثقة */
.modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

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

.modal-header h2 {
    font-size: 22px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #999;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 20px;
}

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

.modal-footer button {
    flex: 1;
}

/* قسم تفاصيل الشخص */
.detail-info {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.detail-info p {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.balance-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-top: 15px;
}

.balance-section h3 {
    color: white;
    font-size: 16px;
    margin-bottom: 10px;
}

.balance-amount {
    color: white;
    font-size: 28px;
    font-weight: bold;
}

.transaction-form {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.transaction-form h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.transactions-history {
    margin-top: 20px;
}

.transactions-history h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.transaction-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-right: 4px solid #667eea;
}

.transaction-item.expense {
    border-right-color: #f44336;
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.transaction-amount {
    font-size: 18px;
    font-weight: bold;
}

.transaction-amount.income {
    color: #4caf50;
}

.transaction-amount.expense {
    color: #f44336;
}

.transaction-date {
    font-size: 12px;
    color: #999;
}

.transaction-desc {
    font-size: 14px;
    color: #666;
}

/* للشاشات الصغيرة */
@media (max-width: 600px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .verification-inputs {
        gap: 5px;
    }
    
    .code-input {
        width: 45px;
        height: 55px;
        font-size: 20px;
    }
}