/* ==========================================================================
   Tvoriva trieda - Custom Styles
   Silent Moon-inspired redesign — illustrated cards, bottom tabs, warm feel
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base & Typography
   -------------------------------------------------------------------------- */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Custom Brand Colors (supplement Tailwind config)
   -------------------------------------------------------------------------- */
:root {
    --brand-50: #F0F5F3;
    --brand-100: #D9E8E3;
    --brand-200: #B3D1C7;
    --brand-300: #8DBAA9;
    --brand-400: #5E9B87;
    --brand-500: #477A6C;
    --brand-600: #3B5B52;
    --brand-700: #2F4A42;
    --brand-800: #233832;
    --brand-900: #1A2B27;

    /* Mint accent scale */
    --mint-50: #EDFAF6;
    --mint-100: #D0F3E8;
    --mint-200: #A5E8D4;
    --mint-300: #73D9BD;
    --mint-400: #5ECAB2;
    --mint-500: #3DB598;
    --mint-600: #30917A;
    --mint-700: #276E5E;

    /* Rose accent scale */
    --rose-50: #FDF2F4;
    --rose-100: #FCE4E8;
    --rose-200: #F9CDD4;
    --rose-300: #F4A7B3;
    --rose-400: #E8788A;
    --rose-500: #DB4F66;
    --rose-600: #C03350;
    --rose-700: #A12842;

    /* Motion — Timing */
    --duration-fast: 100ms;
    --duration-normal: 160ms;
    --duration-moderate: 200ms;
    --duration-slow: 300ms;
    --duration-page: 400ms;
    --duration-progress: 700ms;

    /* Motion — Easing */
    --ease-standard: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-decelerate: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth-decel: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Semantic colors */
    --color-accent: #5ECAB2;
    --color-secondary: #E8788A;
    --color-ink: #1A1A1A;
    --color-success: #059669;
    --color-success-light: #EDFAF6;
    --color-warning: #D97706;
    --color-warning-light: #FFFBEB;
    --color-error: #DC2626;
    --color-error-light: #FDF2F4;
    --color-info: #2563EB;
    --color-info-light: #EFF6FF;
}

/* --------------------------------------------------------------------------
   Bottom Tab Bar (Mobile) — Silent Moon style
   -------------------------------------------------------------------------- */
.bottom-tab-bar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.75rem;
    color: #9CA3AF;
    transition: color var(--duration-moderate) ease, transform 0.15s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.bottom-tab:hover {
    color: #6B7280;
}

.bottom-tab:active {
    transform: scale(0.92);
}

.bottom-tab-active {
    color: #3B5B52;
}

.bottom-tab-active svg {
    stroke-width: 2;
}

/* --------------------------------------------------------------------------
   Soft Card Utility
   -------------------------------------------------------------------------- */
.card-soft {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
}

/* --------------------------------------------------------------------------
   Category Cards — hover elevation like Silent Moon
   -------------------------------------------------------------------------- */
.category-card {
    transition: transform var(--duration-moderate) ease, box-shadow var(--duration-moderate) ease;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   Flash Messages
   -------------------------------------------------------------------------- */
.flash-message {
    animation: flash-slide-in var(--duration-slow) ease-out;
}

.flash-message.flash-hiding {
    animation: flash-slide-out var(--duration-slow) ease-in forwards;
}

@keyframes flash-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flash-slide-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* --------------------------------------------------------------------------
   OCR Review Layout
   -------------------------------------------------------------------------- */
.ocr-photo-container {
    position: relative;
    overflow: hidden;
    max-height: 600px;
    border-radius: 1.5rem;
}

.ocr-photo-container img {
    transition: transform 0.2s ease;
    transform-origin: center center;
}

.ocr-photo-container.zoomed img {
    cursor: grab;
}

.ocr-photo-container.zoomed img:active {
    cursor: grabbing;
}

.ocr-entry-card .ocr-field.changed {
    border-color: var(--color-warning);
    background-color: var(--color-warning-light);
}

.ocr-entry-card .ocr-field.low-confidence {
    border-color: var(--color-error);
    background-color: var(--color-error-light);
}

/* --------------------------------------------------------------------------
   Photo Upload — Silent Moon inspired
   -------------------------------------------------------------------------- */
#drop-zone {
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

#drop-zone:hover {
    transform: translateY(-1px);
}

#drop-zone.drag-over {
    border-color: #3B5B52;
    background-color: #F0F5F3;
    transform: scale(1.01);
}

#drop-zone.drag-over * {
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Voice Recorder
   -------------------------------------------------------------------------- */
.recording-pulse {
    animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.recording-dot {
    display: inline-block;
}

/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */
.progress-bar-fill {
    transition: width var(--duration-progress) ease-out;
}

/* --------------------------------------------------------------------------
   Diff Display
   -------------------------------------------------------------------------- */
.diff-old {
    background-color: var(--rose-50);
    color: var(--rose-700);
    text-decoration: line-through;
}

.diff-new {
    background-color: var(--mint-50);
    color: var(--mint-700);
}

/* --------------------------------------------------------------------------
   Loading Spinner
   -------------------------------------------------------------------------- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-dark {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #3B5B52;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   Auth Layout — Silent Moon full-screen welcome
   -------------------------------------------------------------------------- */
.auth-bg-pattern {
    background-image:
        radial-gradient(circle at 80% 20%, rgba(94, 202, 178, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(232, 120, 138, 0.1) 0%, transparent 40%);
}

/* --------------------------------------------------------------------------
   Mobile Upload Flow
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .ocr-photo-container {
        max-height: 300px;
    }

    #drop-zone {
        padding: 1.5rem;
    }

    #photo-preview {
        max-height: 250px;
    }
}

/* --------------------------------------------------------------------------
   Scrollbar — hidden for horizontal scroll sections
   -------------------------------------------------------------------------- */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* --------------------------------------------------------------------------
   Reduced Motion — non-negotiable
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
    .progress-bar-fill {
        transition: none !important;
    }
}

/* --------------------------------------------------------------------------
   Print Styles (Portfolio Export)
   -------------------------------------------------------------------------- */
@media print {
    nav,
    footer,
    .no-print,
    .bottom-tab-bar,
    #flash-container,
    #toast-container {
        display: none !important;
    }

    body {
        background: white;
        font-size: 12pt;
    }

    main {
        padding: 0;
    }

    .bg-white {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
    }

    a {
        text-decoration: none;
        color: inherit;
    }

    .progress-bar-fill {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    @page {
        margin: 1.5cm;
    }
}

/* --------------------------------------------------------------------------
   Scrollbar Styling (non-hidden scrollbars)
   -------------------------------------------------------------------------- */
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* --------------------------------------------------------------------------
   Table Sorting Indicators
   -------------------------------------------------------------------------- */
th a[data-sort-active="asc"]::after {
    content: " \2191";
}

th a[data-sort-active="desc"]::after {
    content: " \2193";
}

/* --------------------------------------------------------------------------
   Transitions
   -------------------------------------------------------------------------- */
.transition-height {
    transition: max-height 0.3s ease;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Upload Wizard Steps
   -------------------------------------------------------------------------- */
.wizard-step {
    will-change: transform, opacity;
}

#wizard-viewport {
    min-height: 20rem;
}

/* --------------------------------------------------------------------------
   Illustrated Card Hover (Silent Moon style)
   -------------------------------------------------------------------------- */
.illustrated-card {
    transition: transform var(--duration-moderate) ease, box-shadow var(--duration-moderate) ease;
}

.illustrated-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px -6px rgba(0, 0, 0, 0.1);
}

.illustrated-card img {
    transition: transform 0.3s ease;
}

.illustrated-card:hover img {
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   Scroll Reveals
   -------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s var(--ease-smooth-decel),
                transform 0.5s var(--ease-smooth-decel);
}
.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}
.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }
.reveal-d3 { transition-delay: 0.3s; }
.reveal-d4 { transition-delay: 0.4s; }

/* --------------------------------------------------------------------------
   Completion Celebration
   -------------------------------------------------------------------------- */
@keyframes celebration-pop {
    0% { opacity: 0; transform: scale(0.8); }
    60% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}
.celebration-pop {
    animation: celebration-pop 0.4s var(--ease-spring) forwards;
}
