/* ============================================================================
   POSTAL CAMPAIGN MANAGER - STYLES
   Design: Modern Dashboard with Bold Gradients
   ============================================================================ */

:root {
    --primary: #FF6B6B;
    --primary-dark: #E85555;
    --secondary: #4ECDC4;
    --accent: #FFD93D;
    --dark: #1A1A2E;
    --dark-light: #2D2D44;
    --dark-lighter: #404057;
    --text: #E8E8F0;
    --text-muted: #A0A0B8;
    --bg: #0F0F1E;
    --surface: #1E1E32;
    --border: rgba(255, 255, 255, 0.08);
    --success: #6BCF7F;
    --warning: #FFB84D;
    --error: #FF6B93;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 217, 61, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    backdrop-filter: blur(20px);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.logo strong {
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-badge {
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 217, 61, 0.2));
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--text);
    transform: translateX(4px);
}

.nav-item:hover::before {
    opacity: 0.1;
}

.nav-item.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 217, 61, 0.15));
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.nav-item.active::before {
    opacity: 0;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--dark);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.main-content {
    margin-left: 280px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.header {
    padding: 40px 48px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, transparent 100%);
    backdrop-filter: blur(20px);
}

.header-left h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-left p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--dark);
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--dark-lighter);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--dark-light);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ============================================================================
   VIEWS
   ============================================================================ */

.view {
    display: none;
    padding: 48px;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: block;
}

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

/* ============================================================================
   STATS GRID
   ============================================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================================
   SECTION
   ============================================================================ */

.section {
    margin-bottom: 48px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.link-primary {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.link-primary:hover {
    color: var(--accent);
    transform: translateX(4px);
}

/* ============================================================================
   CAMPAIGNS LIST
   ============================================================================ */

.campaigns-list, .campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.campaign-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    cursor: pointer;
}

.campaign-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: rgba(255, 255, 255, 0.15);
}

.campaign-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.campaign-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.campaign-date {
    font-size: 12px;
    color: var(--text-muted);
}

.campaign-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.campaign-status.draft {
    background: rgba(160, 160, 184, 0.2);
    color: var(--text-muted);
}

.campaign-status.sending {
    background: rgba(78, 205, 196, 0.2);
    color: var(--secondary);
}

.campaign-status.completed {
    background: rgba(107, 207, 127, 0.2);
    color: var(--success);
}

.campaign-stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.campaign-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.campaign-stat strong {
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 24px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 24px;
}

/* ============================================================================
   TOOLBAR
   ============================================================================ */

.toolbar {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

.filter-btn.active {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 217, 61, 0.15));
    border-color: var(--primary);
    color: var(--text);
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.modal-content.large {
    max-width: 900px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--dark-lighter);
    color: var(--text);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================================================
   FORM
   ============================================================================ */

.form-steps {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    gap: 12px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.step.active {
    color: var(--text);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--dark-lighter);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: var(--transition);
}

.step.active .step-number {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: var(--primary);
    color: var(--dark);
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--dark-lighter);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group textarea {
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ============================================================================
   TABS
   ============================================================================ */

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ============================================================================
   UPLOAD ZONE
   ============================================================================ */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(255, 107, 107, 0.05);
}

.upload-zone svg {
    margin-bottom: 16px;
    color: var(--text-muted);
}

.upload-zone p {
    margin-bottom: 16px;
    color: var(--text-muted);
}

/* ============================================================================
   PREVIEW
   ============================================================================ */

.email-preview {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}

.preview-header {
    background: #f5f5f5;
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
    color: #333;
}

#preview-frame {
    width: 100%;
    height: 500px;
    border: none;
    background: white;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        padding: 24px;
        flex-direction: column;
        gap: 20px;
    }
    
    .view {
        padding: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
/* Login Screen Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, #2d3436, #000000);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.error-message {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
    border: 1px solid rgba(255, 71, 87, 0.2);
}

/* Ajustement pour les inputs dans le login */
.login-card .form-group label {
    color: #a0a0a0;
    font-size: 13px;
    margin-bottom: 8px;
    display: block;
}

.login-card input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    width: 100%;
    transition: all 0.3s ease;
}

.login-card input:focus {
    border-color: var(--primary);
    outline: none;
    background: rgba(0, 0, 0, 0.4);
}
