/* ========================================
   MAGICLISTINGS.AI - COMPONENT LIBRARY
   Reusable Components für alle Seiten

   Version: 1.0
   Erstellt: 2025-11-12
======================================== */

/* ========================================
   CSS VARIABLES (Design Tokens)
======================================== */
:root {
    /* Brand Gradient - Same for both modes (colorful!) */
    --gradient-primary: linear-gradient(135deg, hsla(271, 81%, 56%, 1) 20%, hsla(351, 88%, 74%, 1) 62%, hsla(49, 89%, 61%, 1) 100%);

    /* Brand Colors - Same for both modes */
    --color-navy: #1E3A8A;
    --color-purple: #9333EA;
    --color-pink: #F78193;
    --color-yellow: #F5D547;

    /* UI Colors - LIGHT MODE */
    --color-bg-light: #F8F9FA;
    --color-bg-white: #FFFFFF;
    --color-bg-card: #FFFFFF;
    --color-border: #E5E7EB;
    --color-border-light: #F3F4F6;

    /* Text Colors - LIGHT MODE */
    --color-text-primary: #1E3A8A;
    --color-text-secondary: #6B7280;
    --color-text-muted: #9CA3AF;
    --color-text-white: #FFFFFF;

    /* Feedback Colors - Same for both modes */
    --color-success: #34C759;
    --color-error: #FF3B30;
    --color-warning: #FF9500;
    --color-info: #007AFF;

    /* Shadows - LIGHT MODE */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(147, 51, 234, 0.15);
    --shadow-glow: 0 4px 15px rgba(147, 51, 234, 0.4);
    --shadow-glow-hover: 0 10px 30px rgba(147, 51, 234, 0.5);

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 20px;
    --spacing-lg: 40px;
    --spacing-xl: 60px;
    --spacing-2xl: 100px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-size-4xl: 42px;
    --font-size-5xl: 52px;
    --font-size-6xl: 72px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========================================
   DARK MODE VARIABLES
======================================== */
[data-theme="dark"] {
    /* Gradient - Slightly lighter for better visibility on dark */
    --gradient-primary: linear-gradient(135deg,
        hsla(271, 81%, 66%, 1) 20%,   /* Lighter Purple */
        hsla(351, 88%, 84%, 1) 62%,   /* Lighter Pink */
        hsla(49, 89%, 71%, 1) 100%    /* Lighter Yellow */
    );

    /* UI Colors - DARK MODE */
    --color-bg-light: #0F172A;      /* Dark Navy (not pure black) */
    --color-bg-white: #1E293B;      /* Slate 800 */
    --color-bg-card: #1E293B;       /* Slate 800 */
    --color-border: #334155;        /* Slate 700 */
    --color-border-light: #475569;  /* Slate 600 */

    /* Text Colors - DARK MODE */
    --color-text-primary: #F1F5F9;  /* Slate 100 - Very readable */
    --color-text-secondary: #94A3B8; /* Slate 400 */
    --color-text-muted: #64748B;    /* Slate 500 */
    --color-text-white: #FFFFFF;

    /* Shadows - DARK MODE (lighter for visibility) */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(147, 51, 234, 0.3);
    --shadow-glow: 0 4px 15px rgba(147, 51, 234, 0.6);
    --shadow-glow-hover: 0 10px 30px rgba(147, 51, 234, 0.7);
}

/* Smooth transition for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ========================================
   BUTTON COMPONENTS
======================================== */

/* Primary Button (Gradient) */
.btn-primary {
    background: var(--gradient-primary);
    background-size: 200% 200%;
    color: var(--color-text-white);
    padding: 12px 30px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 700;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
    display: inline-block;
    text-decoration: none;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-slow);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-hover);
    background-position: 100% 0;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button (White) */
.btn-secondary {
    background: var(--color-bg-white);
    color: var(--color-purple);
    padding: 12px 30px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-block;
    text-decoration: none;
}

.btn-secondary:hover {
    border-color: var(--color-purple);
    background: #F9FAFB;
    transform: translateY(-2px);
}

/* Tertiary Button (Ghost) */
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    padding: 12px 30px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-block;
    text-decoration: none;
}

.btn-ghost:hover {
    background: var(--color-bg-light);
    border-color: var(--color-purple);
    color: var(--color-purple);
}

/* Small Button Variant */
.btn-sm {
    padding: 8px 16px;
    font-size: var(--font-size-sm);
}

/* Large Button Variant */
.btn-lg {
    padding: 16px 40px;
    font-size: var(--font-size-lg);
}

/* Full Width Button */
.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

/* ========================================
   CARD COMPONENTS
======================================== */

/* Base Card */
.card {
    background: var(--color-bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

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

/* Interactive Card (with hover border) */
.card-interactive {
    cursor: pointer;
    border: 2px solid transparent;
}

.card-interactive:hover {
    border-color: var(--color-purple);
}

/* Card with Icon */
.card-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

/* Card Header */
.card-header {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

/* Card Body */
.card-body {
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* Card Footer */
.card-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

/* ========================================
   BADGE COMPONENTS
======================================== */

/* Base Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Badges */
.badge-imported {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-in-progress {
    background: #FEF3C7;
    color: #92400E;
}

.badge-completed {
    background: #D1FAE5;
    color: #065F46;
}

/* Priority Badges */
.badge-critical {
    background: var(--color-error);
    color: white;
}

.badge-high {
    background: var(--color-warning);
    color: #000;
}

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

.badge-low {
    background: var(--color-text-muted);
    color: white;
}

/* Info Badge */
.badge-info {
    background: var(--color-info);
    color: white;
}

/* ========================================
   SPINNER / LOADING COMPONENTS
======================================== */

/* Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-purple);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Small Spinner */
.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* Large Spinner */
.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--spacing-md);
    z-index: 9999;
}

.loading-overlay-text {
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: var(--font-size-lg);
}

/* ========================================
   FILTER BUTTON COMPONENTS
======================================== */

/* Filter Button (Pill Style) */
.filter-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

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

.filter-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

/* ========================================
   GRID LAYOUTS
======================================== */

/* 2 Column Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

/* 3 Column Grid */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

/* 4 Column Grid */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
}

/* Auto-fit Grid (responsive) */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

/* Responsive Grids */
@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

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

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

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

/* Modal Container */
.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.modal-title {
    font-size: var(--font-size-2xl);
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* Modal Close Button */
.modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Modal Body */
.modal-body {
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* Modal Footer */
.modal-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

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

/* Form Group */
.form-group {
    margin-bottom: var(--spacing-md);
}

/* Form Label */
.form-label {
    display: block;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
    font-size: var(--font-size-sm);
}

/* Form Input */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: all var(--transition-fast);
    background: var(--color-bg-white);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-purple);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

/* Textarea */
.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Help Text */
.form-help {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 5px;
}

/* Form Error */
.form-error {
    color: var(--color-error);
    font-size: var(--font-size-xs);
    margin-top: 5px;
    font-weight: 600;
}

/* ========================================
   ALERT COMPONENTS
======================================== */

/* Base Alert */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Success Alert */
.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #34C759;
}

/* Error Alert */
.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FF3B30;
}

/* Warning Alert */
.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FF9500;
}

/* Info Alert */
.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #007AFF;
}

/* ========================================
   TOAST NOTIFICATIONS
======================================== */

/* Toast Container */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Toast */
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--font-size-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
    min-width: 250px;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.toast-out {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Toast Variants */
.toast-success {
    background: #10B981;
    color: white;
}

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

.toast-warning {
    background: #F59E0B;
    color: white;
}

.toast-info {
    background: #3B82F6;
    color: white;
}

/* ========================================
   UTILITY CLASSES
======================================== */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text Colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-white { color: var(--color-text-white); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }

/* Font Weights */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

/* Spacing Utilities - Margin */
.m-0 { margin: 0; }
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

/* Spacing Utilities - Padding */
.p-0 { padding: 0; }
.pt-xs { padding-top: var(--spacing-xs); }
.pt-sm { padding-top: var(--spacing-sm); }
.pt-md { padding-top: var(--spacing-md); }
.pt-lg { padding-top: var(--spacing-lg); }
.pt-xl { padding-top: var(--spacing-xl); }

.pb-xs { padding-bottom: var(--spacing-xs); }
.pb-sm { padding-bottom: var(--spacing-sm); }
.pb-md { padding-bottom: var(--spacing-md); }
.pb-lg { padding-bottom: var(--spacing-lg); }
.pb-xl { padding-bottom: var(--spacing-xl); }

/* Display Utilities */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flexbox Utilities */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Width Utilities */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }

/* Gradient Text */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Shadow Utilities */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-none { box-shadow: none; }

/* Border Radius Utilities */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Cursor Utilities */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* Hover Effects */
.hover-lift {
    transition: transform var(--transition-fast);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* ========================================
   DARK MODE TOGGLE BUTTON
======================================== */

/* Dark Mode Toggle Button */
.btn-dark-mode {
    padding: 8px 16px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.btn-dark-mode:hover {
    border-color: var(--color-purple);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-dark-mode .dark-mode-icon {
    display: inline-block;
    transition: transform var(--transition-normal);
}

.btn-dark-mode:hover .dark-mode-icon {
    transform: rotate(15deg) scale(1.1);
}

/* Dark mode specific adjustments */
[data-theme="dark"] .btn-dark-mode {
    background: rgba(147, 51, 234, 0.1);
    border-color: var(--color-purple);
}

[data-theme="dark"] .btn-dark-mode:hover {
    background: rgba(147, 51, 234, 0.2);
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.4);
}

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

@media (max-width: 768px) {
    /* Mobile-only display */
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    /* Mobile text sizes */
    .mobile-text-sm {
        font-size: var(--font-size-sm);
    }

    .mobile-text-base {
        font-size: var(--font-size-base);
    }

    /* Mobile padding adjustments */
    .mobile-p-sm {
        padding: var(--spacing-sm);
    }

    .mobile-p-md {
        padding: var(--spacing-md);
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }
}
