/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f4f6f8;
    color: #222;
    line-height: 1.6;
    min-height: 100vh;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.app-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}
.brand:hover { text-decoration: none; opacity: 0.9; }

.app-header nav { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.nav-link {
    color: #cbd5e1;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 0.95rem;
    text-decoration: none;
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.logout-link { color: #fca5a5; }
.logout-link:hover { background: rgba(239,68,68,0.2); }

/* ===== Footer ===== */
.app-footer {
    background: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
    font-size: 0.85rem;
}

/* ===== Main ===== */
.app-main { flex: 1; padding: 2rem 0; }

/* ===== Hero (Home) ===== */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    color: #fff;
    border-radius: 0 0 2rem 2rem;
    margin-bottom: 2rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.75rem; }
.hero .accent { color: #60a5fa; }
.hero .subtitle { font-size: 1.15rem; color: #94a3b8; margin-bottom: 0.3rem; }
.hero .subtitle-ar { font-size: 1rem; color: #64748b; margin-bottom: 1.5rem; }
.cta-button {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.2s;
    text-decoration: none;
}
.cta-button:hover { background: #1d4ed8; text-decoration: none; }

/* ===== Features ===== */
.features { padding: 2rem 0; }
.features h2 { text-align: center; margin-bottom: 2rem; font-size: 1.6rem; }
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
.feature-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s;
}
.feature-card:hover { transform: translateY(-3px); }
.feature-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.feature-card h3 { margin-bottom: 0.5rem; color: #1e293b; }
.ar-text { color: #64748b; font-size: 0.9rem; margin-top: 0.4rem; }

/* ===== Login ===== */
.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 420px;
    width: 100%;
}
.login-card h1 { text-align: center; margin-bottom: 1.5rem; color: #1e293b; }
.superadmin-login-card { border-top: 4px solid #ef4444; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    color: #374151;
}
.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: #fff;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    gap: 0.4rem;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-empty { background: #64748b; color: #fff; }
.btn-empty:hover { background: #475569; }
.btn-block { width: 100%; }

/* ===== Alerts ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== VManager & SuperAdmin panels ===== */
.vmanager-section, .superadmin-section { padding: 1rem 0; }
.vmanager-section h1, .superadmin-section h1 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    color: #1e293b;
}

.verify-panel, .filter-panel, .voucher-list-panel, .generator-panel, .result-panel {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.verify-panel h2, .filter-panel h2, .voucher-list-panel h2, .generator-panel h2, .result-panel h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.verify-row, .filter-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.verify-row .form-control { flex: 1; min-width: 200px; }
.filter-row .form-group { flex: 1; min-width: 150px; }

.voucher-count { font-size: 0.85rem; color: #64748b; font-weight: 400; }

/* ===== Tables ===== */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.data-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}
.data-table tbody tr:hover { background: #f8fafc; }
.total-row { background: #f1f5f9; font-weight: 700; }

.inner-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 0.3rem 0;
}
.inner-table th, .inner-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}
.inner-table th { background: #f8fafc; font-size: 0.8rem; }

/* ===== SuperAdmin specific ===== */
.panel-description { color: #64748b; font-size: 0.9rem; margin-bottom: 1rem; }

.form-row-sa {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.form-row-sa-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.btn-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; }

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}
.stat-card .stat-value { display: block; font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.8rem; color: #64748b; }
.stat-deleted { background: #fef2f2; color: #dc2626; }
.stat-generated { background: #dcfce7; color: #166534; }
.stat-total { background: #dbeafe; color: #1d4ed8; }

.svc-chip {
    display: inline-block;
    background: #f1f5f9;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin: 0.15rem 0.15rem;
}

code { background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }

/* ===== Print ===== */
@media print {
    .app-header, .app-footer, .verify-panel, .filter-panel, .btn, .print-hide,
    .nav-link, .generator-panel, .result-stats { display: none !important; }
    .voucher-list-panel { box-shadow: none; padding: 0; }
    .data-table th, .data-table td { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
    body { background: #fff; }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .hero h1 { font-size: 1.8rem; }
    .form-row-sa-2x2 { grid-template-columns: 1fr; }
    .verify-row, .filter-row { flex-direction: column; }
    .header-content { justify-content: center; text-align: center; }
    .app-header nav { justify-content: center; }
}
