/* ============================================================
   assets/css/style.css  –  5651 Admin Panel & Wi-Fi Portal
   Mobile-first responsive design
   ============================================================ */

/* ── Design Tokens ── */
:root {
    --primary:        #4F46E5;
    --primary-hover:  #4338CA;
    --secondary:      #10B981;
    --dark:           #1F2937;
    --light:          #F3F4F6;
    --white:          #FFFFFF;
    --danger:         #EF4444;
    --warning:        #F59E0B;
    --sidebar-w:      240px;
    --topbar-h:       56px;
    --radius:         0.625rem;
    --shadow:         0 1px 4px rgba(0,0,0,.1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }

/* ── Typography ── */
h2 { font-size: clamp(1.1rem, 4vw, 1.5rem); }
h3 { font-size: clamp(1rem, 3.5vw, 1.2rem); }

/* ── Customer Wi-Fi Portal ── */
.wifi-login-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px 16px 40px;
    background: linear-gradient(135deg, #4F46E5 0%, #10B981 100%);
}

.wifi-card {
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,.15);
}

.wifi-card h2 {
    text-align: center;
    margin-bottom: .4rem;
    color: var(--dark);
}

.wifi-card p {
    text-align: center;
    color: #6B7280;
    margin-bottom: 1.6rem;
    font-size: .93rem;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: .4rem;
    color: #374151;
    font-size: .93rem;
}

.form-control {
    width: 100%;
    padding: .75rem 1rem;
    border: 1.5px solid #D1D5DB;
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.18);
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: .75rem 1.25rem;
    font-size: .95rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color .2s, opacity .2s, transform .1s;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    width: 100%;
}

.btn-primary:hover  { background-color: var(--primary-hover); }
.btn-primary:active { transform: scale(.98); }

/* ── Alerts ── */
.alert {
    padding: .875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
}

.alert-success { background-color: #D1FAE5; color: #065F46; border-left: 4px solid #10B981; }
.alert-error   { background-color: #FEE2E2; color: #991B1B; border-left: 4px solid #EF4444; }
.alert-warning { background-color: #FEF3C7; color: #92400E; border-left: 4px solid #F59E0B; }

/* ── Badges ── */
.badge {
    padding: .25rem .55rem;
    border-radius: 9999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background-color: #D1FAE5; color: #065F46; }
.badge-danger  { background-color: #FEE2E2; color: #991B1B; }


/* ============================================================
   ADMIN LAYOUT – Desktop sidebar + Mobile topbar/hamburger
   ============================================================ */

/* Top bar (mobile only) */
.topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--dark);
    color: var(--white);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.topbar-title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .5px;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: var(--white);
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 190;
}

.sidebar-overlay.visible { display: block; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background-color: var(--dark);
    color: var(--white);
    padding-top: 2rem;
    flex-shrink: 0;
    transition: transform .3s ease;
}

.sidebar h3 {
    text-align: center;
    margin: 0 0 1.5rem;
    font-size: .95rem;
    letter-spacing: 1.5px;
    color: #9CA3AF;
    text-transform: uppercase;
    padding: 0 16px;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: .875rem 1.25rem;
    color: #9CA3AF;
    text-decoration: none;
    font-size: .9rem;
    transition: background .2s, color .2s, border-left-color .2s;
    border-left: 3px solid transparent;
}

.nav-links li a:hover,
.nav-links li a.active {
    background-color: #374151;
    color: var(--white);
    border-left-color: var(--primary);
}

/* Main content */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--light);
    min-width: 0; /* prevents flex overflow */
}

/* ── Cards ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

/* ── Stats Grid ── */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--white);
    padding: 1.1rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    border-left: 4px solid var(--primary);
}

.stat-card.green  { border-color: var(--secondary); }
.stat-card.orange { border-color: var(--warning); }

.stat-info h4 {
    margin: 0 0 .35rem;
    color: #6B7280;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-info h2 {
    margin: 0;
    font-size: 1.6rem;
    color: var(--dark);
    line-height: 1;
}

/* ── Tables – Horizontal scroll wrapper ── */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px; /* force scroll on mobile */
}

th, td {
    padding: .75rem .875rem;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
    font-size: .875rem;
    white-space: nowrap;
}

th {
    background-color: #F9FAFB;
    color: #374151;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

tr:hover { background-color: #F9FAFB; }

/* ── Mobile card-rows (alternative to table on very small screens) ── */
@media (max-width: 480px) {
    /* allow wrapping text in td on small screens */
    th, td { white-space: normal; word-break: break-word; }
}


/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ── Tablet & below: show topbar, slide sidebar in ── */
@media (max-width: 768px) {

    /* Show top bar */
    .topbar { display: flex; }

    /* Push layout down by topbar height */
    .admin-layout {
        flex-direction: column;
        padding-top: var(--topbar-h);
    }

    /* Sidebar becomes a fixed drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 195;
        transform: translateX(-100%);
        width: 260px;
        padding-top: calc(var(--topbar-h) + 1rem);
        overflow-y: auto;
    }

    .sidebar.open { transform: translateX(0); }

    /* Main content full width */
    .main-content {
        padding: 1rem;
        width: 100%;
    }

    /* Stats – 2 columns on tablet */
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
    }

    /* Card padding tighter */
    .card { padding: 1rem; }

    /* Form row stacking */
    .add-ban-form,
    .filter-form-row {
        flex-direction: column !important;
    }

    .add-ban-form select,
    .add-ban-form input[type="text"],
    #userSearch {
        width: 100% !important;
        min-width: unset !important;
    }

    /* Users header wrap */
    .users-header,
    .ban-header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .users-header > div:last-child,
    .ban-header > div:last-child {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* Ban stats – 2 col */
    .ban-stats {
        grid-template-columns: 1fr 1fr !important;
        display: grid !important;
    }

    /* Filters form */
    .filter-form-inline {
        flex-direction: column;
    }

    .filter-form-inline input,
    .filter-form-inline .btn { width: 100% !important; }
}

/* ── Phone: stats single col ── */
@media (max-width: 480px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .ban-stats {
        grid-template-columns: 1fr !important;
    }

    .stat-info h2 { font-size: 1.3rem; }

    th, td { padding: .5rem .625rem; }

    .wifi-card { padding: 1.5rem 1rem; }

    .btn { font-size: .9rem; }
}

/* ── Large Desktop ── */
@media (min-width: 1200px) {
    .main-content { padding: 2rem; }
    .dashboard-stats { grid-template-columns: repeat(3, 1fr); }
}
