/**
 * Newsletter Marketing App - Stylesheet
 * Clean, modernes Design
 */

/* =====================================================
   CSS VARIABLEN
   ===================================================== */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2c3e50;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #34495e;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-lg: 0 5px 20px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* =====================================================
   RESET & BASIS
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--gray-100);
}

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

a:hover {
    color: var(--primary-dark);
}

/* =====================================================
   LAYOUT
   ===================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--secondary);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h1 svg {
    width: 28px;
    height: 28px;
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--white);
}

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

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 10px 20px;
}

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

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

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--secondary);
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

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

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-100);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* =====================================================
   STATISTIK-KARTEN
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: var(--white);
}

.stat-icon.blue { background: var(--primary); }
.stat-icon.green { background: var(--success); }
.stat-icon.orange { background: var(--warning); }
.stat-icon.red { background: var(--danger); }

.stat-content h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

.stat-content p {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn svg {
    width: 18px;
    height: 18px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

.btn-success:hover {
    background: #219a52;
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--dark);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

/* =====================================================
   FORMULARE
   ===================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.form-control::placeholder {
    color: var(--gray-500);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 4px;
}

/* =====================================================
   TABELLEN
   ===================================================== */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.table-actions {
    display: flex;
    gap: 5px;
}

.table-actions button {
    padding: 5px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    border-radius: 4px;
    transition: var(--transition);
}

.table-actions button:hover {
    background: var(--gray-200);
    color: var(--dark);
}

.table-actions button.delete:hover {
    background: var(--danger);
    color: var(--white);
}

/* =====================================================
   UPLOAD BEREICH
   ===================================================== */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(52, 152, 219, 0.05);
}

.upload-zone svg {
    width: 48px;
    height: 48px;
    color: var(--gray-400);
    margin-bottom: 15px;
}

.upload-zone h4 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--secondary);
}

.upload-zone p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.upload-zone input[type="file"] {
    display: none;
}

/* =====================================================
   MAPPING / ZUORDNUNG
   ===================================================== */
.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.mapping-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--gray-100);
    border-radius: var(--radius);
}

.mapping-item label {
    min-width: 100px;
    font-weight: 500;
}

.mapping-item select {
    flex: 1;
}

/* =====================================================
   EDITOR
   ===================================================== */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.editor-toolbar button {
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.editor-toolbar button:hover {
    background: var(--gray-200);
}

.editor-toolbar button.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.editor-content {
    min-height: 300px;
    padding: 15px;
    border: 1px solid var(--gray-300);
    border-radius: 0 0 var(--radius) var(--radius);
    outline: none;
}

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

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-600);
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 20px;
    max-height: calc(90vh - 130px);
    overflow-y: auto;
}

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

/* =====================================================
   ALERTS / NACHRICHTEN
   ===================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--white);
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

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

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--primary); }

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 14px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    background: var(--gray-100);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination-info {
    padding: 0 15px;
    color: var(--gray-600);
}

/* =====================================================
   BADGES / TAGS
   ===================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    background: var(--gray-200);
    color: var(--gray-700);
}

.badge-primary { background: var(--primary); color: var(--white); }
.badge-success { background: var(--success); color: var(--white); }
.badge-warning { background: var(--warning); color: var(--white); }
.badge-danger { background: var(--danger); color: var(--white); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--gray-200);
    border-radius: 4px;
    font-size: 12px;
    margin: 2px;
}

.tag-remove {
    cursor: pointer;
    opacity: 0.6;
}

.tag-remove:hover {
    opacity: 1;
}

/* =====================================================
   LOADING / SPINNER
   ===================================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* =====================================================
   TABS
   ===================================================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

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

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

.tab-content {
    display: none;
}

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

/* =====================================================
   NEWSLETTER VORSCHAU
   ===================================================== */
.newsletter-preview {
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 650px;
    margin: 0 auto;
}

.newsletter-preview iframe {
    width: 100%;
    min-height: 500px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
}

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-600);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--gray-400);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--secondary);
    margin-bottom: 10px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 992px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header h1 span,
    .nav-item span {
        display: none;
    }
    
    .sidebar-header h1 {
        justify-content: center;
    }
    
    .nav-item {
        justify-content: center;
        padding: 15px;
    }
    
    .nav-item svg {
        margin-right: 0;
    }
    
    .main-content {
        margin-left: 60px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 95%;
        margin: 10px;
    }
}

/* =====================================================
   UTILITIES
   ===================================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 20px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }
