:root {
    --primary: #1e3a8a;
    --whatsapp: #25d366;
    --bg: #f4f7f9;
    --white: #ffffff;
}

/* -- إعدادات الخلفية -- */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--bg);
    overflow: hidden;
    position: relative;
    z-index: 0;
}

/* هنا بنضيف اللوجو كعنصر وهمي في الخلفية ونطبق عليه الشفافية */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/logo11.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 50%;
    opacity: 0.2;
    z-index: -1;
    pointer-events: none;
}

#loginScreen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    background: radial-gradient(1200px 600px at 30% 20%, rgba(255,255,255,0.18), rgba(255,255,255,0) 60%),
                 linear-gradient(135deg, #1e3a8a, #0b245c);
}

#loginScreen::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(30, 58, 138, 0.7);
    z-index: 1;
}

.login-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.98);
    padding: 34px 28px;
    border-radius: 22px;
    width: min(92vw, 380px);
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.login-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 50%;
    background: white;
    padding: 5px;
}

.login-card input {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-sizing: border-box;
    outline: none;
}

.login-card input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.35);
}

.login-title {
    margin: 0;
    color: #0b245c;
    letter-spacing: 0.2px;
}

.login-subtitle {
    margin: 8px 0 0;
    font-size: 12px;
    color: #64748b;
}

.login-btn {
    width: 100%;
    background: var(--primary);
    padding: 12px 16px;
    border-radius: 12px;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.app-header {
    background: var(--primary);
    color: white;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    background: white;
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-action {
    background: var(--whatsapp);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s, opacity 0.2s;
}
.btn-action:hover {
    opacity: 0.9;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px);
    box-sizing: border-box;
}

/* دمج الكروت في كارت واحد وتصغير المساحات */
.card-box {
    background: rgba(255, 255, 255, 0.4);
    padding: 8px;
    border-radius: 10px;
    margin-bottom: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    backdrop-filter: blur(2px);
}

/* تنسيق الصفوف داخل الكارت المدمج */
.input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.input-row input.flex-1 { flex: 1; }
.input-row input.flex-2 { flex: 2; }

/* تصغير حجم الحقول لزيادة المساحة للجدول */
input, select {
    padding: 6px 8px;
    border: 1px solid rgba(221, 221, 221, 0.5);
    border-radius: 6px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    background: rgba(255,255,255,0.6);
}

input:focus, select:focus {
    border-color: var(--primary);
}

.groups-scroll {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.groups-scroll::-webkit-scrollbar {
    display: none;
}

/* تصغير أزرار المجموعات */
.group-btn {
    white-space: nowrap;
    padding: 4px 12px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(203, 213, 225, 0.5);
    border-radius: 15px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s;
}

.group-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.table-res {
    flex-grow: 1;
    overflow-y: auto;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(225, 228, 232, 0.3);
    backdrop-filter: blur(2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: rgba(248, 249, 250, 0.5);
    color: var(--primary);
    padding: 8px 4px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid rgba(237, 240, 242, 0.3);
    font-size: 12px;
    backdrop-filter: blur(2px);
}

td {
    padding: 6px 4px;
    border-bottom: 1px solid rgba(241, 243, 245, 0.3);
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}

.price-col {
    display: none;
    color: #b91c1c;
    font-weight: bold;
}

.is-vip .price-col {
    display: table-cell;
}

.admin-panel {
    background: rgba(255, 243, 205, 0.6);
    border: 2px dashed rgba(245, 158, 11, 0.4);
    padding: 8px;
    border-radius: 10px;
    margin-bottom: 6px;
    display: none;
    gap: 6px;
    backdrop-filter: blur(2px);
}

.admin-active .admin-panel {
    display: flex;
}

.hidden {
    display: none !important;
}

.qty-input {
    width: 50px;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid rgba(221, 221, 221, 0.5);
    text-align: center;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.6);
}

/* نافذة إدارة الحسابات وتغيير كلمة المرور */
#pwdModal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    padding: 12px;
    box-sizing: border-box;
}

.pwd-card {
    width: min(96vw, 540px);
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px 20px;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.modal-tab-btn {
    flex: 1;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.modal-tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 3px 8px rgba(30, 58, 138, 0.25);
}

/* Add user card */
.add-user-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
}

/* User registry table */
.user-table-wrap {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 14px;
    background: #ffffff;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.user-table th {
    background: #f1f5f9;
    color: #334155;
    padding: 8px 6px;
    font-weight: bold;
    border-bottom: 1px solid #cbd5e1;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-table td {
    padding: 7px 6px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
}
.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.role-badge.user {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.btn-delete-user {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-delete-user:hover {
    background: #ef4444;
    color: #fff;
}

.protected-badge {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: bold;
}
