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

:root {
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --secondary-color: #e5e7eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --background: #f9fafb;
    --card-background: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 2rem;
    margin-bottom: 3rem;
    font-size: 1.5rem;
    font-weight: 700;
}

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

.nav-menu {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.2);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-item i {
    font-size: 1.2rem;
    min-width: 20px;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
}

.header {
    background: var(--card-background);
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Content Sections */
.content-section {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

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

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

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.dashboard-grid .card {
    padding: 1.5rem;
}

.dashboard-grid .card h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-outline:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Search Bar */
.search-bar {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input-container {
    position: relative;
    flex: 1;
}

.search-input-container i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input-container input {
    padding-left: 2.5rem;
    margin-bottom: 0;
}

.filter-controls {
    display: flex;
    gap: 1rem;
}

.filter-controls select {
    margin-bottom: 0;
    min-width: 150px;
}

/* Tables */
.contacts-table-container {
    overflow-x: auto;
}

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

.contacts-table th,
.contacts-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.contacts-table th {
    background: var(--background);
    font-weight: 600;
    color: var(--text-primary);
}

.contacts-table tbody tr:hover {
    background: var(--background);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: modalFadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.large .modal-content {
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

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

.modal-body {
    padding: 1.5rem;
}

/* Campaign Steps */
.campaign-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: var(--transition);
}

.step.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.step.active .step-number {
    background: var(--primary-color);
    color: white;
}

.step-title {
    font-weight: 500;
    font-size: 0.875rem;
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
}

/* Email Editor */
.email-editor {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    gap: 0.25rem;
}

.toolbar-btn {
    padding: 0.5rem;
    border: none;
    background: none;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.toolbar-btn:hover {
    background: var(--card-background);
    color: var(--text-primary);
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

.editor-content {
    min-height: 300px;
    padding: 1rem;
    outline: none;
    line-height: 1.6;
}

.editor-content:focus {
    border-color: var(--primary-color);
}

.editor-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Campaign Summary */
.campaign-summary {
    background: var(--background);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.campaign-summary h4 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.summary-item {
    display: flex;
    margin-bottom: 0.5rem;
}

.summary-item strong {
    min-width: 120px;
    color: var(--text-primary);
}

.summary-item span {
    color: var(--text-secondary);
}

/* Email Preview */
.preview-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.preview-container h4 {
    padding: 1rem;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.email-preview {
    padding: 1rem;
    min-height: 200px;
    background: white;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

/* Senders List */
.senders-list {
    padding: 1.5rem;
}

.sender-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.sender-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.sender-info h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.sender-info p {
    color: var(--text-secondary);
    fontSize: 0.875rem;
}

.sender-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 2000;
    max-width: 400px;
}

.toast {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.toast-close:hover {
    background: var(--background);
    color: var(--text-primary);
}
.centered-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 1.1em;
    padding: 10px 0;
}

/* Lists Tabs */
.lists-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.list-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-background);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.875rem;
}

.list-tab:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.list-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.list-tab i {
    font-size: 1rem;
}

/* Bulk Actions */
.bulk-actions {
    padding: 1rem 1.5rem;
    background: var(--background);
    border-top: 1px solid var(--border-color);
}

.bulk-actions-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.bulk-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#selected-count {
    font-weight: 500;
    color: var(--text-primary);
}

/* Lists Container */
.lists-header {
    margin-bottom: 1.5rem;
}

.lists-container {
    max-height: 400px;
    overflow-y: auto;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.list-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.list-info h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.list-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.list-info small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.list-actions {
    display: flex;
    gap: 0.5rem;
}

/* Import Steps */
.import-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.import-step-content {
    display: none;
}

.import-step-content.active {
    display: block;
}

.csv-format-info {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.csv-format-info h4 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.csv-format-info pre {
    background: var(--card-background);
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.import-preview {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.import-preview-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.import-preview-table th,
.import-preview-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.import-preview-table th {
    background: var(--card-background);
    font-weight: 600;
}

/* Lists Checkboxes */
.lists-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background);
}

.list-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.list-checkbox label {
    margin: 0;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Contact Lists Tags */
.contact-lists {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.list-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lists-tabs {
        flex-direction: column;
    }
    
    .bulk-actions-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .bulk-buttons {
        justify-content: center;
    }
    
    .contacts-table th:nth-child(5),
    .contacts-table td:nth-child(5) {
        display: none;
    }
    
    .import-steps {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --background: #111827;
        --card-background: #1f2937;
        --border-color: #374151;
    }
}