/* Base styles */
body { font-family: 'Inter', sans-serif; }
* { transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out; }

/* CSS Custom Properties for Safe Area Insets */
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
    /* Initial view display values (set by inline script to prevent flicker) */
    --initial-login-display: block;
    --initial-suggestion-display: none;
}

/* Prevent flicker on initial load by using CSS variables set in head */
#login-required-view {
    display: var(--initial-login-display) !important;
}
#suggestion-view {
    display: var(--initial-suggestion-display) !important;
}
/* JavaScript will override these with class changes after checking session */
#login-required-view.hidden,
#suggestion-view.hidden {
    display: none !important;
}

/* Browser compatibility fixes */
@supports not (height: 100dvh) {
    body {
        min-height: 100vh !important;
    }
}

/* Mobile Navigation Styles */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e5e7eb;
    height: calc(3.5rem + var(--sab));
    min-height: calc(3.5rem + var(--sab));
    max-height: calc(3.5rem + var(--sab));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    padding-bottom: 0;
}
.dark .mobile-nav {
    background: rgba(17, 24, 39, 0.95);
    border-top-color: #374151;
}
.mobile-nav-tabs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--sab);
    height: 3.5rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
}
.mobile-nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.375rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    color: #6b7280;
    text-decoration: none;
    min-width: 3.5rem;
}
.mobile-nav-tab.active {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.1);
}
.dark .mobile-nav-tab.active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}
.mobile-nav-tab:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.dark .mobile-nav-tab:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.mobile-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-bottom: 0.125rem;
}
.mobile-nav-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-align: center;
}

/* Mobile Header Styles */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    padding: 0.375rem 1rem;
    padding-top: calc(0.375rem + var(--sat));
    height: calc(3rem + var(--sat));
    min-height: calc(3rem + var(--sat));
    max-height: calc(3rem + var(--sat));
    pointer-events: none;
}
.mobile-header-content {
    pointer-events: auto;
}
.dark .mobile-header {
    background: rgba(17, 24, 39, 0.95);
    border-bottom-color: #374151;
}
.mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
}
.mobile-logo {
    width: 1.75rem;
    height: 1.75rem;
}
.mobile-app-name {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}
.dark .mobile-app-name {
    color: #fff;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        justify-content: flex-start !important;
        padding-top: calc(3rem + var(--sat)) !important;
        padding-bottom: calc(3.5rem + var(--sab)) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
        margin-top: 0 !important;
    }

    /* Center suggestion container vertically on mobile */
    body > div.flex-1 {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        min-height: calc(100vh - 7rem - var(--sat) - var(--sab)) !important;
        min-height: calc(100dvh - 7rem - var(--sat) - var(--sab)) !important;
    }

    main {
        margin-top: 0 !important;
        width: 100% !important;
        padding-top: 0 !important;
    }

    /* Reduce padding on suggestion containers on mobile */
    #login-required-view,
    #suggestion-view {
        padding: 0.75rem !important;
        margin-top: 0 !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: 1px solid #e5e7eb !important;
        box-shadow: none !important;
    }

    .dark #login-required-view,
    .dark #suggestion-view {
        border-top: 1px solid #374151 !important;
    }

    .desktop-header {
        display: none !important;
    }

    /* Ensure proper sizing on mobile */
    .mobile-header {
        height: calc(3rem + var(--sat)) !important;
        min-height: calc(3rem + var(--sat)) !important;
        max-height: calc(3rem + var(--sat)) !important;
        border-bottom: none !important;
    }
    .mobile-nav {
        height: calc(3.5rem + var(--sab)) !important;
        min-height: calc(3.5rem + var(--sab)) !important;
        max-height: calc(3.5rem + var(--sab)) !important;
    }

    /* Optimize textarea for mobile input */
    #suggestion-translation-input {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        -webkit-appearance: none;
        -webkit-text-size-adjust: 100%;
    }
}

@media (min-width: 769px) {
    .mobile-nav { display: none !important; }
    .mobile-header { display: none !important; }

    /* Desktop navigation spacing and styling */
    main {
        margin-top: 5rem !important; /* Add top margin for desktop header */
    }
}

/* Pre-generated TailwindCSS */
:root {
    --tw-ring-color: rgb(59 130 246 / 0.5);
    --tw-translate-x: 0;
    --tw-translate-y: 0;
    --tw-rotate: 0;
    --tw-skew-x: 0;
    --tw-skew-y: 0;
    --tw-scale-x: 1;
    --tw-scale-y: 1;
}
*, ::before, ::after {
    box-sizing: border-box;
    border-width: 0;
    border-style: solid;
    border-color: #e5e7eb;
}
::before, ::after { --tw-content: ''; }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; font-feature-settings: normal; font-variation-settings: normal; }
body { margin: 0; line-height: inherit; }
h1, h2, p { margin: 0; }
button, textarea { font-family: inherit; font-size: 100%; font-weight: inherit; line-height: inherit; color: inherit; margin: 0; padding: 0; }
button { text-transform: none; background-color: transparent; background-image: none; cursor: pointer; }
textarea { resize: vertical; }
.dark { color-scheme: dark; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }
.absolute { position: absolute; } .relative { position: relative; }
.top-4 { top: 1rem; } .left-4 { left: 1rem; } .right-4 { right: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; } .mt-6 { margin-top: 1.5rem; } .ml-3 { margin-left: 0.75rem; }
.flex { display: flex; } .hidden { display: none; }
.h-8 { height: 2rem; } .h-10 { height: 2.5rem; } .h-12 { height: 3rem; }
.w-8 { width: 2rem; } .w-10 { width: 2.5rem; } .w-12 { width: 3rem; } .w-20 { width: 5rem; } .w-full { width: 100%; }
.max-w-2xl { max-width: 42rem; }
.min-h-screen { min-height: 100vh; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-center { justify-content: center; } .justify-start { justify-content: flex-start; }
.gap-4 { gap: 1rem; }
.space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.5rem; }
.space-x-3 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.75rem; }
.rounded-lg { border-radius: 0.5rem; } .rounded-r-lg { border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }
.border { border-width: 1px; } .border-l-4 { border-left-width: 4px; } .border-2 { border-width: 2px; }
.border-gray-200 { border-color: #e5e7eb; } .border-gray-300 { border-color: #d1d5db; } .dark .dark\:border-gray-700 { border-color: #374151; } .dark .dark\:border-gray-600 { border-color: #4b5563; }
.border-red-500 { border-color: #ef4444; }
.border-blue-500 { border-color: #3b82f6; } .dark .dark\:focus\:border-blue-400:focus { border-color: #60a5fa; }
.bg-gray-100 { background-color: #f3f4f6; } .dark .dark\:bg-gray-900 { background-color: #111827; }
.bg-white { background-color: #fff; } .dark .dark\:bg-gray-800 { background-color: #1f2937; } .dark .dark\:bg-gray-700 { background-color: #374151; } .dark .dark\:bg-gray-600 { background-color: #4b5563; }
.bg-gray-300 { background-color: #d1d5db; }
.bg-blue-50 { background-color: #eff6ff; } .dark .dark\:bg-blue-900\/20 { background-color: rgb(30 58 138 / 0.2); }
.bg-blue-500 { background-color: #3b82f6; } .bg-blue-600 { background-color: #2563eb; }
.bg-red-100 { background-color: #fee2e2; } .dark .dark\:bg-red-900\/30 { background-color: rgb(127 29 29 / 0.3); }
.p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; } .py-4 { padding-top: 1rem; padding-bottom: 1rem; } .py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.text-center { text-align: center; } .text-right { text-align: right; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.leading-tight { line-height: 1.25; }
.text-gray-400 { color: #9ca3af; } .text-gray-500 { color: #6b7280; } .dark .dark\:text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; } .dark .dark\:text-gray-400 { color: #9ca3af; }
.text-gray-700 { color: #374151; } .dark .dark\:text-gray-300 { color: #d1d5db; } .dark .dark\:text-gray-200 { color: #e5e7eb; }
.text-gray-900 { color: #111827; } .dark .dark\:text-white { color: #fff; }
.text-blue-600 { color: #2563eb; } .dark .dark\:text-blue-400 { color: #60a5fa; }
.text-red-800 { color: #991b1b; } .dark .dark\:text-red-200 { color: #fecaca; }
.text-white { color: #fff; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.italic { font-style: italic; }
.opacity-80 { opacity: 0.8; }
.object-contain { object-fit: contain; }
.hover\:bg-gray-400:hover { background-color: #9ca3af; } .dark .dark\:hover\:bg-gray-500:hover { background-color: #6b7280; }
.hover\:bg-blue-600:hover { background-color: #2563eb; }
.hover\:underline:hover { text-decoration-line: underline; }
.hover\:opacity-80:hover { opacity: 0.8; }
.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:ring-2:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
.focus\:border-blue-500:focus { border-color: #3b82f6; }
.resize-none { resize: none; }

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

/* Transition utilities */
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 200ms; }
.duration-200 { transition-duration: 200ms; }

/* Additional utility classes for desktop navigation */
.space-x-1 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.25rem; }
.space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.font-medium { font-weight: 500; }
.text-gray-300 { color: #d1d5db; } .dark .dark\:text-gray-300 { color: #d1d5db; }
.bg-blue-50 { background-color: #eff6ff; } .dark .dark\:bg-blue-900\/20 { background-color: rgb(30 58 138 / 0.2); }
.hover\:text-blue-600:hover { color: #2563eb; } .dark .dark\:hover\:text-blue-400:hover { color: #60a5fa; }
.hover\:bg-gray-100:hover { background-color: #f3f4f6; } .dark .dark\:hover\:bg-gray-800:hover { background-color: #1f2937; }
.hover\:bg-gray-200:hover { background-color: #e5e7eb; } .dark .dark\:hover\:bg-gray-700:hover { background-color: #374151; }
.inline-flex { display: inline-flex; }
.w-11 { width: 2.75rem; }
.h-6 { height: 1.5rem; }
.bg-gray-300 { background-color: #d1d5db; }
.rounded-full { border-radius: 9999px; }

@media (min-width: 640px) {
    .sm\:flex-initial { flex: 0 1 auto; }
}

#copy-paste-btn span {
    margin-left: 0.25rem;
}

/* Suggestion-specific button hover effects */
#skip-btn {
    background-color: #d1d5db !important;
    color: #374151 !important;
}

#skip-btn:hover {
    background-color: #9ca3af !important;
}

.dark #skip-btn {
    background-color: #4b5563 !important;
    color: #e5e7eb !important;
}

.dark #skip-btn:hover {
    background-color: #6b7280 !important;
}

#submit-btn {
    background-color: #3b82f6 !important;
}

#submit-btn:hover {
    background-color: #2563eb !important;
}

/* Button disabled state */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hidden class utility */
.hidden {
    display: none !important;
}

/* ============================================
   Feedback Overlay Animation (UX Enhancement)
   ============================================ */

/* Overlay Container */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.feedback-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* Icon Container */
.feedback-icon-container {
    background: white;
    border-radius: 50%;
    padding: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    animation: feedback-scale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark .feedback-icon-container {
    background: #1f2937;
}

/* Icon Styles */
.feedback-icon {
    width: 80px;
    height: 80px;
    stroke-width: 3;
}

/* Color Variants */
.feedback-icon.success {
    color: #22c55e;
}

.feedback-icon.skip {
    color: #6b7280;
}

/* Keyframe Animations */
@keyframes feedback-scale {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes feedback-fadeout {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Apply fade-out animation when hiding */
.feedback-overlay.hide {
    animation: feedback-fadeout 0.2s ease-out forwards;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .feedback-overlay,
    .feedback-icon-container {
        animation: none;
        transition: none;
    }
}

/* Theme Toggle Peer and After Pseudo-element Styles */
::before, ::after { --tw-content: ''; }
.peer:focus ~ .peer-focus\:outline-none { outline: 2px solid transparent; outline-offset: 2px; }
.peer:checked ~ .peer-checked\:after\:translate-x-full::after { --tw-translate-x: 100%; transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); }
.peer:checked ~ .peer-checked\:after\:border-white::after { border-color: #fff; }
.peer:checked ~ .peer-checked\:bg-blue-600 { background-color: #2563eb; }
.after\:absolute::after { content: var(--tw-content); position: absolute; }
.after\:left-\[2px\]::after { left: 2px; }
.after\:top-\[2px\]::after { top: 2px; }
.after\:h-5::after { height: 1.25rem; }
.after\:w-5::after { width: 1.25rem; }
.after\:rounded-full::after { border-radius: 9999px; }
.after\:border::after { border-width: 1px; }
.after\:border-gray-300::after { border-color: #d1d5db; }
.after\:bg-white::after { background-color: #fff; }
.after\:transition-all::after { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 200ms; }
