/* ==========================================================================
   VOBPL Bulk Mail Sender - Complete Standalone Enterprise Design System
   100% Self-Contained (Zero External CDN Dependency Required)
   ========================================================================== */

:root {
    /* Theme Tokens - Light Mode (Default) */
    --bg-page: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-muted: #f8fafc;
    --bg-subtle: #e2e8f0;
    --bg-header: #ffffff;

    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --text-inverse: #ffffff;

    --primary-gold: #d97706;
    --primary-gold-hover: #b45309;
    --primary-gold-light: #fef3c7;

    --brand-blue: #0284c7;
    --brand-blue-light: #e0f2fe;

    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --color-success-border: #a7f3d0;

    --color-danger: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-danger-border: #fecaca;

    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;

    --color-info: #0284c7;
    --color-info-bg: #f0f9ff;
    --color-info-border: #bae6fd;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

[data-theme="dark"] {
    --bg-page: #0b0f19;
    --bg-surface: #111827;
    --bg-muted: #1e293b;
    --bg-subtle: #334155;
    --bg-header: #111827;

    --border-light: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.15);
    --border-strong: rgba(255, 255, 255, 0.25);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --text-inverse: #0f172a;

    --primary-gold: #fbbf24;
    --primary-gold-hover: #f59e0b;
    --primary-gold-light: rgba(251, 191, 36, 0.15);

    --brand-blue: #38bdf8;
    --brand-blue-light: rgba(56, 189, 248, 0.15);

    --color-success: #34d399;
    --color-success-bg: rgba(16, 185, 129, 0.15);
    --color-success-border: rgba(52, 211, 153, 0.3);

    --color-danger: #f87171;
    --color-danger-bg: rgba(239, 68, 68, 0.15);
    --color-danger-border: rgba(248, 113, 113, 0.3);

    --color-warning: #fbbf24;
    --color-warning-bg: rgba(245, 158, 11, 0.15);
    --color-warning-border: rgba(251, 191, 36, 0.3);

    --color-info: #38bdf8;
    --color-info-bg: rgba(14, 165, 233, 0.15);
    --color-info-border: rgba(56, 189, 248, 0.3);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.6);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.7);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: var(--brand-blue);
    text-decoration: none;
}

/* Standalone Grid System */
.container-fluid {
    width: 100%;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 0.75rem; }
.col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; padding: 0 0.75rem; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; padding: 0 0.75rem; }
.col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; padding: 0 0.75rem; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; padding: 0 0.75rem; }
.col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; padding: 0 0.75rem; }
.col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; padding: 0 0.75rem; }
.col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; padding: 0 0.75rem; }
.col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; padding: 0 0.75rem; }
.col-xl-3 { flex: 0 0 25%; max-width: 25%; padding: 0 0.75rem; }
.col-xl-8 { flex: 0 0 66.666667%; max-width: 66.666667%; padding: 0 0.75rem; }

@media (max-width: 991px) {
    .col-lg-4, .col-lg-8, .col-xl-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
}

@media (max-width: 767px) {
    .col-md-3, .col-md-4, .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
}

.g-3 > * { padding-bottom: 1rem; }
.g-4 > * { padding-bottom: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.ms-auto { margin-left: auto !important; }
.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--primary-gold) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-main { color: var(--text-main) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }
.font-monospace { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace !important; }
.rounded { border-radius: var(--radius-md) !important; }
.border-0 { border: 0 !important; }
.border { border: 1px solid var(--border-light) !important; }
.border-warning { border-color: var(--primary-gold) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }

/* Navbar / App Header */
.app-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand-logo-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
}

.brand-icon-box {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 8px rgba(217, 119, 6, 0.3);
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.brand-name span {
    color: var(--primary-gold);
}

.enterprise-tag {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: var(--bg-muted);
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    margin-left: 0.5rem;
}

/* Nav Link Pills */
.nav-pills-custom {
    display: flex;
    gap: 0.25rem;
}

.nav-pills-custom .nav-link {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s ease;
}

.nav-pills-custom .nav-link:hover {
    color: var(--text-main);
    background: var(--bg-muted);
}

.nav-pills-custom .nav-link.active {
    color: var(--text-main);
    background: var(--bg-muted);
    font-weight: 700;
}

/* Buttons */
.btn-theme-switcher {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.15s ease;
}

.btn-theme-switcher:hover {
    background: var(--bg-subtle);
}

.btn-primary-action {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
    transition: all 0.15s ease;
}

.btn-primary-action:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(217, 119, 6, 0.4);
}

.btn-secondary-action {
    background: var(--bg-surface);
    color: var(--text-main) !important;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-medium);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-secondary-action:hover {
    background: var(--bg-muted);
    border-color: var(--border-strong);
}

.btn-warning {
    background: #f59e0b;
    color: #0f172a !important;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.15rem;
    cursor: pointer;
}

.btn-success {
    background: #10b981;
    color: #ffffff !important;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.15rem;
    cursor: pointer;
}

.btn-outline-danger {
    background: transparent;
    color: var(--color-danger) !important;
    border: 1px solid var(--color-danger);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.btn-outline-danger:hover {
    background: var(--color-danger-bg);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-icon-wrapper.total { background: var(--brand-blue-light); color: var(--brand-blue); }
.stat-icon-wrapper.sent { background: var(--color-success-bg); color: var(--color-success); }
.stat-icon-wrapper.failed { background: var(--color-danger-bg); color: var(--color-danger); }
.stat-icon-wrapper.pending { background: var(--color-warning-bg); color: var(--color-warning); }

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.stat-subtext {
    font-size: 0.775rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* App Card Surface */
.app-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.app-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.app-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Progress Bar */
.progress-track {
    background: var(--bg-muted);
    border-radius: var(--radius-full);
    height: 16px;
    overflow: hidden;
    padding: 2px;
    border: 1px solid var(--border-light);
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #f59e0b 0%, #10b981 100%);
    transition: width 0.3s ease;
}

/* Status Pill Badges */
.badge-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.725rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-pill.sent, .badge-pill.completed {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.badge-pill.failed, .badge-pill.cancelled {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}

.badge-pill.pending, .badge-pill.draft, .badge-pill.queued {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

.badge-pill.running {
    background: var(--brand-blue-light);
    color: var(--brand-blue);
    border: 1px solid var(--color-info-border);
}

/* Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table-custom th {
    background: var(--bg-muted);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

.table-custom td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    font-size: 0.875rem;
    color: var(--text-main);
}

.table-custom tbody tr:hover td {
    background: var(--bg-muted);
}

/* Callout Box */
.custom-message-box {
    background: var(--bg-muted);
    border-left: 4px solid var(--primary-gold);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.15rem;
    margin-bottom: 1.25rem;
    border-top: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

/* Forms & Inputs */
.form-label {
    display: block;
    margin-bottom: 0.35rem;
}

.form-control-custom, .form-select-custom {
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-medium);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control-custom:focus, .form-select-custom:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px var(--primary-gold-light);
}

/* Modals */
.modal-content-custom {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    color: var(--text-main);
}

.modal-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body-custom {
    padding: 1.5rem;
}

.modal-footer-custom {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-muted);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Alerts */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}
