/* ============================================================
   FlowMail — Application Stylesheet
   ============================================================ */

/* -------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
------------------------------------------------------- */
:root {
    /* Brand Colors */
    --mf-primary:        #1d63ed;
    --mf-primary-dark:   #1550c4;
    --mf-primary-light:  #9dbcf7;
    --mf-secondary:      #0ea5e9;
    --mf-accent:         #0ea5e9;
    --mf-success:        #10b981;
    --mf-warning:        #f59e0b;
    --mf-danger:         #ef4444;
    --mf-info:           #06b6d4;

    /* Gradient */
    --mf-gradient:       linear-gradient(135deg, #1d63ed 0%, #1550c4 100%);
    --mf-gradient-2:     linear-gradient(135deg, #1d63ed 0%, #0b1b33 100%);

    /* Layout */
    --sidebar-width:     260px;
    --sidebar-collapsed: 70px;
    --navbar-height:     60px;

    /* Typography */
    --font-body:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading:      'Outfit', 'Inter', sans-serif;

    /* Surfaces */
    --surface-1:         #ffffff;
    --surface-2:         #f5f7fb;
    --surface-3:         #eef2f8;
    --sidebar-bg:        #0b1b33;
    --sidebar-text:      rgba(255,255,255,0.75);
    --sidebar-active:    rgba(255,255,255,0.1);
    --navbar-bg:         rgba(255,255,255,0.95);

    /* Borders */
    --border-color:      #e8eaef;
    --border-radius-sm:  8px;
    --border-radius:     12px;
    --border-radius-lg:  16px;
    --border-radius-xl:  24px;

    /* Shadows */
    --shadow-sm:         0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:            0 4px 16px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg:         0 12px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-primary:    0 8px 32px rgba(29,99,237,0.25);

    /* Transitions */
    --transition:        all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:   all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-bs-theme="dark"] {
    --surface-1:         #111c2e;
    --surface-2:         #0d1726;
    --surface-3:         #0f3460;
    --sidebar-bg:        #081426;
    --navbar-bg:         rgba(26,26,46,0.95);
    --border-color:      rgba(255,255,255,0.08);
}

/* -------------------------------------------------------
   2. Base Styles
------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: #1e1f35;
    background: var(--surface-2);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a { transition: var(--transition); }
a:hover { text-decoration: none; }

/* -------------------------------------------------------
   3. Layout — Sidebar
------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: var(--transition-slow);
    overflow: hidden;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
}

.main-content {
    flex: 1;
    padding-top: var(--navbar-height);
}

/* Sidebar Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--mf-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: var(--shadow-primary);
}

.brand-text {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.03em;
}

.brand-ai {
    background: var(--mf-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Workspace Switcher */
.sidebar-workspace {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: relative;
}

.workspace-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--sidebar-text);
}

.workspace-info:hover {
    background: rgba(255,255,255,0.06);
}

.workspace-avatar {
    width: 30px;
    height: 30px;
    background: var(--mf-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.workspace-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.workspace-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-org {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-dropdown {
    width: 240px;
    background: #111c2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius);
    padding: 8px;
}

.workspace-dropdown .dropdown-item {
    color: rgba(255,255,255,0.8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 8px 10px;
}

.workspace-dropdown .dropdown-item:hover { background: rgba(255,255,255,0.07); color: white; }
.workspace-dropdown .dropdown-item.active { background: var(--mf-primary); color: white; }

.ws-avatar-sm {
    width: 24px;
    height: 24px;
    background: var(--mf-gradient);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.3);
    padding: 16px 8px 6px;
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    padding: 9px 10px;
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    font-weight: 450;
    transition: var(--transition);
    margin-bottom: 2px;
}

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

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: white;
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    background: var(--mf-gradient);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(29,99,237,0.3);
}

/* AI Badge */
.badge-ai {
    font-size: 9px;
    font-weight: 700;
    background: var(--mf-gradient);
    color: white;
    padding: 2px 6px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.plan-badge {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--border-radius);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.plan-info { flex: 1; min-width: 0; }

.plan-name {
    font-size: 12px;
    font-weight: 600;
    color: white;
    display: block;
    margin-bottom: 4px;
}

.plan-usage {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    display: block;
    margin-top: 3px;
}

.btn-upgrade {
    font-size: 11px;
    font-weight: 700;
    background: var(--mf-gradient);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-upgrade:hover {
    color: white;
    opacity: 0.9;
    transform: scale(1.03);
}

/* -------------------------------------------------------
   4. Layout — Navbar
------------------------------------------------------- */
.app-navbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--navbar-height);
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    z-index: 1030;
    transition: var(--transition-slow);
    display: flex !important;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

/* Search Bar */
.search-bar .form-control {
    background: var(--surface-2);
    border-color: var(--border-color);
    font-size: 13px;
    width: 260px;
    transition: var(--transition);
}

.search-bar .input-group-text {
    border-color: var(--border-color);
}

.search-bar .form-control:focus {
    width: 320px;
    box-shadow: 0 0 0 3px rgba(29,99,237,0.1);
    border-color: var(--mf-primary);
}

/* Icon Buttons */
.btn-ghost-icon {
    width: 36px;
    height: 36px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 16px;
    padding: 0;
    transition: var(--transition);
}

.btn-ghost-icon:hover {
    background: var(--surface-3);
    color: var(--mf-primary);
    border-color: var(--mf-primary-light);
}

/* Notification Dot */
.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--mf-accent);
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Notification Panel */
.notification-panel {
    width: 360px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg) !important;
    overflow: hidden;
    padding: 0 !important;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.notification-body { max-height: 360px; overflow-y: auto; }

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.notification-item.unread { background: rgba(29,99,237,0.04); }
.notification-item:hover { background: var(--surface-2); }

.notification-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.notification-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-2);
}

/* User Avatar */
.user-avatar {
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.user-avatar:hover { border-color: var(--mf-primary); }

/* -------------------------------------------------------
   5. Cards & Components
------------------------------------------------------- */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    padding: 20px 24px;
    border-radius: var(--border-radius-lg);
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--mf-gradient);
}

.stat-card.primary::before { background: var(--mf-gradient); }
.stat-card.success::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.info::before { background: linear-gradient(90deg, #06b6d4, #0ea5e9); }

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

.stat-icon.primary { background: rgba(29,99,237,0.12); color: var(--mf-primary); }
.stat-icon.success { background: rgba(16,185,129,0.12); color: var(--mf-success); }
.stat-icon.warning { background: rgba(245,158,11,0.12); color: var(--mf-warning); }
.stat-icon.info { background: rgba(6,182,212,0.12); color: var(--mf-info); }

.stat-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 8px;
}

.stat-change.up { background: rgba(16,185,129,0.1); color: #059669; }
.stat-change.down { background: rgba(239,68,68,0.1); color: #dc2626; }

/* -------------------------------------------------------
   6. Page Header
------------------------------------------------------- */
.page-header {
    padding: 24px 24px 0;
    margin-bottom: 24px;
}

.page-header-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 2px;
    color: #111827;
}

.page-subtitle {
    font-size: 13px;
    color: #6b7280;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 12px;
    margin-bottom: 8px;
}

.breadcrumb-item + .breadcrumb-item::before { color: #9ca3af; }
.breadcrumb-item.active { color: #6b7280; }

/* -------------------------------------------------------
   7. Tables
------------------------------------------------------- */
.table-card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.table {
    font-size: 13.5px;
    margin-bottom: 0;
}

.table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody tr {
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: rgba(29,99,237,0.03); }

.table td { padding: 14px 16px; vertical-align: middle; }

/* -------------------------------------------------------
   8. Badges
------------------------------------------------------- */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.badge-success  { background: rgba(16,185,129,0.12); color: #059669; }
.badge-danger   { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-warning  { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-info     { background: rgba(6,182,212,0.12); color: #0891b2; }
.badge-primary  { background: rgba(29,99,237,0.12); color: #1550c4; }
.badge-secondary{ background: rgba(107,114,128,0.12); color: #4b5563; }
.badge-dark     { background: rgba(17,24,39,0.08); color: #111827; }

/* -------------------------------------------------------
   9. Buttons
------------------------------------------------------- */
.btn {
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 10px;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--mf-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(29,99,237,0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(29,99,237,0.35);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--mf-primary);
    color: var(--mf-primary);
}

.btn-outline-primary:hover {
    background: rgba(29,99,237,0.08);
    color: var(--mf-primary);
    border-color: var(--mf-primary);
}

.btn-sm {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* -------------------------------------------------------
   10. Forms
------------------------------------------------------- */
.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13.5px;
    background: var(--surface-1);
    transition: var(--transition);
    color: #1e1f35;
}

.form-control:focus, .form-select:focus {
    border-color: var(--mf-primary);
    box-shadow: 0 0 0 3px rgba(29,99,237,0.1);
    background: white;
}

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

.form-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* -------------------------------------------------------
   11. Alerts
------------------------------------------------------- */
.alert {
    border: none;
    border-radius: var(--border-radius);
    font-size: 13.5px;
    padding: 12px 16px;
}

.alert-success { background: rgba(16,185,129,0.1); color: #047857; }
.alert-danger   { background: rgba(239,68,68,0.1); color: #b91c1c; }
.alert-warning  { background: rgba(245,158,11,0.1); color: #92400e; }
.alert-info     { background: rgba(6,182,212,0.1); color: #0e7490; }

/* -------------------------------------------------------
   12. Empty States
------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    background: var(--surface-2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
    color: var(--mf-primary);
}

.empty-state h5 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: #6b7280;
    max-width: 380px;
    margin: 0 auto 24px;
}

/* -------------------------------------------------------
   13. Auth Pages
------------------------------------------------------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
}

.auth-left {
    flex: 0 0 45%;
    background: radial-gradient(900px 500px at 20% 0%, rgba(29,99,237,.35), transparent 60%), #0b1b33;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--surface-1);
}

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

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--mf-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: var(--shadow-primary);
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.auth-subtitle { color: #6b7280; font-size: 14px; margin-bottom: 28px; }

/* Social Proof */
.auth-feature-list { list-style: none; padding: 0; margin: 0; }
.auth-feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.9);
    font-size: 15px;
    margin-bottom: 16px;
}
.auth-feature-list li i {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* -------------------------------------------------------
   14. Avatar
------------------------------------------------------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    background: var(--mf-gradient);
    color: white;
    flex-shrink: 0;
}

.avatar-sm  { width: 28px; height: 28px; font-size: 11px; }
.avatar-md  { width: 36px; height: 36px; }
.avatar-lg  { width: 48px; height: 48px; font-size: 17px; }
.avatar-xl  { width: 64px; height: 64px; font-size: 22px; border-radius: 16px; }

/* -------------------------------------------------------
   15. Progress Bars
------------------------------------------------------- */
.progress {
    border-radius: 20px;
    background: var(--surface-3);
    height: 6px;
}

.progress-bar {
    border-radius: 20px;
    background: var(--mf-gradient);
    transition: width 0.6s ease;
}

/* -------------------------------------------------------
   16. Pagination
------------------------------------------------------- */
.pagination {
    gap: 4px;
}

.page-link {
    border-radius: 8px !important;
    border: 1px solid var(--border-color);
    color: #374151;
    padding: 6px 12px;
    font-size: 13px;
    transition: var(--transition);
}

.page-link:hover { background: var(--surface-2); border-color: var(--mf-primary); color: var(--mf-primary); }
.page-item.active .page-link { background: var(--mf-gradient); border-color: transparent; }

/* -------------------------------------------------------
   17. Dropdown Menus
------------------------------------------------------- */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    border-radius: 8px;
    font-size: 13.5px;
    padding: 8px 12px;
    transition: var(--transition);
    color: #374151;
}

.dropdown-item:hover { background: var(--surface-2); color: var(--mf-primary); }
.dropdown-item.active { background: rgba(29,99,237,0.08); color: var(--mf-primary); font-weight: 600; }

.dropdown-header {
    padding: 10px 12px 6px;
    font-size: 13px;
}

/* -------------------------------------------------------
   18. Responsive
------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .app-navbar {
        left: 0;
    }
    .auth-left {
        display: none;
    }
}

/* -------------------------------------------------------
   19. Utilities
------------------------------------------------------- */
.text-gradient {
    background: var(--mf-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary { background: var(--mf-gradient) !important; }

.border-dashed { border-style: dashed !important; }

.rotate-icon { transition: transform 0.2s; }
.collapsed .rotate-icon { transform: rotate(-90deg); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* Loading Spinner */
.spinner-primary {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(29,99,237,0.15);
    border-top-color: var(--mf-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Page transitions */
.main-content { animation: pageIn 0.2s ease; }
@keyframes pageIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------
   20. Page Content & Layouts
------------------------------------------------------- */
.page-content { padding: 24px; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

/* -------------------------------------------------------
   21. Stat Cards (icon + body layout)
------------------------------------------------------- */
.stat-card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(29,99,237,0.3);
}

.stat-card-body { flex: 1; min-width: 0; }

.stat-card-value {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: #111827;
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 12.5px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 6px;
}

.stat-card-change {
    font-size: 11.5px;
    font-weight: 600;
    color: #6b7280;
}
.stat-card-change.positive { color: #059669; }
.stat-card-change.negative { color: #dc2626; }

/* -------------------------------------------------------
   22. Mini Stat Cards
------------------------------------------------------- */
.mini-stat-card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    text-align: center;
    transition: var(--transition);
}
.mini-stat-card:hover { box-shadow: var(--shadow-sm); }

.mini-stat-value {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 4px;
}

.mini-stat-label {
    font-size: 11.5px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* -------------------------------------------------------
   23. Contact / User Avatars
------------------------------------------------------- */
.contact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--mf-gradient);
    color: white;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--mf-gradient);
    color: white;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(29,99,237,0.3);
}

/* -------------------------------------------------------
   24. Detail Rows (contact show page)
------------------------------------------------------- */
.detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 13.5px;
    color: #374151;
    border-bottom: 1px solid var(--border-color);
}
.detail-row:last-child { border-bottom: none; }
.detail-row i { font-size: 15px; flex-shrink: 0; }

/* -------------------------------------------------------
   25. Event / Activity Icons
------------------------------------------------------- */
.event-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

/* -------------------------------------------------------
   26. Quick Action Icons
------------------------------------------------------- */
.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: var(--transition);
}

/* -------------------------------------------------------
   27. Campaign & Status Badge Overrides
------------------------------------------------------- */
/* Bootstrap badge compatibility with custom badge classes */
.badge.badge-success   { background: rgba(16,185,129,0.12) !important; color: #059669 !important; }
.badge.badge-danger    { background: rgba(239,68,68,0.12) !important; color: #dc2626 !important; }
.badge.badge-warning   { background: rgba(245,158,11,0.12) !important; color: #d97706 !important; }
.badge.badge-info      { background: rgba(6,182,212,0.12) !important; color: #0891b2 !important; }
.badge.badge-primary   { background: rgba(29,99,237,0.12) !important; color: #1550c4 !important; }
.badge.badge-secondary { background: rgba(107,114,128,0.12) !important; color: #4b5563 !important; }
.badge.badge-dark      { background: rgba(17,24,39,0.08) !important; color: #111827 !important; }

/* -------------------------------------------------------
   28. Table Toolbar (bulk actions)
------------------------------------------------------- */
.table-toolbar {
    background: rgba(29,99,237,0.04);
    border-bottom: 1px solid var(--border-color);
}

/* -------------------------------------------------------
   29. Campaign Card (list view)
------------------------------------------------------- */
.campaign-card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.campaign-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.campaign-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

/* -------------------------------------------------------
   30. Settings Page Layout
------------------------------------------------------- */
.settings-nav .nav-link {
    color: #374151;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    margin-bottom: 2px;
}
.settings-nav .nav-link:hover { background: var(--surface-2); color: var(--mf-primary); }
.settings-nav .nav-link.active {
    background: rgba(29,99,237,0.08);
    color: var(--mf-primary);
    font-weight: 600;
}
.settings-nav .nav-link i { font-size: 16px; width: 18px; text-align: center; }

/* -------------------------------------------------------
   31. Analytics / Chart containers
------------------------------------------------------- */
.chart-container { position: relative; }

/* -------------------------------------------------------
   32. Automation Builder
------------------------------------------------------- */
.trigger-option {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 14px;
}
.trigger-option:hover { border-color: var(--mf-primary); background: rgba(29,99,237,0.03); }
.trigger-option.selected { border-color: var(--mf-primary); background: rgba(29,99,237,0.06); }

.trigger-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(29,99,237,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--mf-primary);
    flex-shrink: 0;
}

/* -------------------------------------------------------
   33. Unsubscribe page
------------------------------------------------------- */
.unsubscribe-card {
    max-width: 480px;
    margin: 80px auto;
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}


/* -------------------------------------------------------
   Plan banner (trial days left / plan ended)
------------------------------------------------------- */
.plan-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px; background: #e8f0fe; color: #0b1b33; border: 1px solid #c9dafb; font-size: 14px; }
.plan-banner > i { font-size: 18px; color: var(--mf-primary); }
.plan-banner-ended { background: #0b1b33; color: #dbe5f5; border-color: #0b1b33; }
.plan-banner-ended > i { color: #f5b544; }
.plan-banner-ended strong { color: #fff; }
.sidebar-footer .plan-badge { display: block; color: inherit; }
.sidebar-footer .plan-badge:hover { border-color: rgba(255,255,255,.25); }
.sidebar-footer .progress { background: rgba(255,255,255,.15); }

/* -------------------------------------------------------
   Auth pages (one layout: layouts/auth.blade.php)
------------------------------------------------------- */
.auth-body { margin: 0; background: #fff; }
.auth-left-inner { max-width: 440px; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-heading); font-weight: 700; font-size: 22px; color: #fff; text-decoration: none; margin-bottom: 36px; }
.auth-brand .brand-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--mf-primary); color: #fff; display: grid; place-items: center; font-size: 19px; }
.auth-brand-dark { color: #0b1b33; font-size: 20px; }
.auth-left-title { color: #fff; font-family: var(--font-heading); font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 28px; }
.auth-left .auth-feature-list { list-style: none; padding: 0; margin: 0 0 32px; }
.auth-left .auth-feature-list li { display: flex; gap: 12px; align-items: flex-start; color: #d6e0f0; font-size: 15px; margin-bottom: 16px; }
.auth-left .auth-feature-list i { flex: none; width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.08); display: grid; place-items: center; color: #9dbcf7; }
.auth-left-foot { color: #9fb0c8; font-size: 13px; margin: 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }
.auth-right .auth-card { max-width: 420px; }
.auth-title { font-family: var(--font-heading); font-size: 28px; font-weight: 700; color: #0b1b33; letter-spacing: -0.02em; margin-bottom: 6px; }
.auth-subtitle { color: #5b6b84; margin-bottom: 28px; }
.auth-card .form-label { font-weight: 600; color: #0b1b33; font-size: 13.5px; }
.auth-card .form-control, .auth-card .form-select, .auth-card .input-group-text { padding-top: 10px; padding-bottom: 10px; }
.auth-card .btn-primary { padding: 10px 28px; font-size: 14.5px; }
.auth-footer { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--border-color); color: #5b6b84; font-size: 14px; }
.auth-footer a { font-weight: 600; text-decoration: none; }

/* Links: no underline anywhere (owner preference); colour shows they are links */
a, a:hover, a:focus { text-decoration: none; }

/* Notifications (real events) */
.notification-count { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }
.notification-item { display: flex; gap: 12px; text-decoration: none; }
.notification-item:hover { background: var(--surface-2); }
.notification-icon { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; }
.notification-info { background: #e8f0fe; color: #1d63ed; }
.notification-success { background: #e7f6ef; color: #0f9d6b; }
.notification-warning { background: #fff4e0; color: #b45309; }
.min-w-0 { min-width: 0; }

/* Campaign form: settings cards in two columns above the editor */
.fm-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 24px; }
@media (max-width: 400px) { .fm-form-grid { grid-template-columns: 1fr; } }

/* -------------------------------------------------------
   Phones and tablets
------------------------------------------------------- */
@media (max-width: 991.98px) {
    /* Bootstrap's .navbar-expand hides every .navbar-toggler: bring the menu button back */
    .app-navbar .sidebar-mobile-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; margin-right: 8px !important; border: 0; border-radius: 10px; font-size: 26px; color: var(--bs-body-color); background: transparent; box-shadow: none; }
    .app-navbar .sidebar-mobile-toggle:focus-visible { outline: 2px solid var(--mf-primary); }
    .sidebar-toggle-btn { margin-left: auto; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #e2e8f0; font-size: 16px; }
    .sidebar-toggle-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
    .sidebar.show ~ .main-wrapper::before { content: ''; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }
}
@media (max-width: 767.98px) {
    .app-navbar { padding-left: 8px; padding-right: 12px; }
    .app-navbar .navbar-brand { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px; }
    .main-content .mx-4 { margin-left: 12px !important; margin-right: 12px !important; }
    .plan-banner { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; font-size: 14px; }
    .page-content { padding: 16px 12px; }
    .page-content .page-header { padding: 0; margin-bottom: 16px; }
    .page-header .page-title { font-size: 22px; }
    .page-header > .d-flex, .page-header-content > .d-flex { flex-wrap: wrap; }
    .row.g-4 { --bs-gutter-x: 12px; --bs-gutter-y: 12px; }
    .stat-card { flex-direction: column; gap: 10px; padding: 14px; }
    .stat-card-icon { width: 38px; height: 38px; border-radius: 10px; font-size: 17px; }
    .stat-card-value { font-size: 22px; }
    .card-header, .card-body { padding-left: 14px; padding-right: 14px; }
    .card-header { flex-wrap: wrap; gap: 8px; }
    .table { font-size: 14px; }
    .table > :not(caption) > * > * { padding-left: 10px; padding-right: 10px; }
    .modal-dialog { margin: 8px; }
    .dropdown-menu.notification-panel { width: min(340px, calc(100vw - 24px)); }
    /* Settings menu: one scrollable row of tabs instead of a tall list */
    .settings-nav .card-body { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .settings-nav .card-body::-webkit-scrollbar { display: none; }
    .settings-nav .nav-link { white-space: nowrap; flex: 0 0 auto; padding: 8px 12px; }
}
