:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px 0;
}

.sidebar-header {
    padding: 0 20px 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    font-size: 1.8rem;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    background: var(--light);
    border-radius: 20px 0 0 20px;
    margin: 10px 10px 10px 0;
    overflow: hidden;
}

.header {
    height: var(--header-height);
    background: white;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
    color: var(--success);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.card-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

.card-body {
    padding: 25px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.stat-icon.sent { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.speed { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--secondary);
    font-weight: 500;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    margin-top: 5px;
    color: var(--secondary);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Progress */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.progress-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.progress-stat {
    text-align: center;
    padding: 15px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--border-radius);
}

.progress-stat label {
    display: block;
    font-size: 0.9rem;
    color: var(--secondary);
    margin-bottom: 5px;
}

.progress-stat span {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
}

/* Activity */
.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.activity-content p {
    margin-bottom: 5px;
    line-height: 1.4;
}

.activity-time {
    font-size: 0.85rem;
    color: var(--secondary);
}

/* File Manager Styles */
.file-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.file-manager-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
}

.file-explorer {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.folder-section {
    margin-bottom: 25px;
}

.folder-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 1.1rem;
}

.folder-section h3 i {
    color: #f59e0b;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.file-item:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(5px);
}

.file-item.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

.file-icon {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

.file-name {
    flex: 1;
    font-weight: 500;
}

.file-actions-small {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: var(--transition);
}

.file-item:hover .file-actions-small {
    opacity: 1;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small.edit { color: var(--primary); }
.btn-small.delete { color: var(--danger); }
.btn-small:hover { background: rgba(0,0,0,0.1); }

.file-editor {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.editor-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#fileEditor {
    flex: 1;
    border: none;
    padding: 25px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background: #fafafa;
}

.editor-info {
    padding: 15px 25px;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--secondary);
    background: white;
}

.no-files {
    text-align: center;
    color: var(--secondary);
    font-style: italic;
    padding: 20px;
}

/* Create File Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Settings */
.settings-grid {
    display: grid;
    gap: 20px;
}

.setting-item {
    padding: 20px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary);
}

.setting-item label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.setting-item p {
    color: var(--secondary);
    margin-bottom: 15px;
}

/* Analytics */
.analytics-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary);
}

.analytics-placeholder i {
    margin-bottom: 20px;
    color: #e2e8f0;
}

.analytics-placeholder h4 {
    margin-bottom: 10px;
    color: var(--dark);
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    background: white;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--danger);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    height: calc(100vh - var(--header-height) - 20px);
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .file-manager-container {
        grid-template-columns: 1fr;
    }
    
    .file-explorer {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }
    
    .logo span, .nav-item span {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .header-right {
        flex-direction: column;
        gap: 10px;
    }
}

/* SMTP Tester Styles */
.smtp-tester-header {
    margin-bottom: 30px;
}

.smtp-tester-header h2 {
    color: var(--dark);
    margin-bottom: 8px;
}

.smtp-tester-header p {
    color: var(--secondary);
    font-size: 1.1rem;
}

.smtp-tester-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.smtp-config-form {
    min-width: 0;
}

.smtp-test-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.test-results-container {
    min-height: 200px;
}

.test-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary);
}

.test-placeholder i {
    margin-bottom: 20px;
    color: #e2e8f0;
}

.test-placeholder h4 {
    margin-bottom: 10px;
    color: var(--dark);
}

/* Test Result States */
.test-result {
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.test-result.success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success);
}

.test-result.error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger);
}

.test-result.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
}

.test-result.info {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary);
}

.test-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.test-result-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.test-result.success .test-result-icon {
    background: var(--success);
    color: white;
}

.test-result.error .test-result-icon {
    background: var(--danger);
    color: white;
}

.test-result.warning .test-result-icon {
    background: var(--warning);
    color: white;
}

.test-result.info .test-result-icon {
    background: var(--primary);
    color: white;
}

.test-result-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.test-result-message {
    margin-bottom: 15px;
    line-height: 1.5;
}

.test-result-details {
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.test-result-meta {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--secondary);
    display: flex;
    justify-content: space-between;
}

/* SMTP Presets */
.smtp-presets {
    margin-top: 10px;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.preset-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--border-radius);
    border: 2px solid transparent;
    transition: var(--transition);
}

.preset-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.preset-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.preset-info {
    flex: 1;
}

.preset-info h4 {
    margin-bottom: 5px;
    font-size: 1rem;
}

.preset-info p {
    font-size: 0.8rem;
    color: var(--secondary);
    line-height: 1.3;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Test Progress */
.test-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.progress-steps {
    display: flex;
    gap: 5px;
}

.progress-step {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: var(--transition);
}

.progress-step.active {
    background: var(--primary);
}

.progress-step.completed {
    background: var(--success);
}

/* Responsive */
@media (max-width: 1024px) {
    .smtp-tester-container {
        grid-template-columns: 1fr;
    }
    
    .preset-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .smtp-tester-header h2 {
        font-size: 1.5rem;
    }
    
    .test-result-details {
        font-size: 0.8rem;
    }
}

/* PDF Attachment Styles */
.pdf-attachments-section {
    margin: 30px 0;
    padding: 25px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--border-radius);
    border: 2px solid rgba(99, 102, 241, 0.1);
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--primary);
}

.section-header p {
    color: var(--secondary);
    margin-bottom: 20px;
}

.pdf-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.pdf-option-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #e2e8f0;
    transition: var(--transition);
}

.pdf-option-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.pdf-option-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.pdf-option-info h4 {
    margin-bottom: 5px;
    color: var(--dark);
}

.pdf-option-info p {
    color: var(--secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.pdf-option-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--secondary);
}

.pdf-option-preview i {
    color: var(--primary);
    width: 16px;
}

/* PDF Summary */
.pdf-summary {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.pdf-summary-active {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid var(--success);
}

.pdf-summary-inactive {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--secondary);
    background: rgba(100, 116, 139, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary);
}

/* Campaign Summary */
.campaign-summary {
    background: rgba(99, 102, 241, 0.05);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
    border-left: 4px solid var(--primary);
}

.campaign-summary h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.campaign-summary ul {
    list-style: none;
    padding: 0;
}

.campaign-summary li {
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.campaign-summary li i {
    width: 16px;
    color: var(--success);
}

/* Responsive */
@media (max-width: 768px) {
    .pdf-options-grid {
        grid-template-columns: 1fr;
    }
    
    .pdf-option-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .toggle-switch {
        align-self: flex-end;
    }
}

/* Dynamic PDF Template Styles */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.section-title h3 {
    margin-bottom: 0;
}

.pdf-templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.pdf-templates-header h4 {
    margin: 0;
    color: var(--dark);
}

.pdf-bulk-actions {
    display: flex;
    gap: 10px;
}

.pdf-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.pdf-template-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #e2e8f0;
    transition: var(--transition);
}

.pdf-template-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.pdf-template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.pdf-template-info h5 {
    margin-bottom: 5px;
    color: var(--dark);
    font-size: 1rem;
}

.pdf-template-info p {
    color: var(--secondary);
    font-size: 0.8rem;
    line-height: 1.3;
    margin: 0;
}

.pdf-template-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--secondary);
    margin-bottom: 15px;
}

.pdf-template-preview i {
    color: var(--primary);
    width: 16px;
}

.pdf-template-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* No PDF Templates State */
.no-pdf-templates {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary);
}

.no-pdf-templates i {
    margin-bottom: 15px;
    color: #e2e8f0;
}

.no-pdf-templates h4 {
    margin-bottom: 10px;
    color: var(--dark);
}

.no-pdf-templates p {
    margin-bottom: 20px;
}

.loading-pdfs {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary);
}

.loading-pdfs i {
    margin-bottom: 15px;
    color: var(--primary);
}

/* Enhanced PDF Summary */
.pdf-summary-active {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--success);
}

.pdf-summary-active div {
    flex: 1;
}

.pdf-summary-active strong {
    display: block;
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .pdf-templates-grid {
        grid-template-columns: 1fr;
    }
    
    .pdf-template-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .section-title {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .pdf-templates-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .pdf-bulk-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* File Attachments Styles */
.file-attachments-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.file-attachments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.file-attachments-bulk-actions {
    display: flex;
    gap: 0.5rem;
}

.file-attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.file-attachment-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.file-attachment-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.file-attachment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.file-attachment-info h5 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    color: var(--dark);
}

.file-attachment-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--secondary);
}

.file-attachment-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--secondary);
}

.file-attachment-preview i {
    font-size: 1.1rem;
    color: var(--primary);
}

.no-file-attachments {
    text-align: center;
    padding: 2rem;
    color: var(--secondary);
}

.no-file-attachments i {
    margin-bottom: 1rem;
    color: #e2e8f0;
}

.file-attachments-summary-active,
.file-attachments-summary-inactive {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.file-attachments-summary-active {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.file-attachments-summary-inactive {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--secondary);
}

/* Upload Modal Styles */
.file-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.file-preview-header {
    margin-bottom: 1rem;
}

.file-preview-header h4 {
    margin: 0;
    color: var(--dark);
    font-size: 1rem;
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-preview-icon {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.file-preview-icon i {
    color: var(--primary);
}

.file-preview-info {
    flex: 1;
}

.file-info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.file-info-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.file-info-item strong {
    color: var(--dark);
}

.file-info-item span {
    color: var(--secondary);
    word-break: break-all;
    margin-left: 1rem;
}

/* File input styling */
input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #e2e8f0;
    border-radius: 6px;
    background: white;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

input[type="file"]::file-selector-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin-right: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--primary-dark);
}

/* Theme Variables - Fixed Version */
:root {
    /* Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f1f5f9;
    --sidebar-hover: #334155;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --error-light: #fee2e2;
    --info: #3b82f6;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --card-bg: #1e293b;
    --sidebar-bg: #0f172a;
    --sidebar-text: #f1f5f9;
    --sidebar-hover: #334155;
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --success: #34d399;
    --success-light: #065f46;
    --warning: #fbbf24;
    --warning-light: #92400e;
    --error: #f87171;
    --error-light: #7f1d1d;
    --info: #60a5fa;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Theme Toggle Styles */
.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--bg-primary);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .toggle-switch {
    background: var(--primary);
}

[data-theme="dark"] .toggle-switch::after {
    transform: translateX(24px);
    background: var(--bg-primary);
}

.toggle-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Update header styles for theme toggle */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.theme-icon {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

[data-theme="dark"] .theme-icon {
    color: #fbbf24; /* Sun color for dark mode */
}

/* Update notification styles for dark mode */
.notification {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

.notification.info {
    border-left: 4px solid var(--info);
}

/* Update card styles for dark mode */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
}

/* Update form styles for dark mode */
.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: var(--bg-primary);
}

/* Update button styles for dark mode */
.btn {
    transition: all 0.2s ease;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

/* Update file items for dark mode */
.file-item {
    border: 1px solid var(--border-color);
}

.file-item:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.file-item.active {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

/* Update modal styles for dark mode */
.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

/* Update PDF template cards for dark mode */
.pdf-template-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.pdf-template-card:hover {
    border-color: var(--primary);
}

/* Update file attachment cards for dark mode */
.file-attachment-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.file-attachment-card:hover {
    border-color: var(--primary);
}

/* Update progress bar for dark mode */
.progress-bar {
    background: var(--bg-tertiary);
}

.progress-fill {
    background: var(--primary);
}

/* Update status indicator for dark mode */
.status-dot {
    background: var(--success);
}

/* Update activity items for dark mode */
.activity-item {
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

/* Add smooth transitions for all theme-able elements */
.app-container,
.sidebar,
.header,
.card,
.form-group input,
.form-group select,
.form-group textarea,
.btn,
.file-item,
.modal-content,
.pdf-template-card,
.file-attachment-card,
.notification {
    transition: background-color 0.3s ease, 
                border-color 0.3s ease, 
                color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Specific transitions for critical elements */
.sidebar-nav a {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.stat-card {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.toggle-switch {
    transition: background-color 0.3s ease;
}

.toggle-switch::after {
    transition: transform 0.3s ease, background-color 0.3s ease;
}

/* Tags Reference Styles */
.tags-section {
    padding: 0;
}

.tags-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.tags-header p {
    margin: 0;
    flex: 1;
    color: var(--text-muted);
}

.tags-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

.tag-category {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.tag-category h4 {
    margin: 0 0 1rem 0;
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-category h4 i {
    opacity: 0.7;
}

.tag-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

.tag-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.tag-item.copied {
    background: var(--success-light);
    border-color: var(--success);
    animation: pulse 0.5s ease;
}

.tag-item code {
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    color: var(--primary);
    border: 1px solid var(--border-color);
}

.tag-item span {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Usage Examples */
.usage-examples {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.usage-examples h4 {
    margin: 0 0 1rem 0;
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.example-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.example-item label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.example-item code {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: var(--text);
    border: 1px solid var(--border-color);
    word-break: break-all;
}

/* Animation for copied state */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tags-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .tag-list {
        grid-template-columns: 1fr;
    }
    
    .example-grid {
        grid-template-columns: 1fr;
    }
}