/* ============================================
   swarmworx.com Design System
   Version: 1.0 | 2026-03-02
   ============================================ */

/* CSS Variables - Single Source of Truth */
:root {
    /* Brand Colors */
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    
    /* Background */
    --dark: #1e293b;
    --darker: #050508;
    --darker-alt: #0f0f17;
    
    /* Text */
    --light: #f8fafc;
    --gray: #94a3b8;
    --gray-dark: #64748b;
    
    /* Accent */
    --accent: #22d3ee;
    --accent-purple: #a78bfa;
    
    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Spacing */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Transitions */
    --transition: all 0.3s ease;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--dark);
    color: var(--light);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* ============================================
   Buttons - Unified
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: var(--darker-alt);
    color: var(--light);
    border: 1px solid rgba(255,255,255,0.1);
}

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

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

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

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

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

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ============================================
   Cards - Unified
   ============================================ */
.card {
    background: var(--darker);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255,255,255,0.1);
}

.card-interactive:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* ============================================
   Badges - Unified
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.badge-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--gray);
}

/* ============================================
   Form Elements - Unified
   ============================================ */
input, select, textarea {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    background: var(--dark);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    color: var(--light);
    transition: var(--transition);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

input::placeholder {
    color: var(--gray-dark);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--light);
}

/* ============================================
   Tables - Unified
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.05);
}

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

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    background: var(--darker);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.95rem;
}

tr:hover td {
    background: rgba(16, 185, 129, 0.03);
}

/* ============================================
   Layout Helpers
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.flex {
    display: flex;
}

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

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.grid {
    display: grid;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ============================================
   Animations
   ============================================ */

/* ============================================
   Navigation Additions
   ============================================ */
.nav-divider {
    width: 1px;
    height: 24px;
    background: #334155;
    margin: 0 0.5rem;
}

.nav-link-alt {
    color: var(--gray);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link-alt:hover {
    color: var(--light);
    background: rgba(255,255,255,0.05);
}

.nav-link-primary {
    color: var(--primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 600;
}

.nav-link-primary:hover {
    background: var(--primary);
    color: white;
}

/* ============================================
   Utility Classes
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-gray { color: var(--gray); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.bg-darker { background: var(--darker); }
.bg-darker-alt { background: var(--darker-alt); }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .container {
        padding: 0 1rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
    }
}

/* ============================================
   Backend Specific Styles
   ============================================ */

/* Views */
.view { display: none; }
.view.active { display: block; }
.view.active { display: block !important; }

/* Panels */
.panel { display: none; }
.panel.active { display: block; }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.card { background: white; padding: 1.5rem; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 1rem; }
.card h3 { margin-bottom: 0.5rem; }
.card p { color: #666; margin-bottom: 0.5rem; }
.card-meta { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* Badges */
.badge { padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; }
.badge-offen { background: #fef3c7; color: #92400e; }
.badge-bestaetigt { background: #d1fae5; color: #065f46; }
.badge-abgelehnt { background: #fee2e2; color: #991b1b; }

/* Navigation */
.nav { display: flex; gap: 0.5rem; }
.nav-btn { padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; border: none; background: transparent; font-weight: 600; }
.nav-btn.active { background: var(--primary); color: white; }

/* Header */
.header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; background: white; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.header-right { display: flex; align-items: center; gap: 1rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card { background: white; padding: 1.5rem; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); text-align: center; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .label { color: #666; font-size: 0.875rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Buttons */
.btn-small { padding: 0.25rem 0.5rem; font-size: 0.875rem; border-radius: 6px; cursor: pointer; border: none; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }

/* Loading */
.loading { text-align: center; padding: 2rem; color: #666; }

/* Empty states */
.empty { text-align: center; padding: 3rem; color: #999; }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* User */
.user-menu { display: flex; align-items: center; gap: 0.5rem; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.logout-btn { padding: 0.5rem 1rem; border-radius: 8px; border: 2px solid var(--primary); color: var(--primary); background: transparent; cursor: pointer; }

/* Logo */
.logo { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.5rem; }
.logo-icon { font-size: 1.5rem; }

/* Main content */
.main { padding: 2rem; max-width: 1200px; margin: 0 auto; }

/* Pipeline specific */
.pipeline-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.pipeline-column { background: white; padding: 1rem; border-radius: 12px; min-height: 400px; }
.pipeline-column h3 { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary); }



/* Utility Classes */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Padding/Margin utilities */
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }

/* Text utilities */
.text-center { text-align: center; }
.text-gray { color: #666; }
.text-small { font-size: 0.875rem; }

/* Border utilities */
.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }

/* Background utilities */
.bg-light { background: #f8fafc; }
.bg-white { background: white; }
.bg-primary { background: var(--primary); }

/* Min height */
.min-h-400 { min-height: 400px; }



/* Drag & Drop Styles */
.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

[data-status]:hover {
    background: #f8fafc;
}

[data-status].drag-over {
    background: #d1fae5 !important;
    border: 2px dashed #10b981;
}

/* === CONSISTENT COMPONENTS === */

/* Buttons */
.btn-primary {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
}

.btn-secondary {
    background: #6b7280 !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
}

.btn-danger {
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
}

.btn-small {
    padding: 6px 12px !important;
    font-size: 12px !important;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

/* Forms */
.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

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

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-gray {
    background: #6b7280;
    color: white;
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Slide Panels */
.slide-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    transition: right 0.3s;
    z-index: 1001;
    overflow-y: auto;
    padding: 24px;
}

.slide-panel.active {
    right: 0;
}

/* Toast */
.toast {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s;
}

.toast-success {
    background: #10b981;
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

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

/* === CONSISTENT HEADER === */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 16px;
}

.header-nav a {
    color: #6b7280;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
    background: var(--primary);
    color: white;
}

/* === CONSISTENT SIDEBAR === */
.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid #e5e7eb;
    padding: 20px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #6b7280;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #f3f4f6;
    color: var(--primary);
}

/* === MAIN CONTENT AREA === */
.main-content {
    margin-left: 250px;
    padding: 24px;
    min-height: 100vh;
    background: #f8fafc;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .main-content {
        margin-left: 0;
    }
}

/* === CONSISTENT BADGES === */
.badge-count {
    background: #6b7280;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.badge-warenkorb { background: #6b7280; color: white; }
.badge-vorsortierung { background: #f59e0b; color: white; }
.badge-pipeline { background: #10b981; color: white; }
