/* ========== أساسيات ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Tahoma', 'Segoe UI', sans-serif;
    background: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    line-height: 1.6;
}

a { color: #0ea5e9; text-decoration: none; }
a:hover { color: #0284c7; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.muted { color: #64748b; }
.small { font-size: 0.85em; }
.block { display: block; }
.center { text-align: center; }
.positive { color: #16a34a; }
.negative { color: #dc2626; }
.big-num { font-size: 1.5em; }
.huge-num { font-size: 4em; color: #0ea5e9; }

/* ========== شريط التنقل ========== */
.navbar {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.nav-brand {
    font-size: 1.2em;
    font-weight: bold;
    color: #0ea5e9;
}
.nav-links {
    display: flex;
    gap: 18px;
    flex: 1;
}
.nav-links a {
    color: #475569;
    font-size: 0.95em;
    padding: 6px 0;
}
.nav-links a:hover { color: #0ea5e9; }
.btn-logout {
    background: #ef4444;
    color: white !important;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.9em;
}
.btn-logout:hover { background: #dc2626; }

/* ========== flash ========== */
.flash {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-weight: bold;
    border-right: 4px solid;
}
.flash-error { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.flash-success { background: #d1fae5; color: #065f46; border-color: #10b981; }

/* ========== صفحة الهبوط ========== */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    color: white;
    border-radius: 20px;
    margin-bottom: 40px;
}
.hero h1 { font-size: 2.8em; margin-bottom: 10px; }
.hero .lead { font-size: 1.2em; opacity: 0.95; margin-bottom: 24px; }
.hero-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.feature {
    background: white;
    padding: 28px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.feature-icon { font-size: 2.5em; display: block; margin-bottom: 12px; }
.feature h3 { color: #1e293b; margin-bottom: 8px; }

.pricing { display: flex; justify-content: center; }
.price-card {
    background: white;
    padding: 32px;
    border-radius: 16px;
    width: 320px;
    text-align: center;
    border: 2px solid #0ea5e9;
}
.price { font-size: 2em; color: #0ea5e9; font-weight: bold; margin: 12px 0 20px; }
.price-card ul { list-style: none; margin: 16px 0; }
.price-card li { padding: 6px 0; color: #475569; }

/* ========== أزرار ========== */
.btn {
    display: inline-block;
    border: none;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    color: white;
    text-align: center;
    transition: opacity 0.15s, transform 0.05s;
    margin-top: 12px;
}
.btn:hover { opacity: 0.9; color: white; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.block { display: block; width: 100%; }
.btn.big { font-size: 1.1em; padding: 14px 30px; }

.btn-primary { background: #0ea5e9; }
.btn-success { background: #16a34a; }
.btn-warning { background: #ea580c; }
.btn-info    { background: #6366f1; }
.btn-ghost   { background: rgba(255,255,255,0.2); border: 2px solid white; }

.btn-mini {
    background: #0ea5e9;
    color: white !important;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85em;
}
.btn-mini:hover { background: #0284c7; }

/* ========== auth ========== */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}
.auth-card {
    background: white;
    padding: 36px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-title {
    text-align: center;
    font-size: 1.7em;
    color: #0ea5e9;
    margin-bottom: 6px;
}
.auth-subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 24px;
}
.auth-switch {
    text-align: center;
    margin-top: 18px;
    color: #64748b;
}

/* ========== نماذج ========== */
.form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form label {
    color: #475569;
    font-size: 0.95em;
    margin-top: 8px;
    font-weight: 600;
}
.form input {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    color: #1e293b;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form input:focus {
    outline: none;
    border-color: #0ea5e9;
    background: white;
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}
.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
}

/* ========== بطاقات وألواح ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.page-header h2 { color: #1e293b; }

.page-card {
    background: white;
    padding: 28px;
    border-radius: 12px;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.page-card.wide { max-width: 720px; }
.page-card h2 { margin-bottom: 18px; }

.panel {
    background: white;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.panel h3 { margin-bottom: 14px; color: #1e293b; }

.empty-state {
    background: white;
    padding: 40px 20px;
    border-radius: 12px;
    text-align: center;
    color: #64748b;
}
.empty-state h3 { color: #1e293b; margin-bottom: 6px; }
.empty-state p { margin-bottom: 16px; }

/* ========== الإحصائيات ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-top: 3px solid #0ea5e9;
}
.stat-label {
    color: #64748b;
    font-size: 0.9em;
    display: block;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #1e293b;
}

/* ========== quick actions ========== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.quick-tile {
    background: white;
    color: #1e293b !important;
    padding: 22px;
    border-radius: 12px;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border-top: 3px solid;
    transition: transform 0.15s, box-shadow 0.15s;
}
.quick-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.quick-tile.primary { border-color: #0ea5e9; }
.quick-tile.success { border-color: #16a34a; }
.quick-tile.info    { border-color: #6366f1; }
.quick-tile.gray    { border-color: #64748b; }

/* ========== قائمة النشاط ========== */
.activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.activity-row {
    background: #f8fafc;
    padding: 12px 14px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.activity-row strong { color: #1e293b; }
.activity-row small { font-size: 0.8em; }
.amount {
    font-weight: bold;
    white-space: nowrap;
}

/* ========== جدول ========== */
.data-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.data-table th {
    background: #f1f5f9;
    color: #475569;
    text-align: right;
    padding: 12px 14px;
    font-weight: bold;
    font-size: 0.9em;
}
.data-table td {
    padding: 12px 14px;
    border-top: 1px solid #f1f5f9;
}
.data-table tr:hover { background: #f8fafc; }

/* ========== الكود (chip) ========== */
.code-chip {
    background: #f1f5f9;
    color: #0ea5e9;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-weight: bold;
    letter-spacing: 1px;
}
.code-chip.big { font-size: 1.2em; padding: 6px 14px; }

/* ========== صفحة العميل ========== */
.customer-header {
    background: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.customer-stats {
    display: flex;
    gap: 24px;
}

.reward-bar {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.reward-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}
.progress {
    background: #e2e8f0;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #0ea5e9);
    transition: width 0.4s;
}
.ready {
    background: #d1fae5;
    color: #065f46;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    margin-top: 12px;
    font-weight: bold;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.action-card {
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.action-card h3 { color: #1e293b; }
.action-card input {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    padding: 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1em;
}

.public-link-card {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.public-link-card h3 { color: #78350f; margin-bottom: 4px; }
.copy-input {
    width: 100%;
    background: white;
    border: 1.5px solid #fbbf24;
    padding: 10px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-size: 0.9em;
    margin-top: 8px;
}

/* ========== Lookup ========== */
.lookup-form {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}
.lookup-form input {
    flex: 1;
    background: #f8fafc;
    border: 2px solid #0ea5e9;
    padding: 14px;
    border-radius: 8px;
    font-size: 1.3em;
    font-family: 'Consolas', monospace;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
}

.customer-result {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    padding: 20px;
    border-radius: 12px;
    margin-top: 16px;
    border-right: 4px solid #10b981;
}
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.result-header h3 { color: #065f46; }

/* ========== صفحة العميل العامة ========== */
.public-page {
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    min-height: 100vh;
}
.public-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}
.public-card-big {
    background: white;
    border-radius: 24px;
    padding: 40px 30px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.public-header {
    text-align: center;
    margin-bottom: 30px;
}
.public-header h1 {
    color: #1e293b;
    font-size: 1.8em;
    margin: 6px 0 12px;
}
.points-display {
    text-align: center;
    background: linear-gradient(135deg, #ecfdf5, #e0f2fe);
    padding: 28px;
    border-radius: 16px;
    margin-bottom: 24px;
}
.reward-bar.inside { box-shadow: none; padding: 0; }

/* ========== footer ========== */
.footer {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 0.85em;
    margin-top: 40px;
}
