/* ============================================================
   eSIM Panel — Stylesheet
   Dev. Abdelrahman
   Mobile-first, fully responsive
============================================================ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #0B0D12;
    color: #E9ECF4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: inherit; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Navbar ---------- */
.navbar {
    background: #12151C;
    border-bottom: 1px solid #242938;
    padding: 14px 0;
}
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.navbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
}
.brand-chip {
    width: 30px; height: 22px; border-radius: 4px; flex-shrink: 0;
    background: linear-gradient(135deg, #FFB020 0%, #FFB020 40%, #181C26 40%, #181C26 60%, #33D6C0 60%, #33D6C0 100%);
}
.navbar .actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.navbar .actions a, .navbar .actions button {
    font-size: 13px;
    text-decoration: none;
}
.btn-add {
    background: #FFB020; color: #0B0D12; font-weight: 600;
    padding: 8px 14px; border-radius: 8px; white-space: nowrap;
}
.btn-logout {
    background: transparent; border: 1px solid #242938; color: #8890A4;
    padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.username-tag { color: #8890A4; font-size: 13px; }

/* ---------- Layout ---------- */
.page { flex: 1; padding: 24px 0 40px; }
.card-box {
    background: #12151C; border: 1px solid #242938; border-radius: 14px;
    padding: 20px; margin-bottom: 20px;
}
@media (min-width: 640px) {
    .card-box { padding: 28px; }
}
h1 { font-size: 20px; margin: 0 0 20px; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 16px; font-weight: 700; }

/* ---------- Stats ---------- */
.stats-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px;
}
@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-card {
    background: #12151C; border: 1px solid #242938; border-radius: 12px; padding: 16px;
}
.stat-card .value { font-size: 24px; font-weight: 700; color: #FFB020; }
.stat-card .label { font-size: 12px; color: #8890A4; margin-top: 4px; }

/* ---------- Forms ---------- */
label { display: block; margin-bottom: 6px; font-size: 13px; color: #8890A4; }
input[type=text], input[type=password], input[type=number], input[type=date],
select, textarea, input[type=file] {
    width: 100%; padding: 11px 12px; margin-bottom: 16px; border-radius: 8px;
    border: 1px solid #242938; background: #0B0D12; color: #E9ECF4; font-size: 14px;
    font-family: inherit;
}
input[type=file] { padding: 8px; font-size: 13px; }
textarea { resize: vertical; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 560px) {
    .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

button, .btn {
    background: #FFB020; color: #0B0D12; border: none; padding: 11px 20px;
    border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
    text-decoration: none; display: inline-block; text-align: center;
    font-family: inherit;
}
button.secondary, .btn.secondary { background: transparent; border: 1px solid #242938; color: #E9ECF4; font-weight: 500; }
button.danger, .btn.danger { background: #F0556B; color: #fff; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert.error   { background: #3A1620; color: #F0556B; border: 1px solid rgba(240,85,107,0.3); }
.alert.success { background: #0F2E2B; color: #33D6C0; border: 1px solid rgba(51,214,192,0.3); }
.alert.info    { background: #12151C; color: #8890A4; border: 1px solid #242938; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
    padding: 3px 10px; border-radius: 999px; text-transform: uppercase;
}
.badge-active  { background: rgba(51,214,192,0.15); color: #33D6C0; }
.badge-warning { background: rgba(255,176,32,0.15); color: #FFB020; }
.badge-expired { background: rgba(240,85,107,0.15); color: #F0556B; }

/* ---------- Table (desktop) / Cards (mobile) ---------- */
.table-wrap { background: #12151C; border: 1px solid #242938; border-radius: 14px; overflow: hidden; }

table.esims-table { width: 100%; border-collapse: collapse; display: none; }
table.esims-table th, table.esims-table td {
    padding: 14px 16px; text-align: right; border-bottom: 1px solid #242938; font-size: 13.5px;
}
table.esims-table th { color: #8890A4; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
table.esims-table tr:last-child td { border-bottom: none; }
table.esims-table tr:hover td { background: rgba(255,255,255,0.02); }
img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: #fff; }

@media (min-width: 800px) {
    table.esims-table { display: table; }
    .esim-cards { display: none; }
}

/* بطاقات الموبايل بدل الجدول */
.esim-cards { display: flex; flex-direction: column; }
.esim-card-row {
    padding: 16px; border-bottom: 1px solid #242938; display: flex; gap: 12px; align-items: center;
}
.esim-card-row:last-child { border-bottom: none; }
.esim-card-row .thumb-wrap img { width: 48px; height: 48px; border-radius: 8px; background: #fff; }
.esim-card-row .info { flex: 1; min-width: 0; }
.esim-card-row .info .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.esim-card-row .country { font-weight: 700; font-size: 15px; }
.esim-card-row .meta { font-size: 12.5px; color: #8890A4; display: flex; flex-wrap: wrap; gap: 8px; }
.esim-card-row .meta span::after { content: '•'; margin-inline-start: 8px; color: #565D72; }
.esim-card-row .meta span:last-child::after { content: ''; }
.esim-card-row .arrow { color: #565D72; font-size: 18px; flex-shrink: 0; }

/* ---------- Search bar ---------- */
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar input { margin-bottom: 0; flex: 1; }
.search-bar button { flex-shrink: 0; }

/* ---------- Login ---------- */
.login-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255,176,32,0.05) 3px, rgba(255,176,32,0.05) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(255,176,32,0.05) 3px, rgba(255,176,32,0.05) 4px);
}
.login-box { width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.login-brand span.title { font-weight: 700; font-size: 22px; }

/* ---------- Result images (add page) ---------- */
.result-images { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
@media (min-width: 640px) {
    .result-images { grid-template-columns: 1fr 1fr; }
}
.result-images figure { margin: 0; text-align: center; }
.result-images img { width: 100%; border-radius: 10px; border: 1px solid #242938; }
.result-images figcaption { color: #8890A4; font-size: 12.5px; margin-top: 6px; }

/* ---------- View page detail table ---------- */
.detail-table { width: 100%; font-size: 14px; margin-bottom: 24px; }
.detail-table th {
    text-align: right; color: #8890A4; font-weight: 400; padding: 10px 0; width: 40%; vertical-align: top;
}
.detail-table td { padding: 10px 0; }
.detail-table tr { border-bottom: 1px solid #242938; }
.detail-table tr:last-child { border-bottom: none; }

.detail-images {
    display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px;
}
@media (min-width: 640px) {
    .detail-images { grid-template-columns: repeat(3, 1fr); }
}
.detail-images figure { margin: 0; text-align: center; }
.detail-images img { width: 100%; border-radius: 10px; border: 1px solid #242938; background: #fff; }
.detail-images figcaption { color: #8890A4; font-size: 12.5px; margin-top: 6px; }

.action-bar { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state p { color: #8890A4; margin-bottom: 16px; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid #242938; padding: 18px 0; text-align: center;
    font-size: 12.5px; color: #565D72;
}
.site-footer a { color: #8890A4; text-decoration: none; }
.site-footer strong { color: #8890A4; }

/* ---------- Utility ---------- */
.text-muted { color: #8890A4; }
.text-mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.mt-4 { margin-top: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
