/* Noti Center Admin - Liquid Glass */
:root {
    --bg: #0b1220;
    --glass: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.15);
    --primary: #3b82f6;
    --primary-h: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --sidebar-w: 260px;
}

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

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: linear-gradient(160deg, #0b1220 0%, #132337 40%, #0b1220 100%);
    color: var(--text);
    min-height: 100vh;
    direction: rtl;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem 2rem;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    text-align: center;
}

.login-card h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--muted); margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1.25rem; text-align: right; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.3);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
}

/* Captcha image and the numeric entry boxes sit side by side in one row. */
.captcha-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.captcha-img {
    height: 58px;
    width: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    flex: 0 0 auto;
}

/* OTP-style CAPTCHA entry: page is RTL but the code is numeric,
   so the boxes are forced left-to-right and fill starting from the left. */
.otp-boxes {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.5rem;
}

/* Specificity note: ".form-group input" (0,1,1) is more specific than a lone
   ".otp-box" (0,1,0) class and would win, forcing width:100%/full padding on
   each digit box and breaking the row layout. ".form-group input.otp-box"
   (0,2,1) beats it, so these rules reliably apply. */
.form-group input.otp-box {
    flex: 0 0 2.75rem;
    width: 2.75rem;
    height: 3rem;
    padding: 0;
    margin: 0;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-family: inherit;
    -moz-appearance: textfield;
}

.form-group input.otp-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    color: var(--text);
    background: rgba(255,255,255,0.08);
}
.btn.primary { background: var(--primary); width: 100%; color: #fff; }
.btn.primary:hover { background: var(--primary-h); }
.btn.sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; width: auto; }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }

.alert { padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert.error { background: rgba(239,68,68,0.2); color: #fca5a5; }
.alert.success { background: rgba(34,197,94,0.2); color: #86efac; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--border);
    padding: 1.5rem 1rem;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
}
.sidebar .logo { font-size: 1.25rem; font-weight: 700; padding: 0.5rem 0.75rem; margin-bottom: 1.5rem; }
.sidebar nav a {
    display: block;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 0.25rem;
    transition: 0.15s;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(59,130,246,0.2);
    color: var(--text);
}

.main {
    flex: 1;
    margin-right: var(--sidebar-w);
    padding: 1.5rem 2rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    backdrop-filter: blur(12px);
}
.stat-card .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; }

.table-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(12px);
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.85rem 1rem; text-align: right; border-bottom: 1px solid rgba(255,255,255,0.06); }
th { background: rgba(0,0,0,0.25); font-weight: 600; white-space: nowrap; }
tr:hover td { background: rgba(255,255,255,0.03); }

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-active { background: rgba(34,197,94,0.25); color: #86efac; }
.badge-inactive { background: rgba(107,114,128,0.3); color: #d1d5db; }
.badge-critical { background: rgba(220,38,38,0.3); color: #fca5a5; }
.badge-urgent { background: rgba(234,88,12,0.3); color: #fdba74; }
.badge-notice { background: rgba(37,99,235,0.3); color: #93c5fd; }
.badge-normal { background: rgba(22,163,74,0.3); color: #86efac; }
.badge-history { background: rgba(107,114,128,0.3); color: #d1d5db; }
.badge-blocked { background: rgba(220,38,38,0.25); color: #fca5a5; }
.badge-pending { background: rgba(234,179,8,0.25); color: #fde68a; }
.badge-queued { background: rgba(107,114,128,0.3); color: #d1d5db; }
.badge-processing { background: rgba(37,99,235,0.3); color: #93c5fd; }
.badge-sent { background: rgba(34,197,94,0.25); color: #86efac; }
.badge-partial { background: rgba(234,88,12,0.3); color: #fdba74; }
.badge-failed { background: rgba(220,38,38,0.3); color: #fca5a5; }

/* Notification detail modal (shared by dashboard/notifications/archive) */
.notif-modal { max-width: 560px; text-align: right; }
.notif-modal-body { display: flex; flex-direction: column; gap: 0.6rem; }
.notif-modal-title { font-size: 1.05rem; font-weight: 700; }
.notif-modal-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.85rem; padding: 0.35rem 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.notif-modal-label { color: var(--muted); flex: 0 0 auto; }
.notif-modal-value { text-align: left; word-break: break-word; }
.notif-modal-counts { display: flex; gap: 0.5rem; margin: 0.4rem 0; }
.notif-modal-counts > div { flex: 1 1 0; background: rgba(0,0,0,0.25); border-radius: 8px; padding: 0.5rem; text-align: center; }
.notif-modal-counts span { display: block; font-size: 0.7rem; color: var(--muted); }
.notif-modal-counts b { font-size: 1rem; }
.notif-modal-message-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }
.notif-modal-message { white-space: pre-wrap; word-break: break-word; background: rgba(0,0,0,0.25); border-radius: 10px; padding: 0.75rem; font-size: 0.9rem; line-height: 1.8; max-height: 240px; overflow-y: auto; }

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 1rem;
}
.modal {
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h2 { margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; justify-content: flex-start; }

.copy-btn { cursor: pointer; color: var(--primary); font-size: 0.8rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.filters input, .filters select {
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.3);
    color: var(--text);
    font-family: inherit;
}

/* Mobile hamburger toggle + off-canvas drawer (hidden on desktop) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.85rem;
    right: 1rem;
    z-index: 220;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(11, 18, 32, 0.9);
    backdrop-filter: blur(10px);
    color: var(--text);
    font-size: 1.25rem;
    cursor: pointer;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 150;
}

@media (max-width: 900px) {
    .sidebar-toggle { display: block; }
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.25s ease;
        width: min(80vw, 300px);
        padding-top: 4rem;
    }
    .sidebar.open { transform: translateX(0); box-shadow: -10px 0 30px rgba(0,0,0,0.5); }
    .sidebar-overlay.open { display: block; }
    .main { margin-right: 0; padding: 4.25rem 1rem 1.5rem; }
    .admin-layout { flex-direction: column; }
    .page-header h1 { font-size: 1.25rem; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
    .stat-card { padding: 1rem; }
    .stat-card .value { font-size: 1.4rem; }
    .modal { padding: 1.25rem; max-width: 100%; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters input, .filters select { width: 100%; }
}

/* Responsive "stacked card" tables: below 700px each row becomes a card and
   every cell shows its column header via data-label, instead of squeezing
   many columns into a horizontally-scrolling table. */
@media (max-width: 700px) {
    .table-card table,
    .table-card thead,
    .table-card tbody,
    .table-card th,
    .table-card td,
    .table-card tr {
        display: block;
    }
    .table-card thead { position: absolute; top: -9999px; left: -9999px; }
    .table-card tr {
        border: 1px solid var(--border);
        border-radius: 12px;
        margin: 0 0 0.85rem;
        padding: 0.5rem 0.85rem;
        background: rgba(0,0,0,0.15);
    }
    .table-card tbody tr:last-child { margin-bottom: 0; }
    .table-card td {
        border-bottom: 1px solid rgba(255,255,255,0.06);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
        padding: 0.55rem 0;
        white-space: normal;
        word-break: break-word;
    }
    .table-card td:last-child { border-bottom: none; }
    .table-card td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        flex: 0 0 auto;
        margin-left: auto;
        padding-left: 0.75rem;
        font-size: 0.8rem;
    }
    .table-card td[data-label=""]::before,
    .table-card td:not([data-label])::before { content: none; }
    .table-card td form { display: inline-flex; }
}
