/* =================================================================
   BASE.CSS - Verteller Core Styles
   =================================================================
   Basisstijlen en CSS variabelen voor alle platforms.
   Theme-specifieke variabelen worden overschreven door theme files.
   ================================================================= */

/* -----------------------------------------------------------------
   CSS Custom Properties (Defaults - NSFW General als fallback)
   ----------------------------------------------------------------- */
:root {
    /* Kleuren - worden overschreven door theme */
    --color-primary: #7C3AED;
    --color-primary-hover: #6D28D9;
    --color-secondary: #A855F7;
    --color-accent: #F59E0B;

    /* Achtergronden */
    --color-bg: #0F0F1A;
    --color-bg-alt: #1A1A2E;
    --color-surface: #1F1F2E;
    --color-surface-hover: #2A2A3E;
    --color-surface-active: #35354E;

    /* Tekst */
    --color-text: #E5E7EB;
    --color-text-muted: #9CA3AF;
    --color-text-dim: #6B7280;

    /* Borders */
    --color-border: #374151;
    --color-border-light: #4B5563;

    /* Status */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;

    /* Chat specifiek */
    --color-msg-user: rgba(124, 58, 237, 0.3);
    --color-msg-user-border: #7C3AED;
    --color-msg-ai: #1F2937;
    --color-msg-ai-border: #374151;

    /* Typography */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing & Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
}

/* -----------------------------------------------------------------
   Base Resets & Typography
   ----------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text);
}

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

a:hover {
    color: var(--color-secondary);
}

/* -----------------------------------------------------------------
   Scrollbar Styling
   ----------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-dim);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-light) var(--color-bg-alt);
}

/* -----------------------------------------------------------------
   Form Elements
   ----------------------------------------------------------------- */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

input::placeholder, textarea::placeholder {
    color: var(--color-text-dim);
}

/* -----------------------------------------------------------------
   Buttons (base styles, Tailwind handles most)
   ----------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
}

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

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

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-border-light);
}

.btn-ghost {
    background-color: transparent;
    color: var(--color-text-muted);
}

.btn-ghost:hover {
    background-color: var(--color-surface);
    color: var(--color-text);
}

/* -----------------------------------------------------------------
   Cards & Surfaces
   ----------------------------------------------------------------- */
.card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-hover {
    transition: all var(--transition-normal);
}

.card-hover:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-border-light);
    box-shadow: var(--shadow-md);
}

/* -----------------------------------------------------------------
   Chat Message Styling
   ----------------------------------------------------------------- */
.chat-container {
    background-color: var(--color-bg);
}

.msg-user {
    background-color: var(--color-msg-user);
    border: 1px solid var(--color-msg-user-border);
    border-radius: var(--radius-lg);
}

.msg-ai {
    background-color: var(--color-msg-ai);
    border: 1px solid var(--color-msg-ai-border);
    border-radius: var(--radius-lg);
}

.chat-input {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.chat-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

/* -----------------------------------------------------------------
   Navigation
   ----------------------------------------------------------------- */
.nav-link {
    color: var(--color-text-muted);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-text);
    background-color: var(--color-surface);
}

.nav-link.active {
    color: var(--color-primary);
    background-color: rgba(124, 58, 237, 0.1);
}

/* -----------------------------------------------------------------
   Badges & Tags
   ----------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background-color: rgba(124, 58, 237, 0.2);
    color: var(--color-secondary);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #34D399;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: #FBBF24;
}

.badge-error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #F87171;
}

/* -----------------------------------------------------------------
   Utility Classes
   ----------------------------------------------------------------- */
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-dim { color: var(--color-text-dim); }

.bg-surface { background-color: var(--color-surface); }
.bg-surface-hover { background-color: var(--color-surface-hover); }

.border-default { border-color: var(--color-border); }

/* Focus ring utility */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}

/* -----------------------------------------------------------------
   Animations
   ----------------------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease-out;
}

.animate-slide-up {
    animation: slideUp var(--transition-normal) ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* -----------------------------------------------------------------
   Responsive Utilities
   ----------------------------------------------------------------- */
@media (max-width: 640px) {
    .hide-mobile { display: none; }
}

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

/* -----------------------------------------------------------------
   Touch-Friendly Targets (Mobile Accessibility)
   WCAG 2.5.5: Minimum 44x44px touch targets
   ----------------------------------------------------------------- */

/* Touch target utility class - use for icon-only buttons */
.touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Touch target for links that need padding expansion */
.touch-target-link {
    position: relative;
}

.touch-target-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
}

/* Mobile-specific touch improvements */
@media (max-width: 768px) {
    /* Ensure all buttons have minimum touch target */
    button:not(.no-touch-expand),
    [role="button"]:not(.no-touch-expand),
    .btn:not(.no-touch-expand) {
        min-height: 44px;
    }

    /* Icon-only buttons need both dimensions */
    .icon-btn,
    button[aria-label]:not([class*="px-"]):not(.no-touch-expand) {
        min-width: 44px;
        min-height: 44px;
    }

    /* Navigation links get larger touch targets */
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Mobile menu links */
    #mobile-menu a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* Action buttons in message bubbles - larger on mobile */
    .action-btn-mobile {
        min-width: 40px;
        min-height: 40px;
        padding: 0.5rem;
    }

    /* Show action buttons always on touch devices (no hover) */
    .group .action-buttons {
        opacity: 1;
    }

    /* Larger select dropdowns for easier touch */
    select {
        min-height: 44px;
    }

    /* Form submit buttons */
    [type="submit"],
    button[type="submit"] {
        min-height: 48px;
    }
}

/* Tablet touch adjustments (touch capable but larger screens) */
@media (min-width: 769px) and (max-width: 1024px) and (pointer: coarse) {
    button:not(.no-touch-expand),
    [role="button"]:not(.no-touch-expand) {
        min-height: 40px;
    }

    .icon-btn {
        min-width: 40px;
        min-height: 40px;
    }
}

/* Ensure adequate spacing between touch targets */
@media (pointer: coarse) {
    .touch-spacing > * + * {
        margin-left: 0.5rem;
    }

    .touch-spacing-vertical > * + * {
        margin-top: 0.5rem;
    }
}

/* -----------------------------------------------------------------
   Confirmation Modal
   Vervangt browser confirm() met gebruiksvriendelijke modal
   ----------------------------------------------------------------- */

/* Overlay - covers entire screen */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.confirm-modal-overlay.hidden {
    display: none;
}

/* Backdrop - semi-transparent background */
.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: fadeIn 150ms ease-out;
}

/* Container - centers the modal */
.confirm-modal-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    animation: slideUp 200ms ease-out;
}

/* Content box */
.confirm-modal-content {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

/* Icon container */
.confirm-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    margin-bottom: 1rem;
    background-color: rgba(124, 58, 237, 0.15);
    color: var(--color-primary);
}

.confirm-modal-icon.confirm-modal-icon-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
}

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

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

/* Title */
.confirm-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.5rem 0;
}

/* Message */
.confirm-modal-message {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
    white-space: pre-line;
}

/* Button container */
.confirm-modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* Base button styles */
.confirm-modal-btn {
    flex: 1;
    max-width: 150px;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    min-height: 44px;
}

/* Cancel button */
.confirm-modal-btn-cancel {
    background-color: var(--color-surface-hover);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.confirm-modal-btn-cancel:hover {
    background-color: var(--color-surface-active);
    color: var(--color-text);
}

/* Confirm button - default (primary) */
.confirm-modal-btn-confirm {
    background-color: var(--color-primary);
    color: white;
}

.confirm-modal-btn-confirm:hover {
    background-color: var(--color-primary-hover);
}

/* Confirm button - danger variant */
.confirm-modal-btn-confirm.confirm-modal-btn-danger {
    background-color: var(--color-error);
}

.confirm-modal-btn-confirm.confirm-modal-btn-danger:hover {
    background-color: #DC2626;
}

/* Confirm button - warning variant */
.confirm-modal-btn-confirm.confirm-modal-btn-warning {
    background-color: var(--color-warning);
    color: #1F2937;
}

.confirm-modal-btn-confirm.confirm-modal-btn-warning:hover {
    background-color: #D97706;
}

/* Mobile: stack buttons vertically */
@media (max-width: 400px) {
    .confirm-modal-buttons {
        flex-direction: column-reverse;
    }

    .confirm-modal-btn {
        max-width: none;
    }
}
