/**
 * ============================================================
 * ZEITWEBEN - Main Stylesheet
 * ============================================================
 * 
 * This file contains custom CSS that extends Tailwind CSS.
 * Tailwind is loaded via script tag in the layout.
 */

/* ============================================================
   Custom Properties (CSS Variables)
   ============================================================ */
:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-secondary: #8b5cf6;
    --color-accent: #ec4899;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    --timeline-line-width: 3px;
    --timeline-dot-size: 16px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(99, 102, 241, 0.2);
    color: inherit;
}

/* ============================================================
   Typography
   ============================================================ */
.prose h1, .prose h2, .prose h3, .prose h4 {
    font-weight: 600;
    line-height: 1.3;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   Timeline Styles
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: var(--timeline-line-width);
    background: linear-gradient(to bottom, var(--color-primary), var(--color-secondary));
    border-radius: 9999px;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: calc(-2rem + 0.5rem - var(--timeline-dot-size) / 2 + var(--timeline-line-width) / 2);
    width: var(--timeline-dot-size);
    height: var(--timeline-dot-size);
    background: var(--color-primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-content {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* Dark mode timeline */
.dark .timeline-dot {
    border-color: #1f2937;
}

.dark .timeline-content {
    background: #1f2937;
    border-color: #374151;
}

/* ============================================================
   Lifeline Styles (für Personen/Tiere)
   ============================================================ */
.lifeline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 9999px;
    opacity: 0.6;
}

.lifeline:hover {
    opacity: 1;
}

.lifeline-label {
    position: absolute;
    top: 0;
    transform: translateY(-100%);
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    background: inherit;
    border-radius: 0.25rem;
}

/* ============================================================
   Card Styles
   ============================================================ */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .card {
    background: #1f2937;
    border-color: #374151;
}

/* ============================================================
   Form Styles
   ============================================================ */
.form-input, .form-select, .form-textarea {
    appearance: none;
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: white;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dark .form-input, .dark .form-select, .dark .form-textarea {
    background-color: #374151;
    border-color: #4b5563;
    color: white;
}

/* ============================================================
   Button Styles
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.15s;
    cursor: pointer;
}

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

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

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

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.dark .btn-secondary {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

.dark .btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

/* ============================================================
   Animation Utilities
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    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 0.3s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #e5e7eb;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   Grid Backgrounds
   ============================================================ */
.bg-grid-white\/\[0\.05\] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' width='32' height='32' fill='none' stroke='rgb(255 255 255 / 0.05)'%3e%3cpath d='M0 .5H31.5V32'/%3e%3c/svg%3e");
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .no-print {
        display: none !important;
    }
    
    .timeline::before {
        background: #000;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}
