/* 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-loggedin-display: none;
}

/* Prevent flicker on initial load by using CSS variables set in head */
#login-view {
    display: var(--initial-login-display) !important;
}
#logged-in-view {
    display: var(--initial-loggedin-display) !important;
}
/* JavaScript will override these with class changes after checking session */
#login-view.hidden,
#logged-in-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(3.5rem + var(--sat)) !important;
        padding-bottom: calc(3.5rem + var(--sab)) !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
    }

    /* Center sign-in container vertically on mobile */
    body > div.flex-1 {
        display: flex !important;
        align-items: center !important;
        justify-content: center !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;
    }

    .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;
    }
    .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;
    }
}

@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 { font-family: inherit; font-size: 100%; font-weight: inherit; line-height: inherit; color: inherit; margin: 0; padding: 0; text-transform: none; background-color: transparent; background-image: none; cursor: pointer; }
.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; }
.mt-6 { margin-top: 1.5rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; } .mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; }
.ml-3 { margin-left: 0.75rem; }
.flex { display: flex; } .hidden { display: none; } .grid { display: grid; }
.h-8 { height: 2rem; } .h-10 { height: 2.5rem; } .h-20 { height: 5rem; }
.w-8 { width: 2rem; } .w-10 { width: 2.5rem; } .w-20 { width: 5rem; } .w-full { width: 100%; }
.max-w-sm { max-width: 24rem; }
.min-h-screen { min-height: 100vh; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-center { justify-content: center; } .justify-between { justify-content: space-between; }
.gap-4 { gap: 1rem; }
.space-x-3 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.75rem; }
.rounded-lg { border-radius: 0.5rem; } .rounded-full { border-radius: 9999px; } .rounded-r-lg { border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }
.border { border-width: 1px; } .border-2 { border-width: 2px; } .border-l-4 { border-left-width: 4px; }
.border-gray-200 { border-color: #e5e7eb; } .dark .dark\:border-gray-700 { border-color: #374151; }
.border-gray-300 { border-color: #d1d5db; } .dark .dark\:border-gray-600 { border-color: #4b5563; }
.border-blue-500 { border-color: #3b82f6; }
.border-purple-300 { border-color: #d8b4fe; } .dark .dark\:border-purple-600 { border-color: #9333ea; }
.border-red-500 { border-color: #ef4444; }
.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-blue-50 { background-color: #eff6ff; } .dark .dark\:bg-blue-900\/20 { background-color: rgb(30 58 138 / 0.2); }
.bg-green-50 { background-color: #f0fdf4; } .dark .dark\:bg-green-900\/20 { background-color: rgb(20 83 45 / 0.2); }
.bg-purple-100 { background-color: #f3e8ff; } .dark .dark\:bg-purple-800\/30 { background-color: rgb(107 33 168 / 0.3); }
.bg-red-100 { background-color: #fee2e2; } .dark .dark\:bg-red-900\/30 { background-color: rgb(127 29 29 / 0.3); }
.p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; } .px-4 { padding-left: 1rem; padding-right: 1rem; } .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; } .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; } .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; } .pb-24 { padding-bottom: 6rem; }
.text-center { text-align: center; }
.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-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.leading-tight { line-height: 1.25; }
.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-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-blue-400 { color: #60a5fa; } .dark .dark\:text-blue-300 { color: #93c5fd; }
.text-green-600 { color: #16a34a; } .dark .dark\:text-green-400 { color: #4ade80; }
.text-purple-600 { color: #9333ea; } .dark .dark\:text-purple-400 { color: #c084fc; }
.text-red-600 { color: #dc2626; } .dark .dark\:text-red-400 { color: #f87171; }
.text-red-800 { color: #991b1b; } .dark .dark\:text-red-200 { color: #fecaca; }
.text-white { color: #fff; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.object-contain { object-fit: contain; }
.hover\:bg-gray-50:hover { background-color: #f9fafb; } .dark .dark\:hover\:bg-gray-600:hover { background-color: #4b5563; } .dark .dark\:hover\:bg-gray-500:hover { background-color: #6b7280; }
.hover\:bg-blue-100:hover { background-color: #dbeafe; } .dark .dark\:hover\:bg-blue-900\/30:hover { background-color: rgb(30 58 138 / 0.3); }
.hover\:bg-blue-700:hover { background-color: #1d4ed8; }
.hover\:bg-purple-200:hover { background-color: #e9d5ff; } .dark .dark\:hover\:bg-purple-700\/40:hover { background-color: rgb(126 34 206 / 0.4); }
.hover\:bg-red-700:hover { background-color: #b91c1c; }
.hover\:text-blue-700:hover { color: #1d4ed8; } .dark .dark\:hover\:text-blue-300:hover { color: #93c5fd; }
.hover\:underline:hover { text-decoration-line: underline; }
.hover\:opacity-80:hover { opacity: 0.8; }
.hover\:shadow-lg:hover { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.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\:ring-blue-500:focus { --tw-ring-color: #3b82f6; }
.focus\:border-transparent:focus { border-color: transparent; }

/* 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; }

/* Grid utilities */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* 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: 768px) {
    .md\:pb-0 { padding-bottom: 0; }
    .md\:max-w-\[340px\] { max-width: 340px; }
    .md\:mt-20 { margin-top: 5rem; }
}

/* GDPR Consent Banner Styles */
.gdpr-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4000;
    background: #ffffff;
    border-top: 2px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    animation: slideUp 0.3s ease-out;
}

.dark .gdpr-consent-banner {
    background: #1f2937;
    border-top-color: #374151;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

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

.gdpr-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

@media (min-width: 768px) {
    .gdpr-consent-content {
        flex-direction: row;
        gap: 1.5rem;
    }
}

.gdpr-consent-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.gdpr-consent-text {
    flex: 1;
    text-align: center;
}

@media (min-width: 768px) {
    .gdpr-consent-text {
        text-align: left;
    }
}

.gdpr-consent-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #111827;
}

.dark .gdpr-consent-title {
    color: #f3f4f6;
}

.gdpr-consent-description {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    color: #4b5563;
}

.dark .gdpr-consent-description {
    color: #d1d5db;
}

.gdpr-consent-link {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.dark .gdpr-consent-link {
    color: #60a5fa;
}

.gdpr-consent-link:hover {
    color: #1d4ed8;
}

.dark .gdpr-consent-link:hover {
    color: #93c5fd;
}

.gdpr-consent-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.gdpr-btn {
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.gdpr-btn-accept {
    background: #2563eb;
    color: #ffffff;
}

.gdpr-btn-accept:hover {
    background: #1d4ed8;
}

.gdpr-btn-reject {
    background: #e5e7eb;
    color: #374151;
}

.dark .gdpr-btn-reject {
    background: #374151;
    color: #d1d5db;
}

.gdpr-btn-reject:hover {
    background: #d1d5db;
}

.dark .gdpr-btn-reject:hover {
    background: #4b5563;
}

/* Mobile adjustments for GDPR banner */
@media (max-width: 768px) {
    .gdpr-consent-banner {
        padding: 1rem 0.75rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .gdpr-consent-actions {
        width: 100%;
    }

    .gdpr-btn {
        flex: 1;
        padding: 0.75rem 1rem;
    }

    .gdpr-consent-title {
        font-size: 1rem;
    }

    .gdpr-consent-description {
        font-size: 0.8125rem;
    }
}

/* Display Name Edit Buttons - Ensure visibility in both light and dark modes */
#save-display-name-button {
    background-color: #2563eb !important; /* blue-600 */
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
}

#save-display-name-button:hover {
    background-color: #1d4ed8 !important; /* blue-700 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.dark #save-display-name-button {
    background-color: #3b82f6 !important; /* blue-500 - brighter in dark mode */
}

.dark #save-display-name-button:hover {
    background-color: #2563eb !important; /* blue-600 */
}

#cancel-display-name-button {
    background-color: #e5e7eb !important; /* gray-200 */
    color: #374151 !important; /* gray-700 */
    border: none !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
}

#cancel-display-name-button:hover {
    background-color: #d1d5db !important; /* gray-300 */
}

.dark #cancel-display-name-button {
    background-color: #4b5563 !important; /* gray-600 */
    color: #e5e7eb !important; /* gray-200 */
}

.dark #cancel-display-name-button:hover {
    background-color: #6b7280 !important; /* gray-500 */
}

/* Mobile-friendly display name edit layout */
@media (max-width: 768px) {
    #display-name-edit > div {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    #edit-display-name-input {
        width: 100% !important;
    }

    #display-name-edit > div > button {
        width: 100% !important;
        padding: 0.625rem 1rem !important;
        justify-content: center;
    }
}

/* 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; }
