/* =============================================
   WA Sender - Modern WhatsApp Marketing Platform
   ============================================= */

/* === CSS Variables === */
:root {
    --primary: #25D366;
    --primary-hover: #1da851;
    --primary-light: rgba(37, 211, 102, 0.1);
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active: #25D366;
    --sidebar-width: 260px;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success: #10b981;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --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);
    --transition: all 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mobile-header-h: 60px;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

img { max-width: 100%; }

/* === App Layout === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-wrapper {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    width: 100%;
}

.sidebar-logo i {
    font-size: 1.75rem;
    color: var(--primary);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-nav ul { list-style: none; }

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    font-size: 0.935rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.sidebar-nav li.active a {
    color: #fff;
    background: var(--sidebar-hover);
    border-left-color: var(--primary);
}

.sidebar-nav li.active a i { color: var(--primary); }

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-settings {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.sidebar-settings:hover, .sidebar-settings.active { color: #fff; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

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

.user-name {
    display: block;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-logout {
    color: var(--sidebar-text);
    padding: 4px;
    font-size: 1rem;
}

.user-logout:hover { color: var(--danger); }

/* === Mobile Header === */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-h);
    background: var(--sidebar-bg);
    color: #fff;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 999;
}

.hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.1rem;
}

.mobile-logo i { color: var(--primary); font-size: 1.4rem; }

.mobile-actions a { color: #fff; padding: 8px; font-size: 1.1rem; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* === Page Header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

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

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    background: var(--border-light);
}

/* === Stat Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.stats-grid.stats-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.bg-primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.bg-success { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.bg-info { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-icon.bg-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon.bg-danger { background: rgba(239,68,68,0.1); color: var(--danger); }

.stat-info { min-width: 0; }

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === Mini Stats === */
.mini-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}

.mini-stat i { font-size: 1.3rem; }
.mini-stat strong { display: block; font-size: 1.15rem; }
.mini-stat span { font-size: 0.82rem; color: var(--text-secondary); }

/* === Grids === */
.grid { display: grid; gap: 20px; margin-bottom: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-secondary { background: var(--border); color: var(--text-primary); }
.btn-secondary:hover { background: #cbd5e1; color: var(--text-primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-info { background: var(--info); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; color: var(--text-secondary); padding: 4px 8px; cursor: pointer; }
.btn-icon:hover { color: var(--text-primary); transform: none; }

.btn-group { display: flex; gap: 4px; }

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

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--border-light);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.table tbody tr:hover { background: rgba(0,0,0,0.02); }

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-secondary { background: var(--border-light); color: var(--text-secondary); }

/* === Forms === */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group label i {
    margin-right: 4px;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea { resize: vertical; min-height: 80px; }

.form-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-hint code {
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.char-count { text-align: right; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* File Upload */
.file-upload {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload:hover { border-color: var(--primary); background: var(--primary-light); }

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-content i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.file-upload-content p {
    color: var(--text-secondary);
    font-weight: 500;
}

.file-upload-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Password wrapper */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* Media Toggle */
.media-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.media-toggle-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.media-toggle-btn:first-child { border-right: 1.5px solid var(--border); }

.media-toggle-btn.active {
    background: var(--primary);
    color: #fff;
}

.media-toggle-btn:hover:not(.active) {
    background: var(--border-light);
}

.file-upload.has-file {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload.has-file .file-upload-content i {
    color: var(--primary);
}

/* Filters */
.filters-form .filters-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters-form .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.filters-actions {
    display: flex;
    gap: 8px;
}

/* Search bar */
.search-bar input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
}

/* === Alerts === */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.alert i { margin-top: 2px; flex-shrink: 0; }

.alert-success { background: rgba(16,185,129,0.08); color: #065f46; border-left: 4px solid var(--success); }
.alert-danger { background: rgba(239,68,68,0.08); color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(245,158,11,0.08); color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: rgba(59,130,246,0.08); color: #1e40af; border-left: 4px solid var(--info); }
.alert a { font-weight: 600; text-decoration: underline; }

/* === Modals === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.25s ease;
}

.modal-lg { max-width: 900px; }
.modal-sm { max-width: 420px; }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* === Dropdowns === */
.dropdown { position: relative; }

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    border: 1px solid var(--border);
    overflow: hidden;
}

.dropdown-menu.show { display: block; }

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-menu a:hover { background: var(--border-light); }
.dropdown-menu a.text-danger { color: var(--danger); }

/* === List Cards === */
.list-card .list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.list-card h3 { font-size: 1.05rem; font-weight: 600; }

.list-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-stats {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.list-stats i { margin-right: 4px; }

/* === Template Cards === */
.template-card .template-type-badge { margin-bottom: 8px; }
.template-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 12px; }
.template-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 12px; }

/* Template Preview (WhatsApp Bubble) */
.template-preview {
    margin: 8px 0;
}

.wa-message-bubble {
    background: #e7fed6;
    border-radius: 12px 12px 0 12px;
    padding: 8px 12px;
    max-width: 100%;
    font-size: 0.85rem;
    color: #111;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.wa-header {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.wa-media {
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.wa-body {
    word-break: break-word;
    line-height: 1.4;
}

.wa-footer {
    font-size: 0.75rem;
    color: #667;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.wa-button {
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    margin-top: 4px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #00a5f4;
    cursor: pointer;
}

.wa-button i { margin-right: 4px; font-size: 0.75rem; }

/* Phone Preview */
.phone-preview {
    position: sticky;
    top: 20px;
}

.phone-frame {
    background: #e5ddd5;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    max-width: 320px;
    margin: 0 auto;
    border: 8px solid #1a1a1a;
}

.phone-header-bar {
    background: #075e54;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.phone-contact {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.phone-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.phone-chat {
    padding: 16px;
    min-height: 320px;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 30m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0' fill='%23d4ccba' fill-opacity='0.3'/%3E%3C/svg%3E");
}

/* === Progress Bar === */
.progress-bar-container { display: flex; align-items: center; gap: 8px; }

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; }

/* Sending Progress */
.sending-progress { padding: 20px 0; }

.progress-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 6px solid var(--border-light);
    border-top-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
    font-weight: 700;
    animation: spin 2s linear infinite;
}

.progress-circle.completed { animation: none; border-color: var(--success); }

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

.sending-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.sending-stats i { margin-right: 4px; }

/* === Pagination === */
.pagination-wrapper { padding: 16px 20px; border-top: 1px solid var(--border-light); }

.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.page-link {
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === Empty States === */
.empty-state, .empty-state-full {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i, .empty-state-full i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.empty-state-full h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-full p { margin-bottom: 20px; }

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: toastSlide 0.3s ease;
    min-width: 280px;
    border-left: 4px solid var(--text-muted);
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }

@keyframes toastSlide {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

/* === Settings === */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* === Login Page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 20px;
}

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

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-form .form-group { margin-bottom: 20px; }

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* === Template Button Builder === */
.button-item {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    padding: 10px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
}

.button-item select, .button-item input { flex: 1; }
.button-item .btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

/* === Utilities === */
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.text-center { text-align: center; }

/* === Responsive === */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid.stats-grid-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .content-wrapper { padding: 24px 20px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-close { display: block; }

    .sidebar-overlay.show { display: block; }

    .mobile-header { display: flex; }

    .main-content {
        margin-left: 0;
        padding-top: var(--mobile-header-h);
    }

    .content-wrapper { padding: 16px 12px; }

    .page-header { flex-direction: column; align-items: stretch; gap: 8px; }
    .page-header h1 { font-size: 1.3rem; }
    .page-subtitle { font-size: 0.82rem; }

    /* Stat cards: 2 columns on mobile */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
    .stats-grid.stats-grid-5 { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 1rem; }
    .stat-value { font-size: 1.15rem; }
    .stat-label { font-size: 0.75rem; }

    /* Grids: charts stack, but 2-col grids stay 2 on tablet */
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }

    /* Cards compact */
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }
    .card-header h3 { font-size: 0.9rem; }
    .mb-4 { margin-bottom: 16px; }

    /* Filters: 2 columns on mobile */
    .filters-form .filters-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .filters-form .form-group { min-width: auto; margin-bottom: 0; }
    .filters-form .form-group label { font-size: 0.78rem; margin-bottom: 4px; }
    .filters-form .filters-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
    .filters-form .filters-actions .btn { flex: 1; }

    input[type="text"], input[type="email"], input[type="password"],
    input[type="url"], input[type="date"], input[type="number"],
    input[type="tel"], select, textarea {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .modal { margin: 10px; max-height: 95vh; }
    .modal-lg { max-width: 100%; }

    /* Tables compact */
    .table th, .table td { padding: 8px 10px; font-size: 0.78rem; }
    .table th { font-size: 0.72rem; }

    .toast-container { top: 70px; right: 12px; left: 12px; }
    .toast { min-width: auto; }

    .phone-frame { max-width: 100%; }

    .sending-stats { flex-direction: column; gap: 8px; }

    /* Mini stats: 2 columns */
    .grid.grid-3 { grid-template-columns: 1fr 1fr; }

    /* Buttons compact */
    .btn { padding: 8px 14px; font-size: 0.82rem; }
    .page-header .btn { font-size: 0.78rem; padding: 8px 12px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 10px; gap: 8px; }
    .stat-icon { width: 36px; height: 36px; font-size: 0.9rem; border-radius: 6px; }
    .stat-value { font-size: 1.05rem; }

    .login-card { padding: 32px 20px; }
    .content-wrapper { padding: 12px 10px; }

    /* Filters: single column on very small screens */
    .filters-form .filters-grid { grid-template-columns: 1fr; }
}

/* Print / PDF styles */
@media print {
    .sidebar, .mobile-header, .btn, .filters-form, .modal-overlay, .toast-container { display: none !important; }
    .main-content { margin-left: 0; }
    .content-wrapper { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
