/* ============================================================
   RADIUS Management System - Professional Stylesheet (RTL)
   ============================================================ */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #0ea5e9;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --dark: #0f172a;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --text: #1e293b;
    --text-muted: #64748b;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
    --sidebar-w: 260px;
}

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

body {
    font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
    background: var(--gray-100);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ---------------- Layout ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s ease;
}

.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 24px;
    font-size: 1.3rem; font-weight: 800; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand i { color: var(--secondary); font-size: 1.5rem; }

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 4px;
    transition: all .2s;
}
.nav-item i { width: 22px; text-align: center; font-size: 1.05rem; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-item.logout:hover { background: var(--danger); color:#fff; }

.main {
    flex: 1;
    margin-right: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-width: 0;
}

/* ---------------- Topbar ---------------- */
.topbar {
    background: #fff;
    height: 70px;
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 1.25rem; font-weight: 700; flex: 1; }
.menu-toggle {
    display: none; background: none; border: none;
    font-size: 1.3rem; cursor: pointer; color: var(--gray-600);
}
.admin-chip {
    display: flex; align-items: center; gap: 10px;
    background: var(--primary-light); color: var(--primary-dark);
    padding: 8px 16px; border-radius: 50px; font-weight: 600;
    font-size: .9rem;
}

.content { padding: 28px; flex: 1; }

/* ---------------- Alerts ---------------- */
.alert {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-radius: var(--radius-sm);
    margin-bottom: 18px; font-weight: 500;
    animation: slideIn .3s ease;
}
.alert i { font-size: 1.1rem; }
.alert span { flex: 1; }
.alert-success { background: var(--success-light); color: #065f46; }
.alert-error { background: var(--danger-light); color: #991b1b; }
.alert-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; opacity: .6; }
@keyframes slideIn { from { opacity:0; transform: translateY(-10px);} to {opacity:1; transform:none;} }

/* ---------------- Cards / Stats ---------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px; margin-bottom: 28px;
}
.stat-card {
    background: #fff; border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 18px;
    transition: transform .2s, box-shadow .2s;
    border: 1px solid var(--gray-200);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff; flex-shrink: 0;
}
.stat-icon.indigo { background: linear-gradient(135deg,#6366f1,#4338ca); }
.stat-icon.sky    { background: linear-gradient(135deg,#0ea5e9,#0369a1); }
.stat-icon.green  { background: linear-gradient(135deg,#10b981,#047857); }
.stat-icon.amber  { background: linear-gradient(135deg,#f59e0b,#b45309); }
.stat-icon.rose   { background: linear-gradient(135deg,#f43f5e,#be123c); }
.stat-icon.violet { background: linear-gradient(135deg,#8b5cf6,#6d28d9); }
.stat-info h3 { font-size: 1.7rem; font-weight: 800; color: var(--dark); }
.stat-info p { color: var(--text-muted); font-size: .9rem; font-weight: 500; }

/* ---------------- Generic Card ---------------- */
.card {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--gray-200);
    margin-bottom: 24px; overflow: hidden;
}
.card-header {
    padding: 18px 22px; border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.card-header h2 { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-header h2 i { color: var(--primary); }
.card-body { padding: 22px; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-sm);
    border: none; cursor: pointer; font-family: inherit;
    font-weight: 600; font-size: .9rem; transition: all .2s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: var(--gray-100); color: var(--gray-700); }
.btn-light:hover { background: var(--gray-200); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse; font-size: .9rem;
}
table.data th {
    background: var(--gray-50); text-align: right;
    padding: 14px 16px; font-weight: 700; color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200); white-space: nowrap;
}
table.data td {
    padding: 14px 16px; border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
}
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: var(--gray-50); }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: 50px;
    font-size: .78rem; font-weight: 700;
}
.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-hotspot { background: #ede9fe; color: #5b21b6; }
.badge-pppoe { background: #cffafe; color: #155e75; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--success); box-shadow: 0 0 0 3px var(--success-light); }
.dot.red { background: var(--danger); }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 7px; font-weight: 600;
    font-size: .88rem; color: var(--gray-700);
}
.form-control {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
    font-family: inherit; font-size: .92rem; transition: all .2s;
    background: var(--gray-50);
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    background: #fff; box-shadow: 0 0 0 3px var(--primary-light);
}
select.form-control { cursor: pointer; }

/* ---------------- Search / Toolbar ---------------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.search-box input { width: 100%; padding: 11px 42px 11px 14px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-family: inherit; }
.tabs { display: flex; gap: 6px; background: #fff; padding: 5px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.tab { padding: 9px 18px; border-radius: 8px; font-weight: 600; font-size: .88rem; color: var(--gray-500); transition: all .2s; }
.tab.active { background: var(--primary); color: #fff; }

/* ---------------- Modal ---------------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    backdrop-filter: blur(3px); z-index: 200; display: none;
}
.modal-overlay.show { display: block; }
.modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%,-50%) scale(.95);
    background: #fff; border-radius: var(--radius);
    width: 92%; max-width: 560px; max-height: 90vh; overflow-y: auto;
    z-index: 201; display: none; box-shadow: var(--shadow-lg);
    opacity: 0; transition: all .25s;
}
.modal.show { display: block; opacity: 1; transform: translate(-50%,-50%) scale(1); }
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.15rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--gray-400); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; gap: 10px; justify-content: flex-start; }

/* ---------------- Charts ---------------- */
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 24px; }
.chart-box { position: relative; height: 300px; }

/* ---------------- Empty state ---------------- */
.empty {
    text-align: center; padding: 50px 20px; color: var(--gray-400);
}
.empty i { font-size: 3rem; margin-bottom: 14px; opacity: .5; }
.empty p { font-size: 1rem; }

/* ---------------- Actions cell ---------------- */
.actions { display: flex; gap: 6px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 992px) { .chart-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-right: 0; }
    .menu-toggle { display: block; }
    .content { padding: 18px; }
}

/* ---------------- Login ---------------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 420px; padding: 40px 36px;
    animation: slideIn .4s ease;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .icon {
    width: 72px; height: 72px; margin: 0 auto 16px;
    background: linear-gradient(135deg,#4f46e5,#0ea5e9);
    border-radius: 20px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 2rem;
}
.login-logo h1 { font-size: 1.5rem; font-weight: 800; }
.login-logo p { color: var(--text-muted); font-size: .92rem; }
.login-card .btn { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; margin-top: 8px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.input-icon .form-control { padding-right: 42px; }
