/* ═══════════════════════════════════════════════════════════
   GroupSync — Business Grade V3.2 (Enterprise Edition)
   Scale: Solid & Premium | Palette: Teal & Deep Slate
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* ── Enterprise Palette (Deep & Solid) ── */
    --brand-50: #f0fdfa;
    --brand-100: #ccfbf1;
    --brand-200: #99f6e4;
    --brand-500: #14b8a6;
    --brand-600: #0d9488;
    /* Primary Hub */
    --brand-700: #0f766e;
    --brand-900: #134e4a;

    --secondary-50: #eff6ff;
    --secondary-600: #2563eb;

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --success-500: #10b981;
    --error-500: #ef4444;
    --warning-500: #f59e0b;

    --white: #ffffff;

    /* ── V3 Spacing & Scale ── */
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 32px;

    /* ── Shadows & Depth ── */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-premium: 0 25px 50px -12px rgba(13, 148, 136, 0.15);

    --transition-spring: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ GLOBAL RESET ═══ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #f6f9fc;
    color: var(--slate-800);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    font-size: 15px;
}

/* ═══════════════════════════════════════
   PREMIUM GLASS HEADER
   ═══════════════════════════════════════ */
.corp-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 2px solid var(--brand-50);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 60px;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--brand-600);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-premium);
}

.brand-text-corp {
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.03em;
    color: var(--slate-900);
}

.brand-badge {
    font-size: 12px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    margin-left: 12px;
}

/* ═══════════════════════════════════════
   MAIN CONTAINER
   ═══════════════════════════════════════ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 50px 60px;
}

.page-title-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

.page-title-section h1 {
    font-size: 40px;
    font-weight: 900;
    color: var(--slate-900);
    letter-spacing: -0.05em;
}

.action-buttons-top {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-card {
    background: var(--white);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--white);
    box-shadow: var(--shadow-md);
    transition: var(--transition-spring);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-100);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--brand-500);
    opacity: 0.3;
}

.stat-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--slate-400);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: block;
}

.stat-value {
    font-size: 42px;
    font-weight: 900;
    color: var(--slate-900);
    letter-spacing: -0.04em;
}

/* TABS */
.tabs-navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    background: var(--slate-100);
    padding: 6px;
    border-radius: 14px;
    width: fit-content;
}

.tab-btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 800;
    color: var(--slate-500);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    background: transparent;
}

.tab-btn.active {
    background: var(--white);
    color: var(--brand-600);
    box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════
   TOOLBAR & REGIONAL FILTERS (V6.9)
   ═══════════════════════════════════════ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 320px;
}

.search-input {
    width: 100%;
    background: var(--white);
    border: 2px solid #edf2f7;
    padding: 16px 20px 16px 56px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    color: var(--slate-800);
}

.search-input:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 5px rgba(20, 184, 166, 0.1);
}

.search-icon-fixed {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-400);
}

.geo-filters-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.geo-select {
    min-width: 150px;
    height: 48px;
    background-color: var(--white);
    border: 2px solid var(--slate-100);
    border-radius: 12px;
    padding: 0 18px;
    font-weight: 700;
    color: var(--slate-700);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.geo-select:hover {
    border-color: var(--brand-500);
}

.geo-select:focus {
    border-color: var(--brand-500);
    outline: none;
}

.btn-premium {
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--brand-600);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(13, 148, 136, 0.2);
}

.btn-secondary {
    background: var(--white);
    color: var(--slate-700);
    border: 2px solid var(--slate-100);
}

.btn-premium:hover {
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════
   THE DATA TABLE (Business Grade)
   ═══════════════════════════════════════════════════════════ */
.table-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    width: 100%;
    border: 1px solid var(--slate-200);
}

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.premium-table thead {
    background: var(--slate-100);
    border-bottom: 2px solid var(--slate-200);
}

.premium-table th {
    padding: 20px 24px;
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-bottom: 2px solid var(--slate-200);
    white-space: nowrap;
}

.premium-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--slate-100);
    vertical-align: middle;
    transition: background 0.2s ease;
}

.premium-table tr:hover td {
    background: #fbfcfe;
}

.premium-table tr td:first-child {
    border-left: 3px solid transparent;
}

.premium-table tr:hover td:first-child {
    border-left-color: var(--brand-500);
}

/* Specific Column Control */
.col-serial {
    width: 90px;
    font-weight: 800;
    color: var(--slate-500);
}

.col-voter {
    width: 130px;
    font-family: monospace;
    font-weight: 700;
    color: var(--slate-800);
}

.col-identity {
    min-width: 250px;
}

.col-details {
    width: 200px;
}

.col-status {
    width: 140px;
    text-align: center;
}

.member-identity {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--brand-50);
    border: 1.5px solid var(--brand-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-700);
    font-weight: 800;
    font-size: 14px;
}

.member-name {
    font-weight: 700;
    color: var(--slate-900);
    display: block;
    font-size: 15px;
}

.member-phone {
    font-family: monospace;
    font-weight: 800;
    color: var(--brand-700);
    font-size: 15px;
}

/* Business Grade Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
    line-height: 1;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-valid {
    background: var(--brand-50);
    color: var(--brand-700);
    border: 1px solid var(--brand-100);
}

.status-valid .status-dot {
    background: var(--brand-600);
    box-shadow: 0 0 8px var(--brand-200);
}

.status-invalid {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.status-invalid .status-dot {
    background: #e11d48;
}

/* ═══════════════════════════════════════
   DRAWERS & FORMS
   ═══════════════════════════════════════ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.drawer-wrapper {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    visibility: hidden;
}

.drawer-wrapper.active {
    pointer-events: all;
    visibility: visible;
}

.drawer-blur {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.drawer-wrapper.active .drawer-blur {
    opacity: 1;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: -650px;
    width: 620px;
    height: 100%;
    background: var(--white);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.15);
    transition: right 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: none;
    flex-direction: column;
}

.drawer-wrapper.active .drawer-panel {
    right: 0;
}

.drawer-header {
    padding: 40px 48px;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--slate-900);
    letter-spacing: -0.04em;
}

.drawer-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--slate-50);
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.drawer-content {
    padding: 48px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.drawer-content::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.form-field {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--slate-400);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 20px;
    border-radius: 12px;
    border: 2px solid var(--slate-100);
    font-size: 15px;
    font-weight: 600;
    color: var(--slate-800);
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-500);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.1);
}

.upload-drop-zone {
    border: 3px dashed var(--slate-200);
    border-radius: 20px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-drop-zone:hover {
    border-color: var(--brand-400);
    background: var(--brand-50);
}

.drawer-footer {
    padding: 40px 48px;
    background: var(--slate-50);
    border-top: 1px solid var(--slate-100);
}

/* TOASTS */
.toast-stack {
    position: fixed;
    bottom: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 3000;
}

.premium-toast {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 380px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 6px solid var(--brand-500);
}

.action-pill {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--slate-900);
    color: white;
    padding: 10px 10px 10px 28px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 1500;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.btn-whatsapp-pill {
    background: var(--brand-600);
    color: white;
    padding: 14px 32px;
    border-radius: 100px;
    font-weight: 800;
    border: none;
    cursor: pointer;
}

/* WHATSAPP BTN */
.btn-whatsapp-create {
    width: 100%;
    padding: 22px 32px;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, #25D366, #128C7E);
    box-shadow: 0 12px 30px rgba(37, 211, 102, 0.3);
    border: none;
    cursor: pointer;
}

/* V3.2 Shimmer Skeleton */

.skeleton {
    background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-50) 50%, var(--slate-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ═══════════════════════════════════════
   PAGINATION (Premium V3.2)
   ═══════════════════════════════════════ */
.pagination-container {
    padding: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-top: 1px solid var(--slate-100);
}

.page-info {
    font-size: 13px;
    font-weight: 700;
    color: var(--slate-500);
}

.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    border: 2px solid var(--slate-100);
    background: var(--white);
    color: var(--slate-600);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover {
    border-color: var(--brand-500);
    color: var(--brand-600);
    background: var(--brand-50);
}

.pagination-btn.active {
    background: var(--brand-600);
    color: white;
    border-color: var(--brand-600);
    box-shadow: 0 8px 15px rgba(13, 148, 136, 0.2);
}

.pagination-dots {
    color: var(--slate-400);
    font-weight: 800;
    padding: 0 4px;
}

/* Fix for Button disappearing on smaller screens */
/* ═══════════════════════════════════════
   AUTOMATION OVERLAY (V4.0)
   ═══════════════════════════════════════ */
.automation-spinner {
    margin: 0 auto;
    width: 100%;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-item {
    transition: var(--transition-smooth);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.status-item.active {
    color: var(--brand-600) !important;
    background: var(--brand-50);
    border-color: var(--brand-100);
}

.status-item.completed {
    color: var(--success-600) !important;
}

.status-item.completed .status-icon {
    color: var(--success-500);
}

.status-icon {
    display: inline-block;
    width: 24px;
    font-size: 20px;
    text-align: center;
}

/* ═══════════════════════════════════════
   DRAWER ELEMENTS (V7.2)
   ═══════════════════════════════════════ */
.drawer-geo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* ═══════════════════════════════════════
   RESPONSIVE OVERRIDES (V7.0)
   ═══════════════════════════════════════ */

/* Tablet & Smaller (1024px) */
@media (max-width: 1024px) {
    .corp-header {
        padding: 0 30px;
    }

    .main-container {
        padding: 30px;
    }

    .page-title-section h1 {
        font-size: 32px;
    }

    .stat-value {
        font-size: 36px;
    }
}

/* Tablets & Mobile (768px) */
@media (max-width: 768px) {
    .page-title-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .action-buttons-top {
        width: 100%;
        flex-direction: column;
        gap: 12px;
    }

    .action-buttons-top button {
        width: 100%;
        justify-content: center;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        min-width: 100%;
    }

    .geo-filters-toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .geo-select {
        min-width: 0;
    }

    .drawer-panel {
        width: 100%;
        right: -100%;
    }
}

/* Phones (480px) */
@media (max-width: 480px) {
    .corp-header {
        height: 70px;
        padding: 0 20px;
    }

    .logo-icon {
        width: 34px;
        height: 34px;
    }

    .brand-text-corp {
        font-size: 18px;
    }

    .main-container {
        padding: 20px;
    }

    .page-title-section h1 {
        font-size: 26px;
    }

    .action-buttons-top {
        flex-direction: column;
        width: 100%;
    }

    .action-buttons-top button {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    .tabs-navigation {
        width: 100%;
    }

    .tab-btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 13px;
    }

    .geo-filters-toolbar {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
        gap: 12px;
    }

    .drawer-geo-grid {
        grid-template-columns: 1fr;
    }

    .drawer-header,
    .drawer-content,
    .drawer-footer {
        padding: 24px;
    }

    .drawer-title {
        font-size: 24px;
    }

    .premium-table th,
    .premium-table td {
        padding: 12px 16px;
    }

    .member-identity {
        gap: 10px;
    }

    .avatar-circle {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .member-name {
        font-size: 14px;
    }

    .member-phone {
        font-size: 14px;
    }

    .toast-stack {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    .premium-toast {
        min-width: 0;
        width: 100%;
    }

    /* ── Mobile Card Table (No Scroll Fix) ── */
    .table-wrapper {
        background: transparent;
        box-shadow: none;
        border: none;
        overflow: visible;
    }

    .premium-table,
    .premium-table thead,
    .premium-table tbody,
    .premium-table th,
    .premium-table td,
    .premium-table tr {
        display: block;
    }

    .premium-table thead {
        display: none;
        /* Hide headers on mobile */
    }

    .premium-table tr {
        background: var(--white);
        margin-bottom: 20px;
        padding: 20px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
        border: 1px solid var(--slate-100);
        position: relative;
    }

    .premium-table td {
        padding: 10px 0 !important;
        border: none !important;
        width: 100% !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Column Specifics in Card View */
    .premium-table td:first-child {
        position: absolute;
        top: 20px;
        right: 20px;
        width: auto !important;
        background: var(--slate-100);
        padding: 4px 10px !important;
        border-radius: 6px;
        font-size: 11px;
    }

    .premium-table td.col-identity {
        padding-top: 0 !important;
        margin-bottom: 15px;
        border-bottom: 1px solid var(--slate-50) !important;
        padding-bottom: 15px !important;
        display: block;
    }

    .premium-table td.col-details::before {
        content: "Contact:";
        font-size: 11px;
        font-weight: 800;
        color: var(--slate-400);
        text-transform: uppercase;
    }

    .premium-table td.col-voter::before {
        content: "Voter ID:";
        font-size: 11px;
        font-weight: 800;
        color: var(--slate-400);
        text-transform: uppercase;
    }

    .premium-table tr:hover td:first-child {
        border-left: none;
    }
}