@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* =============================================
   GLOBAL RESET & BASE
============================================= */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

/* =============================================
   AUTH PAGES (Login / Register)
============================================= */
.auth-page {
    min-height: 100vh;
    display: flex;
}

.auth-panel-left {
    width: 45%;
    background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 60%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 64px;
    position: relative;
    overflow: hidden;
}

.auth-panel-left::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(59,130,246,0.08);
    top: -100px;
    right: -100px;
}

.auth-panel-left::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(99,102,241,0.07);
    bottom: -80px;
    left: -80px;
}

.auth-panel-left .brand {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.auth-logo-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.15);
}

.auth-logo-img {
    height: 34px;
    max-height: 34px;
    width: auto;
    object-fit: contain;
    display: block;
}

.auth-panel-left h1 {
    font-size: 40px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -1px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.auth-panel-left p {
    font-size: 16px;
    color: #94a3b8;
    line-height: 1.7;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

.auth-panel-left .feature-list {
    margin-top: 40px;
    list-style: none;
    padding: 0;
    position: relative;
    z-index: 1;
}

.auth-panel-left .feature-list li {
    color: #cbd5e1;
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-panel-left .feature-list li::before {
    content: '✓';
    width: 20px;
    height: 20px;
    background: rgba(59,130,246,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #60a5fa;
    flex-shrink: 0;
}

.auth-panel-right {
    width: 55%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
}

.auth-form-container .auth-title {
    font-size: 30px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.auth-form-container .auth-subtitle {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 36px;
}

.auth-form-container .form-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.auth-form-container .form-control {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.2s;
    background: #f8fafc;
}

.auth-form-container .form-control:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.08);
}

.auth-form-container .btn-auth {
    width: 100%;
    padding: 14px;
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.auth-form-container .btn-auth:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15,23,42,0.18);
}

.auth-form-container .auth-footer-link {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #f1f5f9;
    font-size: 14px;
    color: #64748b;
}

.auth-form-container .auth-footer-link a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
}

.auth-form-container .auth-footer-link a:hover { text-decoration: underline; }

#message {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

@media (max-width: 768px) {
    .auth-panel-left { display: none; }
    .auth-panel-right { width: 100%; }
}

/* =============================================
   DASHBOARD LAYOUT
============================================= */
.sidebar {
    background-color: #0f172a;
    min-height: 100vh;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
    width: 250px;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

.sidebar .sidebar-logo {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: all 0.15s ease;
}

.sidebar-logo-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.28);
}

.sidebar-logo-img {
    height: 26px;
    max-height: 26px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #475569;
    padding: 20px 20px 8px;
}

.sidebar .nav-link {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    margin: 2px 10px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar .nav-link:hover {
    color: #f1f5f9;
    background-color: rgba(255,255,255,0.06);
}

.sidebar .nav-link.active {
    color: #ffffff;
    background-color: rgba(59,130,246,0.2);
    font-weight: 600;
}

.sidebar .nav-link.active i {
    color: #60a5fa;
}

.sidebar hr {
    border-color: rgba(255,255,255,0.07);
    margin: 10px 20px;
}

.sidebar-spacer { flex-grow: 1; }

.main-wrapper {
    margin-left: 250px;
    min-height: 100vh;
    background: #f8fafc;
}

.top-bar {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar .page-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.3px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.page-content { padding: 32px; }

/* =============================================
   METRIC CARDS
============================================= */
.stat-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 24px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 34px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -1px;
    line-height: 1;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* =============================================
   TABLES
============================================= */
.data-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}

.data-card .card-head {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-card .card-head h5 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 20px;
}

.table td {
    padding: 14px 20px;
    font-size: 14px;
    color: #334155;
    vertical-align: middle;
    border-bottom: 1px solid #f8fafc;
}

.table tbody tr:hover td { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: none; }

/* =============================================
   BOOTSTRAP OVERRIDES
============================================= */
.btn-primary {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
    background: #1e293b !important;
    border-color: #1e293b !important;
    box-shadow: none !important;
}

.badge.bg-success-soft {
    background: #dcfce7;
    color: #16a34a;
}

.badge.bg-warning-soft {
    background: #fef9c3;
    color: #854d0e;
}

.badge.bg-secondary-soft {
    background: #f1f5f9;
    color: #475569;
}

/* =============================================
   CAMPAIGN LIST
============================================= */
.campaign-row {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.campaign-row:last-child { border-bottom: none; }
.campaign-row:hover { background: #fafbfc; }

/* =============================================
   MOBILE RESPONSIVE SYSTEM
============================================= */

/* Backdrop overlay when mobile sidebar is open */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile Top Nav Bar */
.mobile-top-nav {
    display: none;
    background: #0f172a;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-logo-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
}

.mobile-logo-img {
    height: 22px;
    width: auto;
    object-fit: contain;
}

.mobile-menu-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mobile-menu-btn:hover, .mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Media Query: Tablets & Mobile Devices (<= 991px) */
@media (max-width: 991.98px) {
    /* Show mobile navigation bar */
    .mobile-top-nav {
        display: flex;
    }

    /* Off-canvas sidebar */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1050;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    }

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

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Top Bars */
    .top-bar {
        padding: 12px 16px !important;
        flex-wrap: wrap;
        gap: 10px;
    }

    .top-bar .page-title {
        font-size: 18px !important;
    }

    .page-content {
        padding: 16px !important;
    }

    /* Hero header */
    .dash-hero {
        padding: 20px 16px 50px !important;
    }

    .dash-hero .greeting {
        font-size: 20px !important;
    }

    .dash-hero .sub {
        font-size: 13px !important;
    }

    /* Stats pull up on Dashboard */
    .stats-pull-up {
        padding: 0 16px !important;
        margin-top: -35px !important;
    }

    .dash-body {
        padding: 16px !important;
    }

    /* Stats row on Campaigns, Sent Emails, and Individual Emails */
    .stat-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 16px !important;
    }

    .stat-box {
        padding: 12px 14px !important;
    }

    .stat-box .label {
        font-size: 11px !important;
    }

    .stat-box .value {
        font-size: 22px !important;
    }

    /* Toolbars (Search, Filter, Actions) */
    .toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 0 16px 14px !important;
    }

    .search-box {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Table cards */
    .table-card {
        margin: 0 16px 20px !important;
        border-radius: 10px !important;
        overflow-x: auto !important;
    }

    .contacts-card {
        margin: 0 !important;
        border-radius: 10px !important;
    }

    .cc-header {
        padding: 16px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* Tables responsiveness */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }

    .table th, .table td {
        padding: 10px 12px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    /* Profile Page Layout */
    .profile-container {
        padding: 16px !important;
    }

    /* Modals for Mobile */
    .modal-dialog {
        margin: 10px !important;
    }

    .modal-content {
        border-radius: 12px !important;
    }

    .modal-header, .modal-body, .modal-footer {
        padding: 16px !important;
    }

    /* Segmented switcher in campaign builder */
    .segmented-switcher {
        flex-direction: column !important;
    }

    .segmented-btn {
        width: 100% !important;
    }
}

/* Small smartphones (<= 576px) */
@media (max-width: 576px) {
    .stat-row {
        grid-template-columns: 1fr !important;
    }

    .dash-hero .d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .dash-hero .user-avatar {
        display: none !important;
    }
}