/* ============================================
   MailPulse - Modern Email Marketing System
   Premium Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* CSS Variables */
:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5A4BD1;
    --secondary: #00CEC9;
    --secondary-light: #81ECEC;
    --accent: #FD79A8;
    --accent-light: #FAB1A0;
    --success: #00B894;
    --success-light: #55EFC4;
    --warning: #FDCB6E;
    --warning-dark: #E17055;
    --danger: #FF6B6B;
    --danger-light: #FF8787;
    --info: #74B9FF;
    
    --bg-primary: #0F0E17;
    --bg-secondary: #1A1A2E;
    --bg-tertiary: #16213E;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-card-hover: rgba(26, 26, 46, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-hover: rgba(255, 255, 255, 0.1);
    
    --text-primary: #EAEAEA;
    --text-secondary: #A0A0B0;
    --text-muted: #6B6B80;
    --text-white: #FFFFFF;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.3);
    --shadow-glow-accent: 0 0 20px rgba(253, 121, 168, 0.3);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(253, 121, 168, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 206, 201, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition-normal);
}

.sidebar-brand {
    padding: 28px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand h1 {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 28px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 12px;
    margin-bottom: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 0 4px 4px 0;
    opacity: 0;
    transition: var(--transition-fast);
}

.nav-link:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-link.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
}

.nav-link.active::before {
    opacity: 1;
}

.nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-link .badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer .smtp-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.smtp-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.smtp-status .status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 184, 148, 0.5);
}

.smtp-status .status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.page-content {
    padding: 32px 40px;
    flex: 1;
}

.main-footer {
    padding: 20px 40px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-primary);
}

.main-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.main-footer a:hover {
    text-decoration: underline;
}

/* Top Header */
.top-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 20px 40px;
    background: rgba(15, 14, 23, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.top-header h2 span {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    background: var(--bg-glass);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Page Content */
.page-content {
    padding: 32px 40px;
}

/* ============================================
   Cards & Panels
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--primary-light);
}

.card-body {
    padding: 28px;
}

.card-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* ============================================
   Stats Cards
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.15;
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-color-hover);
}

.stat-card:hover::after {
    opacity: 0.25;
}

.stat-card.purple::after { background: var(--primary); }
.stat-card.pink::after { background: var(--accent); }
.stat-card.teal::after { background: var(--secondary); }
.stat-card.green::after { background: var(--success); }
.stat-card.orange::after { background: #FF9F43; }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
}

.stat-icon.pink {
    background: rgba(253, 121, 168, 0.15);
    color: var(--accent);
}

.stat-icon.teal {
    background: rgba(0, 206, 201, 0.15);
    color: var(--secondary);
}

.stat-icon.green {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(255, 159, 67, 0.15);
    color: #FF9F43;
}

.stat-info h4 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #e84393);
    color: white;
    box-shadow: 0 4px 15px rgba(253, 121, 168, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(253, 121, 168, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00a085);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #ee5a5a);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn-ghost {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.btn-outline {
    background: transparent;
    color: var(--primary-light);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(108, 92, 231, 0.1);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-label .required {
    color: var(--accent);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A0A0B0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.input-group-custom {
    display: flex;
    align-items: stretch;
}

.input-group-custom .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.05);
}

.file-upload-area i {
    font-size: 40px;
    color: var(--primary-light);
    margin-bottom: 12px;
    display: block;
}

.file-upload-area h4 {
    font-size: 16px;
    margin-bottom: 6px;
}

.file-upload-area p {
    font-size: 13px;
    color: var(--text-muted);
}

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(0, 184, 148, 0.1);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-size: 13px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
}

.file-info.show {
    display: flex;
}

/* ============================================
   Table
   ============================================ */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
}

table td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

table tbody tr {
    transition: var(--transition-fast);
}

table tbody tr:hover {
    background: var(--bg-glass);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(253, 203, 110, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(255, 107, 107, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(116, 185, 255, 0.15);
    color: var(--info);
}

.badge-primary {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
}

/* ============================================
   Templates Preview
   ============================================ */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.template-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-color-hover);
}

.template-card.selected {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.template-card.selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    z-index: 2;
}

.template-preview {
    height: 250px;
    overflow: hidden;
    position: relative;
    background: #f4f4f4;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-preview .preview-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.template-info {
    padding: 16px;
    background: var(--bg-secondary);
}

.template-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.template-info p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-glass);
    border-radius: 10px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.progress-bar.success {
    background: linear-gradient(90deg, var(--success), var(--secondary));
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 16px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(0, 184, 148, 0.12);
    border: 1px solid rgba(0, 184, 148, 0.25);
    color: var(--success-light);
}

.alert-danger {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: var(--danger-light);
}

.alert-warning {
    background: rgba(253, 203, 110, 0.12);
    border: 1px solid rgba(253, 203, 110, 0.25);
    color: var(--warning);
}

.alert-info {
    background: rgba(116, 185, 255, 0.12);
    border: 1px solid rgba(116, 185, 255, 0.25);
    color: var(--info);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    animation: modalSlide 0.3s ease;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1200px;
    width: 95%;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-xl .modal-body {
    flex: 1;
    overflow-y: auto;
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 107, 107, 0.15);
    color: var(--danger);
}

.modal-body {
    padding: 28px;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 60px;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: block;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ============================================
   Sending Progress
   ============================================ */
.sending-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.sending-overlay.show {
    display: flex;
}

.sending-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px;
    text-align: center;
    min-width: 420px;
}

.sending-animation {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    position: relative;
}

.sending-animation::before,
.sending-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.sending-animation::before {
    width: 80px;
    height: 80px;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    animation: spin 1s linear infinite;
}

.sending-animation::after {
    width: 50px;
    height: 50px;
    top: 15px;
    left: 15px;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-left-color: var(--accent);
    animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.sending-box h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.sending-box p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.sending-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
}

.sending-stat {
    text-align: center;
}

.sending-stat span {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.sending-stat label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Toast / Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    color: var(--text-primary);
    min-width: 300px;
    transform: translateX(100%);
    opacity: 0;
    transition: var(--transition-normal);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-danger {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--info);
}

/* ============================================
   Email Editor
   ============================================ */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-wrap: wrap;
}

.editor-toolbar button {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 14px;
}

.editor-toolbar button:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.editor-toolbar .separator {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 6px;
}

.editor-content {
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    min-height: 250px;
    padding: 20px;
    outline: none;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-glass);
}

.editor-content:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

/* ============================================
   Template Preview Styles (inline in emails)
   ============================================ */
.template-preview-frame {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    color: #333;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

/* Manual Entry Styles */
#manualSource textarea {
    min-height: 200px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.6;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    padding: 15px;
    resize: vertical;
}

#manualSource textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .page-content {
        padding: 20px;
    }
    .top-header {
        padding: 16px 20px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .templates-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Scrollbar Styles
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color-hover);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.min-w-120px { min-width: 120px; }
.max-w-200px { max-width: 200px; }

.w-1px { width: 1px; }
.h-12px { height: 12px; }
.h-24px { height: 24px; }
.h-350px { height: 350px; }
.h-10px { height: 10px; }
.max-h-200px { max-height: 200px; }
.line-height-relaxed { line-height: 1.7; }

.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-smtp-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
}

@media (max-width: 992px) {
    .grid-2-cols,
    .grid-smtp-layout {
        grid-template-columns: 1fr;
    }
}

.text-primary { color: var(--primary-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* Flex Utilities */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.align-center { align-items: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* Spacing Utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mr-2 { margin-right: 8px; }

/* Text Utilities */
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.no-underline { text-decoration: none; }
.hover\:underline:hover { text-decoration: underline; }

/* Visibility */
.hidden { display: none; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-flex { display: flex; }
.d-block { display: block; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.gap-5 { gap: 32px; }
.gap-6 { gap: 48px; }

.align-center { align-items: center; }
.items-center { align-items: center; }
.mr-1 { margin-right: 8px; }
.mr-2 { margin-right: 16px; }

.ml-1 { margin-left: 8px; }
.ml-2 { margin-left: 16px; }

.w-50px { width: 50px; }
.w-60px { width: 60px; }
.w-100 { width: 100%; }
.w-auto { width: auto; }
.h-100 { height: 100%; }

.border-0 { border: none !important; }
.border-4 { border-width: 4px; }
.border-primary-bg { border-color: var(--bg-primary); }

.bg-tertiary { background-color: var(--bg-tertiary); }

.w-150px { width: 150px; }
.h-150px { height: 150px; }
.w-200px { width: 200px; }
.max-w-800 { max-width: 800px; }

.text-xs { font-size: 12px; }
.text-sm-lg { font-size: 0.9rem; }
.text-6xl { font-size: 64px; }

.border-2 { border-width: 2px; }
.border-color { border-color: var(--border-color); }

.mx-auto { margin-left: auto; margin-right: auto; }
.align-items-start { align-items: flex-start; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.opacity-70 { opacity: 0.7; }
.border-top { border-top: 1px solid var(--border-color); }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.my-4 { margin-top: 24px; margin-bottom: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 40px; }
.pb-2 { padding-bottom: 8px; }
.text-uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 1px; }
.leading-tight { line-height: 1.2; }

.position-relative { position: relative; }
.position-absolute { position: absolute; }
.overflow-hidden { overflow: hidden; }
.shadow-md { box-shadow: var(--shadow-md); }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.border-bottom { border-bottom: 1px solid var(--border-color); }
.text-white { color: var(--text-white); }

.template-card-header.large .template-icon {
    font-size: 42px;
    margin-bottom: 16px;
}

.rounded-md { border-radius: var(--radius-md); }
.rounded-bottom-lg { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.bg-email-preview { background: #f4f4f4; }

.white-space-pre-wrap {
    white-space: pre-wrap;
}

.template-preview {
    position: relative;
    overflow: hidden;
}

.template-preview.has-image {
    background-size: cover;
    background-position: top;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(108, 92, 231, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
    color: white;
}

.template-card:hover .preview-overlay {
    opacity: 1;
}

.template-card.selected .preview-overlay {
    opacity: 1;
    background: rgba(108, 92, 231, 0.7);
}

.template-card.selected .preview-overlay i {
    color: #fff;
}
