/* ============================================================
   TAXSAFAR WHATSAPP MARKETING TOOL
   assets/css/style.css
   ============================================================ */

/* ------------------------------------------------------------
   MOBILE SIDEBAR OVERLAY
   ------------------------------------------------------------ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
}
.sidebar-overlay.active { display: block; }

/* Hamburger button */
.hamburger-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: #374151;
    padding: 4px 6px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
}
.hamburger-btn:hover { background: #f3f4f6; }

/* ------------------------------------------------------------
   RESET & BASE
   ------------------------------------------------------------ */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: #f3f4f6;
    color: #1f2937;
    margin: 0;
    padding: 0;
}

/* ------------------------------------------------------------
   APP LAYOUT
   ------------------------------------------------------------ */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    display: flex;
    flex: 1;
    padding-top: 52px; /* topbar height */
}

/* ------------------------------------------------------------
   TOPBAR
   ------------------------------------------------------------ */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: #185FA5;
}

.logo-icon {
    background: #E6F1FB;
    color: #185FA5;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}

.topbar-user { font-size: 13px; color: #374151; }

/* ------------------------------------------------------------
   SIDEBAR
   ------------------------------------------------------------ */
.sidebar {
    width: 210px;
    min-width: 210px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    height: calc(100vh - 52px);
    position: sticky;
    top: 52px;
    overflow-y: auto;
}

.nav-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    padding: 12px 16px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s;
}

.nav-item i {
    font-size: 15px;
    opacity: 0.7;
    width: 18px;
}

.nav-item:hover {
    background: #f9fafb;
    color: #185FA5;
    text-decoration: none;
}

.nav-item.active {
    background: #EBF4FF;
    color: #185FA5;
    border-left-color: #185FA5;
    font-weight: 500;
}

.nav-item.active i { opacity: 1; }

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid #f3f4f6;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
}

.api-status.connected { color: #15803d; }
.api-status.disconnected { color: #b91c1c; }

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.api-status.connected .status-dot { background: #22c55e; }
.api-status.disconnected .status-dot { background: #ef4444; }

/* ------------------------------------------------------------
   MAIN CONTENT
   ------------------------------------------------------------ */
.main-content {
    flex: 1;
    overflow-x: hidden;
}

.page-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.page-body {
    padding: 20px 24px;
}

/* ------------------------------------------------------------
   STAT CARDS
   ------------------------------------------------------------ */
.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 600;
    color: #111827;
    line-height: 1;
}

.stat-sub {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* ------------------------------------------------------------
   CARDS
   ------------------------------------------------------------ */
.card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 500;
    font-size: 13px;
    background: transparent;
}

.card-body { padding: 16px; }

/* ------------------------------------------------------------
   TABLES
   ------------------------------------------------------------ */
.table { font-size: 13px; }
.table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    background: #f9fafb;
}
.table td {
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f9fafb; }

/* ------------------------------------------------------------
   PROGRESS BAR
   ------------------------------------------------------------ */
.progress { height: 6px; border-radius: 3px; background: #f3f4f6; }
.progress-bar { border-radius: 3px; background: #185FA5; }

/* ------------------------------------------------------------
   BADGES
   ------------------------------------------------------------ */
.badge { font-size: 11px; font-weight: 500; padding: 4px 8px; border-radius: 20px; }

/* ------------------------------------------------------------
   FORMS
   ------------------------------------------------------------ */
.form-label { font-size: 12px; font-weight: 500; color: #374151; margin-bottom: 4px; }
.form-control, .form-select {
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 7px 10px;
    color: #1f2937;
}
.form-control:focus, .form-select:focus {
    border-color: #185FA5;
    box-shadow: 0 0 0 3px rgba(24,95,165,0.1);
}

/* ------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------ */
.btn { font-size: 13px; border-radius: 6px; padding: 6px 14px; }
.btn-primary { background: #185FA5; border-color: #185FA5; }
.btn-primary:hover { background: #0e4a84; border-color: #0e4a84; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ------------------------------------------------------------
   UPLOAD ZONE
   ------------------------------------------------------------ */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 36px;
    text-align: center;
    color: #9ca3af;
    cursor: default;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: #185FA5;
    background: #EBF4FF;
    color: #185FA5;
}

.upload-zone.dragover {
    border-color: #185FA5;
    background: #EBF4FF;
    color: #185FA5;
}

.upload-zone .upload-icon { font-size: 32px; margin-bottom: 10px; }

/* ------------------------------------------------------------
   FILTER TAGS
   ------------------------------------------------------------ */
.filter-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #d1d5db;
    font-size: 12px;
    cursor: pointer;
    margin: 2px;
    color: #374151;
    background: #fff;
    transition: all 0.15s;
}

.filter-tag:hover { border-color: #185FA5; color: #185FA5; }
.filter-tag.selected { background: #185FA5; color: #fff; border-color: #185FA5; }

/* ------------------------------------------------------------
   WHATSAPP PREVIEW BUBBLE
   ------------------------------------------------------------ */
.wa-preview {
    background: #e2f7cb;
    border-radius: 10px 10px 2px 10px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #111827;
    max-width: 300px;
    word-break: break-word;
}

.wa-preview-btn {
    border: 1px solid #b2dfdb;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    font-size: 12px;
    color: #00796b;
    margin-top: 6px;
    background: rgba(255,255,255,0.6);
}

.wa-phone-frame {
    background: #ECE5DD;
    border-radius: 14px;
    padding: 20px 14px;
    max-width: 280px;
}

.wa-sender {
    font-size: 12px;
    font-weight: 600;
    color: #185FA5;
    margin-bottom: 6px;
}

/* ------------------------------------------------------------
   RATE OPTIONS
   ------------------------------------------------------------ */
.rate-option {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    color: #6b7280;
    transition: all 0.15s;
}

.rate-option:hover { border-color: #185FA5; color: #185FA5; }
.rate-option.selected { border-color: #185FA5; background: #EBF4FF; color: #185FA5; font-weight: 500; }
.rate-option .rate-sub { font-size: 10px; margin-top: 2px; }

/* ------------------------------------------------------------
   ALERTS
   ------------------------------------------------------------ */
.alert { font-size: 13px; border-radius: 8px; }

/* ------------------------------------------------------------
   MISC
   ------------------------------------------------------------ */
.text-muted { color: #9ca3af !important; font-size: 12px; }
.section-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 12px; }
.divider { border: none; border-top: 1px solid #f3f4f6; margin: 16px 0; }
.mono { font-family: 'Courier New', monospace; font-size: 12px; }

/* ------------------------------------------------------------
   MOBILE RESPONSIVE — Sidebar slide-in
   ------------------------------------------------------------ */
@media (max-width: 991px) {

    /* Sidebar hidden off-screen on mobile */
    .sidebar {
        position: fixed;
        top: 52px;
        left: -220px;
        height: calc(100vh - 52px);
        z-index: 999;
        transition: left 0.25s ease;
        box-shadow: none;
    }

    /* Sidebar open state */
    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.12);
    }

    /* Main content takes full width on mobile */
    .main-content {
        width: 100%;
    }

    /* Page body padding reduced on mobile */
    .page-body { padding: 14px; }
    .page-header { padding: 12px 14px; }

    /* Stat grid — 2 columns on mobile */
    .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }

    /* Tables scroll horizontally */
    .card .table-responsive-wrap { overflow-x: auto; }

    /* Upload zone smaller on mobile */
    .upload-zone { padding: 20px; }

    /* Rate options stack on very small screens */
    .rate-option { min-width: 60px; font-size: 12px; }

    /* WA preview frame smaller */
    .wa-phone-frame { max-width: 100%; }
}

@media (max-width: 575px) {
    .page-title { font-size: 14px; }
    .stat-value { font-size: 20px; }
    .btn { font-size: 12px; }

    /* Campaign detail stats — 3 cols on very small */
    .col-6.col-md-2 { flex: 0 0 33.333%; max-width: 33.333%; }
}
