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

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

/* ============== الحاويات الرئيسية ============== */
.admin-container, .user-container, .login-container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

/* ============== تأثير الزجاج ============== */
.glass-effect {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ============== الهيدر ============== */
.admin-header, .user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left h1 {
    font-size: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    color: #666;
    font-size: 12px;
}

.btn-logout {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: transform 0.2s;
}

.btn-logout:hover {
    transform: translateY(-2px);
}

/* ============== الأزرار ============== */
.admin-buttons, .user-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

.btn.success {
    background: linear-gradient(135deg, #48bb78 0%, #2f855a 100%);
    color: white;
}

.btn.danger {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
}

.btn.warning {
    background: linear-gradient(135deg, #ed8936 0%, #c05621 100%);
    color: white;
}

.btn.info {
    background: linear-gradient(135deg, #4299e1 0%, #2b6cb0 100%);
    color: white;
}

.btn.secondary {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    color: white;
}

.btn.small {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
}

/* ============== محتوى الصفحة ============== */
.content-box {
    padding: 20px;
    min-height: 300px;
}

/* ============== شريط الحالة ============== */
.status-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.status-card {
    flex: 1;
    min-width: 140px;
    padding: 15px;
    border-radius: 14px;
    text-align: center;
    transition: all 0.3s;
}

.status-card.active {
    background: linear-gradient(135deg, #48bb78, #2f855a);
    color: white;
}

.status-card.inactive {
    background: #edf2f7;
    color: #666;
}

.status-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.status-card strong {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}

.status-card div {
    font-size: 13px;
}

/* ============== النماذج ============== */
.form-card {
    max-width: 100%;
    margin: 0 auto;
}

.form-card h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-weight: bold;
    font-size: 13px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ============== صندوق تسجيل الدخول ============== */
.login-box {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 28px;
    padding: 35px 25px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    transition: transform 0.3s;
}

.login-box:hover {
    transform: translateY(-5px);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.logo p {
    color: #666;
    font-size: 13px;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8f9fa;
    font-family: inherit;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    font-size: 13px;
    display: none;
}

.message.error {
    background: #fee;
    color: #c33;
    display: block;
}

.message.success {
    background: #efe;
    color: #3c3;
    display: block;
}

.footer {
    text-align: center;
    margin-top: 25px;
    color: #999;
    font-size: 11px;
}

/* ============== إحصائيات ============== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.stat-card h3 {
    font-size: 14px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.stat-card p {
    font-size: 28px;
    font-weight: bold;
}

/* ============== قائمة المستخدمين ============== */
.users-grid h2 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f7fafc;
    border-radius: 12px;
    transition: all 0.3s;
    flex-wrap: wrap;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-details strong {
    font-size: 14px;
}

.user-details small {
    font-size: 10px;
    color: #888;
}

.users-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
}

.user-card {
    background: #f7fafc;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s;
}

.user-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.user-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: center;
}

.user-avatar-large {
    font-size: 40px;
    margin-bottom: 8px;
}

.user-name {
    font-size: 16px;
    font-weight: bold;
}

.user-card-body {
    padding: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}

.status-badge.active {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.inactive {
    background: #fed7d7;
    color: #742a2a;
}

.user-card-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

/* ============== API Box ============== */
.api-box {
    max-width: 100%;
    margin: 0 auto;
}

.api-box h2 {
    font-size: 20px;
    margin-bottom: 15px;
    text-align: center;
}

.api-box h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.api-key-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.api-key {
    flex: 1;
    background: #2d3748;
    color: #68d391;
    padding: 10px 12px;
    border-radius: 10px;
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
}

.api-url {
    display: block;
    background: #edf2f7;
    padding: 10px;
    border-radius: 10px;
    font-family: monospace;
    font-size: 11px;
    margin-bottom: 15px;
    word-break: break-all;
}

.api-section {
    background: #f7fafc;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.api-section code {
    display: block;
    background: #edf2f7;
    padding: 8px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 11px;
    margin: 8px 0;
    word-break: break-all;
}

.example-response {
    margin-top: 8px;
    padding: 8px;
    background: #f7fafc;
    border-radius: 8px;
}

.example-response pre {
    background: #2d3748;
    color: #68d391;
    padding: 8px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 10px;
    margin-top: 5px;
}

/* ============== المودال ============== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
}

/* ============== نتيجة الرصيد ============== */
.balance-result {
    text-align: center;
    padding: 30px 20px;
}

.balance-amount {
    font-size: 40px;
    font-weight: bold;
    color: #667eea;
    margin: 15px 0;
    word-break: break-word;
}

/* ============== QR Code ============== */
.qr-container {
    text-align: center;
    padding: 15px;
}

.qr-code {
    max-width: 200px;
    width: 100%;
    height: auto;
    margin: 15px auto;
}

.countdown {
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

/* ============== الحالة الفارغة ============== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    color: #888;
    font-size: 14px;
}

/* ============== الإشعارات ============== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    z-index: 10000;
    animation: slideUp 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .toast {
        white-space: normal;
        max-width: 90%;
        text-align: center;
        font-size: 12px;
    }
}

.toast.success {
    background: linear-gradient(135deg, #48bb78 0%, #2f855a 100%);
}

.toast.error {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
}

.toast.info {
    background: linear-gradient(135deg, #4299e1 0%, #2b6cb0 100%);
}

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

/* ============== التذييل ============== */
.footer-note {
    text-align: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    color: #888;
    font-size: 11px;
}

/* ============== تحسينات للجوال ============== */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }
    
    .admin-header, .user-header {
        padding: 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .users-cards {
        grid-template-columns: 1fr;
    }
    
    .content-box {
        padding: 15px;
    }
    
    .login-box {
        padding: 25px 18px;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .form-group input {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .status-card {
        min-width: 120px;
        padding: 12px;
    }
    
    .status-icon {
        font-size: 24px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .balance-amount {
        font-size: 32px;
    }
    
    .user-item {
        flex-direction: column;
        text-align: center;
    }
    
    .user-info {
        flex-direction: column;
    }
}

/* ============== تحسينات للشاشات الصغيرة جداً ============== */
@media (max-width: 380px) {
    .btn {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .status-card {
        min-width: 100px;
    }
    
    .stats-grid {
        gap: 10px;
    }
    
    .stat-card p {
        font-size: 24px;
    }
    
    .api-key {
        font-size: 10px;
    }
}