/* ── ADSY Website Admin Admin CSS ─────────────────────────────────────────── */
/* Design: Clean, WordPress-inspired SaaS dashboard. NOT a copy of portal.css   */

/* ── Variables ───────────────────────────────────────────────────────────────── */
:root {
    --wa-primary:       #1769FF;
    --wa-primary-hover: #1255d4;
    --wa-sidebar-bg:    #1e293b;
    --wa-sidebar-text:  #94a3b8;
    --wa-sidebar-hover: #334155;
    --wa-sidebar-active-border: #1769FF;
    --wa-body-bg:       #F4F6F8;
    --wa-card-bg:       #ffffff;
    --wa-text:          #1e293b;
    --wa-text-muted:    #64748b;
    --wa-success:       #10b981;
    --wa-danger:        #ef4444;
    --wa-warning:       #f59e0b;
    --wa-sidebar-width: 220px;
    --wa-topnav-height: 56px;
    --wa-transition:    0.25s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--wa-body-bg);
    color: var(--wa-text);
    margin: 0;
    min-height: 100vh;
    font-size: 0.9rem;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────────── */
.wa-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--wa-sidebar-width);
    height: 100vh;
    background: var(--wa-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--wa-transition), width var(--wa-transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.wa-sidebar.collapsed {
    transform: translateX(calc(-1 * var(--wa-sidebar-width)));
}

.wa-sidebar-brand {
    padding: 0 1rem;
    height: var(--wa-topnav-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.wa-brand-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.wa-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.wa-brand-text {
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.wa-sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.wa-sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wa-nav-section {
    padding: 0.9rem 1rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    pointer-events: none;
}

.wa-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1rem;
    color: var(--wa-sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: background var(--wa-transition), color var(--wa-transition), border-color var(--wa-transition);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.wa-nav-link i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.wa-nav-link:hover {
    background: var(--wa-sidebar-hover);
    color: #e2e8f0;
    border-left-color: rgba(23,105,255,0.4);
}

.wa-nav-link.active {
    background: rgba(23,105,255,0.1);
    color: #ffffff;
    border-left-color: var(--wa-sidebar-active-border);
    font-weight: 500;
}

/* ── Top Navbar ───────────────────────────────────────────────────────────────── */
.wa-topnav {
    position: fixed;
    top: 0;
    left: var(--wa-sidebar-width);
    right: 0;
    height: var(--wa-topnav-height);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 999;
    transition: left var(--wa-transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.wa-topnav.expanded {
    left: 0;
}

.wa-topnav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.wa-sidebar-toggle {
    background: none;
    border: none;
    color: var(--wa-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background var(--wa-transition), color var(--wa-transition);
    line-height: 1;
}

.wa-sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--wa-text);
}

.wa-page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wa-text);
}

.wa-topnav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wa-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    transition: background var(--wa-transition);
    color: var(--wa-text);
}

.wa-user-btn:hover { background: #f1f5f9; }

.wa-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--wa-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.wa-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wa-text);
}

/* ── Main Content Area ────────────────────────────────────────────────────────── */
.wa-main {
    margin-left: var(--wa-sidebar-width);
    padding-top: var(--wa-topnav-height);
    min-height: 100vh;
    transition: margin-left var(--wa-transition);
}

.wa-main.expanded {
    margin-left: 0;
}

.wa-content {
    padding: 1.75rem;
    max-width: 1400px;
}

/* ── Cards ─────────────────────────────────────────────────────────────────────── */
.wa-card {
    background: var(--wa-card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    border: none;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.wa-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.wa-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wa-text);
    margin: 0;
}

/* ── Stat Cards ────────────────────────────────────────────────────────────────── */
.wa-stat-card {
    background: var(--wa-card-bg);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.wa-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.wa-stat-icon.blue   { background: rgba(23,105,255,0.1);  color: var(--wa-primary); }
.wa-stat-icon.green  { background: rgba(16,185,129,0.1);  color: var(--wa-success); }
.wa-stat-icon.orange { background: rgba(245,158,11,0.1);  color: var(--wa-warning); }
.wa-stat-icon.red    { background: rgba(239,68,68,0.1);   color: var(--wa-danger);  }

.wa-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--wa-text);
    line-height: 1;
}

.wa-stat-label {
    font-size: 0.8rem;
    color: var(--wa-text-muted);
    margin-top: 0.2rem;
}

/* ── Quick Action Cards ────────────────────────────────────────────────────────── */
.wa-action-card {
    background: var(--wa-card-bg);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    text-align: center;
    text-decoration: none;
    color: var(--wa-text);
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wa-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    color: var(--wa-primary);
}

.wa-action-card i {
    font-size: 1.5rem;
    color: var(--wa-primary);
    margin-bottom: 0.6rem;
    display: block;
}

.wa-action-card span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ── Page Header ───────────────────────────────────────────────────────────────── */
.wa-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.wa-page-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--wa-text);
    margin: 0;
}

/* ── Buttons ───────────────────────────────────────────────────────────────────── */
.btn-wa-primary {
    background: var(--wa-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background var(--wa-transition);
}

.btn-wa-primary:hover { background: var(--wa-primary-hover); color: #fff; }

.btn-wa-secondary {
    background: #f1f5f9;
    color: var(--wa-text);
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1.25rem;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background var(--wa-transition);
}

.btn-wa-secondary:hover { background: #e2e8f0; color: var(--wa-text); }

/* ── Tables ─────────────────────────────────────────────────────────────────────── */
.wa-table-wrap {
    overflow-x: auto;
}

.wa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.wa-table th {
    background: #f8fafc;
    color: var(--wa-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.wa-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--wa-text);
    vertical-align: middle;
}

.wa-table tr:last-child td { border-bottom: none; }

.wa-table tr:hover td { background: #fafbfc; }

/* ── Forms ──────────────────────────────────────────────────────────────────────── */
.wa-form-card {
    background: var(--wa-card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    padding: 1.75rem;
    max-width: 720px;
}

.wa-form-section {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wa-text-muted);
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #f1f5f9;
}

.wa-form-section:first-child { margin-top: 0; }

/* ── Status Badges ─────────────────────────────────────────────────────────────── */
.wa-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.wa-badge-active   { background: rgba(16,185,129,0.1);  color: #059669; }
.wa-badge-inactive { background: rgba(239,68,68,0.1);   color: #dc2626; }

/* ── Login Page ─────────────────────────────────────────────────────────────────── */
.wa-login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #F4F6F8 0%, #e8edf5 100%);
    padding: 1rem;
}

.wa-login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.wa-login-logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.wa-login-logo img {
    height: 40px;
    width: auto;
}

.wa-login-subtitle {
    text-align: center;
    color: var(--wa-text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.wa-login-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--wa-text);
    margin-bottom: 0.25rem;
}

.wa-login-card .form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--wa-text);
}

.wa-login-card .form-control {
    border-color: #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.wa-login-card .form-control:focus {
    border-color: var(--wa-primary);
    box-shadow: 0 0 0 3px rgba(23,105,255,0.12);
}

.wa-login-card .btn-wa-primary {
    width: 100%;
    justify-content: center;
    padding: 0.65rem;
    font-size: 0.95rem;
    border-radius: 8px;
}

/* ── Welcome Banner ────────────────────────────────────────────────────────────── */
.wa-welcome {
    background: linear-gradient(135deg, var(--wa-primary) 0%, #3b82f6 100%);
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

.wa-welcome h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
}

.wa-welcome p {
    margin: 0;
    opacity: 0.85;
    font-size: 0.875rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────────────── */
/* ── Responsive ─────────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    :root {
        -webkit-tap-highlight-color: transparent;
    }

    body {
        overscroll-behavior-y: none;
        overflow-x: hidden !important;
    }

    .wa-sidebar {
        transform: translateX(calc(-1 * var(--wa-sidebar-width)));
        z-index: 1020 !important;
    }

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

    .wa-topnav {
        left: 0 !important;
    }

    .wa-main {
        margin-left: 0 !important;
    }

    .wa-content {
        padding: 1rem !important;
    }

    .wa-user-name {
        display: none !important;
    }

    /* Page title truncation */
    .wa-page-title {
        max-width: 160px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Touch target nav links */
    .wa-sidebar-nav .wa-nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
    }

    /* Touch target helpers */
    .btn-wa-primary,
    .btn-wa-secondary,
    .dropdown-toggle,
    .dropdown-item {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center;
    }
}

/* ── Mobile Specific (max-width: 576px) ─────────────────────────── */
@media (max-width: 576px) {
    .wa-page-title {
        max-width: 100px;
    }

    /* Stat Cards Stacked */
    .row > [class*="col-"]:has(.wa-stat-card) {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .wa-stat-card {
        padding: 1rem 1.25rem !important;
    }

    /* Quick Action Cards (2-per-row) */
    .wa-action-card {
        padding: 1rem 0.5rem !important;
    }
    .wa-action-card i {
        font-size: 1.25rem !important;
        margin-bottom: 0.4rem !important;
    }

    /* Table to Card Conversion */
    .wa-table-wrap,
    .table-responsive {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        overflow-x: visible !important;
    }

    .wa-table-wrap .wa-table,
    .table-responsive .table {
        display: block !important;
        background: transparent !important;
        width: 100% !important;
    }

    .wa-table-wrap .wa-table thead,
    .table-responsive .table thead {
        display: none !important;
    }

    .wa-table-wrap .wa-table tbody,
    .table-responsive .table tbody {
        display: block !important;
    }

    .wa-table-wrap .wa-table tbody tr,
    .table-responsive .table tbody tr {
        display: block !important;
        background: var(--wa-card-bg) !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 10px !important;
        padding: 0.75rem 1rem !important;
        margin-bottom: 0.75rem !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.07) !important;
    }

    .wa-table-wrap .wa-table tbody tr:hover td,
    .table-responsive .table tbody tr:hover td {
        background: transparent !important;
    }

    .wa-table-wrap .wa-table tbody td,
    .table-responsive .table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.4rem 0 !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 0.85rem !important;
        text-align: right !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .wa-table-wrap .wa-table tbody td:last-child,
    .table-responsive .table tbody td:last-child {
        border-bottom: none !important;
    }

    .wa-table-wrap .wa-table tbody td::before,
    .table-responsive .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--wa-text-muted);
        flex-shrink: 0;
        margin-right: 1rem;
        text-align: left;
    }

    /* Forms */
    .wa-form-card {
        max-width: 100% !important;
        padding: 1.25rem !important;
    }
    .form-control,
    .form-select,
    textarea.form-control {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevent iOS zoom */
    }
    form button[type="submit"],
    form .btn-wa-primary {
        width: 100% !important;
        justify-content: center !important;
        min-height: 44px !important;
    }

    /* Page Headers */
    .wa-page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    .wa-page-header h1 {
        font-size: 1.15rem !important;
    }
    .wa-page-header .btn-wa-primary,
    .wa-page-header .btn-wa-secondary {
        width: 100% !important;
        justify-content: center !important;
        min-height: 44px !important;
    }

    /* Welcome Banner */
    .wa-welcome {
        padding: 1.25rem 1.5rem !important;
    }

    /* Cards stacking */
    .wa-card {
        padding: 1.25rem !important;
    }
    .wa-card-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    .wa-card-header .btn-wa-secondary,
    .wa-card-header .btn-wa-primary {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ── Mobile sidebar overlay ─────────────────────────────────────────────────────── */
#waSidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1019;
}
#waSidebarOverlay.active { display: block; }

/* ── Utilities ──────────────────────────────────────────────────────────────────── */
.text-wa-primary { color: var(--wa-primary) !important; }
.text-wa-muted   { color: var(--wa-text-muted) !important; }
.bg-wa-light     { background: var(--wa-body-bg) !important; }
