@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

html, body {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-color: #ffffff;
    color: #1f2937;
    touch-action: pan-y; /* Allows vertical scrolling, disables double-tap zoom */
}

html.dark body {
    /* This sets the safe-area color for dark mode */
    background-color: #23243a;
}

/* App container handles the dynamic height and MUST be transparent */
#app-container {
   height: calc(100vh); /* Fallback */
    height: calc(100dvh); /* The REAL fix */
    background-color: transparent;
}

.main-content-area {
    background-color: transparent; /* ADD THIS LINE */
}

/* --- FIX #1: TRANSPARENCY ON MOBILE --- */
/* The main content area gets its background color ONLY on screens 640px and wider. */
/* On smaller screens, it will be transparent, allowing the body background to show. */
@media (min-width: 640px) {
    .main-content-area {
        background-color: rgba(239, 246, 255, 0.3); /* bg-indigo-50/30 */
    }

    html.dark .main-content-area {
        background-color: #23243a;
    }
}


html.dark #loading-overlay {
    background-color: #0f172a;
}

html.dark .bg-white {
    background-color: #1e293b;
}

html.dark input,
html.dark select {
    background-color: #374151;
    border-color: #4b5563;
    color: #f1f5f9;
}

html.dark input::placeholder {
    color: #9ca3af;
}

html.dark #modal-overlay {
    background-color: rgba(0, 0, 0, 0.75);
}

.theme-toggle {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: #374151;
    color: #f3f4f6;
}

.theme-toggle:hover {
    background-color: #4b5563;
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Animations */
.animate-scaleIn { animation: scaleIn 0.3s ease-out forwards; }
@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-slideIn { animation: slideIn 0.5s ease-out forwards; }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.animate-fadeOut { animation: fadeOut 0.3s ease-out forwards; }
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(10px); }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient 15s ease infinite;
    opacity: 0.99;
}
@keyframes gradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.page-transition { animation: fadeSlide 0.3s ease-out forwards; }
@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f3f4f6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.7s ease-out, visibility 0.7s ease-out;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.grid-loader {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 10px;
    width: 150px;
    height: 150px;
    transform: rotate(45deg);
}

.grid-item {
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #6366f1, #9333ea);
    border-radius: 4px;
    opacity: 0;
    animation: grid-pulse 2s infinite ease-in-out;
}

.grid-item:nth-child(n) { animation-delay: calc(var(--i) * 0.05s); }
@keyframes grid-pulse {
    0%, 100% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1); opacity: 1; }
}

/* Base Nav Button Styles */
.nav-btn {
    background-color: transparent;
    color: rgba(255, 255, 255, 1);
    transition: all 0.2s ease-in-out;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
}
.nav-btn:hover { background-color: rgba(255, 255, 255, 0.1); }
.nav-btn.active {
    background-color: rgb(126, 34, 206) !important;
    color: white !important;
}

/* Dark Mode: General Text & Borders */
html.dark .text-gray-900 { color: #f3f4f6; }
html.dark .border-gray-300 { border-color: #374151; }
html.dark .text-gray-500 { color: #f3f4f6; }
html.dark .text-gray-600,
html.dark .text-gray-700,
html.dark .text-gray-800 {
    color: #d1d5db;
}

/* Dark Mode: General Backgrounds */
html.dark .bg-gray-50,
html.dark .bg-gray-100,
html.dark .prediction-input-section {
    background-color: #374151;
}

html.dark .hover\:bg-gray-50:hover { background-color: #2d3748; }

html.dark .bg-indigo-50,
html.dark .hover\:bg-indigo-50:hover {
    background-color: rgba(99, 102, 241, 0.1);
}

html.dark .bg-red-50,
html.dark .hover\:bg-red-50:hover {
    background-color: rgba(239, 68, 68, 0.1);
}
html.dark .bg-purple-50 {
    background-color: rgba(147, 51, 234, 0.1);
    color: #e5e7eb !important;
}

/* Dark Mode: Status-specific Backgrounds */
html.dark .bg-gradient-to-r.from-emerald-100.to-teal-100 {
    background-image: none !important;
    background-color: #104030 !important;
    color: #6ee7b7 !important;
}
html.dark .bg-red-100 {
    background-color: #4a1f22 !important;
    color: #fca5a5 !important;
}
html.dark .bg-orange-100 {
    background-color: #4a2e13 !important;
    color: #fcd34d !important;
}
/* CUSTOM OVERRIDE: Change locked past matches to grey in dark mode */
html.dark #recent-results-container .bg-orange-100 {
  background-color: #2d3543 !important; /* Neutral dark grey from theme */
}

html.dark .status-tag.active {
    background-color: #1f4037;
    color: #6ee7b7;
}

/* Dark Mode: Buttons & Interactions */
html.dark #settings-btn {
    background-color: #374151;
    color: #818cf8;
    border-color: rgb(67 56 202);
}
html.dark #settings-btn:hover { background-color: #4b5563; }

html.dark .predict-alliance-btn {
    border-color: #374151;
    color: #e5e7eb;
}
html.dark .predict-alliance-btn:hover { background-color: #4b5563; }
html.dark .predict-alliance-btn[data-alliance="blue"].border-blue-600 {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}
html.dark .predict-alliance-btn[data-alliance="red"].border-red-600 {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5;
}
html.dark .predict-alliance-btn[data-alliance="red"]:hover,
html.dark .predict-alliance-btn[data-alliance="red"].border-red-600:hover {
    background-color: rgba(239, 68, 68, 0.2) !important;
}
html.dark .predict-alliance-btn[data-alliance="blue"]:hover,
html.dark .predict-alliance-btn[data-alliance="blue"].border-blue-600:hover {
    background-color: rgba(59, 130, 246, 0.2) !important;
}

/* Dark Mode: Display & Tables */
html.dark .winner-display,
html.dark .user-prediction-display {
    opacity: 1 !important;
    text-shadow: none !important;
}
html.dark .text-emerald-700.winner-display { color: white !important; }
html.dark .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3); }
html.dark tbody.bg-white { background-color: #1e293b; }
html.dark tr:hover { background-color: #2d3748; }
html.dark tr.bg-indigo-50.font-semibold:hover { background-color: rgba(99, 102, 241, 0.1) !important; }

/* Tooltip */
.tooltip-icon { position: relative; display: inline-block; }
.tooltip-icon .tooltip-text {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    visibility: hidden;
}
.tooltip-icon:hover .tooltip-text,
.tooltip-icon:focus-within .tooltip-text,
.tooltip-icon.active .tooltip-text {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    z-index: 50;
}

/* Counter Inputs */
html.dark .counter-minus,
html.dark .counter-plus {
    background-color: #333347 !important;
    color: #e0e7ef !important;
    border-color: #333347 !important;
}
html.dark .counter-minus:hover,
html.dark .counter-plus:hover {
    background-color: #373759 !important;
}

/* --- FIX #2: USABILITY ON MOBILE --- */
/* This block adds the necessary padding to make content visible and scrollable above the Safari UI. */
@media (max-width: 999px) {
    #main-content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        position: relative;
        /* This padding ensures the last item can be scrolled up above the tab bar. */
        padding-bottom: calc(5rem + env(safe-area-inset-bottom)); /* Increased padding */
    }
    #main-content::before {
        content: "";
        display: block;
        height: calc(3rem + env(safe-area-inset-top));
        width: 100%;
    }
    #main-content.admin {
        padding-bottom: calc(7rem + env(safe-area-inset-bottom)) !important;
    }
}

/* Transitions & Shadows */
.bg-white.shadow-lg { transition: none !important; }
.bg-white.shadow-lg:not(.match-tile):hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    transform: none;
}

/* Custom Scrollbar */
.modern-scrollbar::-webkit-scrollbar { width: 8px; background: transparent; }
.modern-scrollbar::-webkit-scrollbar-thumb { background: #e0e7ef; border-radius: 6px; }
.modern-scrollbar { scrollbar-width: thin; scrollbar-color: #e0e7ef transparent; }

/* Sidebar Navigation Button Animation */
.sidebar-nav-btn {
    position: relative;
    z-index: 1;
    transition: color 0.25s ease-out;
}
.sidebar-nav-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, #6366f1 0%, #a21caf 100%);
    opacity: 0;
    z-index: -1;
    transform: scale(0.95);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}
.sidebar-nav-btn.active::before,
.sidebar-nav-btn:hover::before {
    opacity: 1;
    transform: scale(1);
}
.sidebar-nav-btn.active, .sidebar-nav-btn:hover {
    background: transparent;
    color: #fff !important;
}

/* Sidebar Account Section */
.sidebar-account {
    border-top: 1px solid #e5e7eb;
    margin-top: 2rem;
    padding-top: 1.5rem;
    color: #6b7280;
    font-size: 1rem;
    padding-left: 1.0rem;
}
.sidebar-account .account-label {
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}
.sidebar-account .account-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    color: #374151;
    font-size: 1rem;
}
.sidebar-account .account-row svg {
    width: 1.15em;
    height: 1.15em;
    color: #6b7280;
    flex-shrink: 0;
}
.sidebar-account .account-value { font-weight: 500; color: #374151; }

html.dark .sidebar-account { border-top-color: #334155; color: #cbd5e1; }
html.dark .sidebar-account .account-label { color: #cbd5e1; }
html.dark .sidebar-account .account-row { color: #e5e7eb; }
html.dark .sidebar-account .account-row svg { color: #94a3b8; }
html.dark .sidebar-account .account-value { color: #e5e7eb; }

/* Responsive Layout (Sidebar/Topbar Toggle) */
@media (max-width: 1000px) {
    .sidebar { display: none !important; }
    .topbar { display: flex !important; }
    .main-content-area { padding-left: 0 !important; }
    #mobile-sidebar { display: flex !important; }
    #mobile-sidebar-overlay { display: block !important; }
}
@media (min-width: 1001px) {
    .topbar { display: none !important; }
    #mobile-sidebar,
    #mobile-sidebar-overlay { display: none !important; }
}

/* Custom Checkbox */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 2px solid #d1d5db;
    width: 1.25em;
    height: 1.25em;
    border-radius: 0.375em;
    display: inline-block;
    position: relative;
    vertical-align: middle;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}
input[type="checkbox"]:checked {
    background-color: #6366f1;
    border-color: #6366f1;
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 0.32em;
    top: 0.08em;
    width: 0.35em;
    height: 0.7em;
    border: solid #fff;
    border-width: 0 0.18em 0.18em 0;
    border-radius: 0.05em;
    transform: rotate(45deg);
    box-sizing: border-box;
    display: block;
}
input[type="checkbox"]:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

html.dark input[type="checkbox"] { background-color: #374151; border-color: #4b5563; }
html.dark input[type="checkbox"]:checked { background-color: #6366f1; border-color: #6366f1; }
html.dark input[type="checkbox"]:checked::after { border-color: #fff; }

/* Mobile Sidebar */
#mobile-sidebar {
    min-width: 240px;
    width: 288px;
    max-width: 90vw;
    background: #fff;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    will-change: transform;
    overflow-y: auto;
    scrollbar-width: none;
    /* Add padding to the bottom to respect the safe area for content inside */
    box-sizing: border-box; /* Ensure padding is included in the height */
}
.scroll-lock {
    overflow-y: hidden !important;
}
#mobile-sidebar::-webkit-scrollbar { display: none; }
html.dark #mobile-sidebar { background: #1e293b; }

#mobile-sidebar .sidebar-nav-btn {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}
#mobile-sidebar .sidebar-nav-btn:last-child { margin-bottom: 0; }
#mobile-sidebar .sidebar-nav-btn svg { flex-shrink: 0; min-width: 1.25rem; }
#mobile-sidebar .sidebar-nav-btn:focus-visible,
#mobile-sidebar .sidebar-nav-btn:focus {
    outline: 2px solid #6366f1;
}
#mobile-sidebar .sidebar-nav-btn:disabled { opacity: 0.5; pointer-events: none; }
#mobile-sidebar .sidebar-nav-btn.active,
#mobile-sidebar .sidebar-nav-btn:hover { color: #fff !important; }
#mobile-sidebar .sidebar-nav-btn.active::before,
#mobile-sidebar .sidebar-nav-btn:hover::before { opacity: 1; }

/* Mobile Sidebar Overlay */
#mobile-sidebar-overlay {
    background: transparent;
    z-index: 1000;
    /* Add 'visibility' to the transition */
    transition: opacity 0.3s, background-color 0.3s, visibility 0.3s;
    pointer-events: none;
    opacity: 0;
    /* Hide the element fully when not in use to prevent rendering bugs */
    visibility: hidden;
    /* The 'top' property has been removed to allow full-screen coverage */
}
#mobile-sidebar-overlay.opacity-100 {
    opacity: 1;
    background: rgba(0,0,0,0.4); /* Apply background color only when active */
    visibility: visible;
}

#mobile-sidebar-overlay.pointer-events-auto { pointer-events: auto; }

/* Grey-out help button when mobile overlay is open */
@media (max-width: 999px) {
  #dashboard-help-btn.help-btn-greyed span {
    filter: brightness(0.7);
    pointer-events: none !important;
    transition: filter 0.4s, opacity 0.4s;
  }
  #dashboard-help-btn.help-btn-greyed { pointer-events: none !important; }
}

/* Topbar */
.topbar {
    min-height: 3rem !important;
    font-size: 0.97rem !important;
    pointer-events: none;
    padding: 0.25rem 1rem !important;
    /* Adjust height and padding to respect safe area */
    height: calc(3rem + env(safe-area-inset-top)) !important;
    padding-top: env(safe-area-inset-top);
    transition: background-color 0.3s ease; /* <-- ADD THIS LINE */
}
header.topbar > * { pointer-events: auto; }


/* Media Query for small height devices (e.g., mobile landscape) */
@media (max-height: 539px) {
    main#main-content h2.text-3xl { display: none !important; }
    main#main-content { padding: 1.5rem 1.25rem !important; }

    #mobile-sidebar {
        padding: 0.5rem !important;
        min-width: 180px !important;
        width: 200px !important;
        max-width: 60vw !important;
    }
    #mobile-sidebar .sidebar-nav-btn {
        font-size: 0.78rem !important;
        min-height: 1.2rem !important;
        padding: 0.18rem 0.35rem !important;
        gap: 0.4rem !important;
    }
    #mobile-sidebar svg {
        width: 0.9rem !important;
        height: 0.9rem !important;
        min-width: 0.9rem !important;
        margin-right: 0.12rem !important;
    }
    #mobile-sidebar img { width: 1.5rem !important; height: 1.5rem !important; }
    #mobile-sidebar .text-xl, #mobile-sidebar .font-extrabold { font-size: 1.05rem !important; }
    #mobile-sidebar .px-4, #mobile-sidebar .px-5 { padding-left: 0.7rem !important; padding-right: 0.7rem !important; }
    #mobile-sidebar .py-4, #mobile-sidebar .py-5 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
    #mobile-sidebar .pb-2, #mobile-sidebar .pb-6 { padding-bottom: 0.7rem !important; }
    #mobile-sidebar .mt-auto { margin-top: 0.5rem !important; }
    #mobile-sidebar button {
        min-height: 1.6rem !important;
        font-size: 0.68rem !important;
        padding: 0.15rem 0.35rem !important;
        border-radius: 0.32rem !important;
    }
    #mobile-sidebar .sidebar-account,
    #mobile-sidebar .sidebar-account .account-row,
    #mobile-sidebar .sidebar-account .account-value {
        font-size: 0.78rem !important;
    }
    #mobile-sidebar .sidebar-account {
        padding-left: 1.2rem !important;
        padding-right: 1.2rem !important;
        margin-top: 0 !important;
        padding-top: 0.9rem !important;
    }
    #mobile-sidebar .sidebar-account .account-label { font-size: 0.7rem !important; margin-bottom: 0.2rem !important; }
    #mobile-sidebar .sidebar-account .account-row { gap: 0.4rem !important; margin-bottom: 0.1rem !important; }
    #mobile-sidebar .sidebar-account .account-row svg { width: 0.9rem !important; height: 0.9rem !important; }

    #mobile-sidebar #login-and-signup-btns-mobile { padding-bottom: 0rem !important; margin-bottom: -0.7rem !important; }
    #mobile-sidebar #settings-btn-mobile { margin-top: 0rem !important; margin-bottom: 0.2rem !important; }
}

/* Modern Dropdown */
.modern-dropdown-btn {
    background: #F9FaFB !important;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    transition: none !important;
    cursor: pointer;
    min-height: 2.5rem !important;
    height: 2.5rem !important;
    box-sizing: border-box;
    font-size: 1.04rem;
    font-weight: 300;
    padding: 0.55rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: none !important;
}
.modern-dropdown-btn:focus,
.modern-dropdown-btn:active {
    box-shadow: 0 0 0 1.5px #3b82f6 !important;
    border-color: #3b82f6 !important;
    background: #F9FaFB !important;
}

html.dark .modern-dropdown-btn {
    background: #374151 !important;
    color: #f3f4f6;
}

html.dark .modern-dropdown-btn:focus,
html.dark .modern-dropdown-btn:active {
    background: rgba(36,37,50,0.85) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 1.5px #3b82f6 !important;
}

.modern-dropdown-list {
    background: #F9FAFB;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(60,60,67,0.13) !important;
    margin-top: 0.3rem;
    z-index: 50;
    max-height: 600px;
    overflow-y: auto;
    padding: 0.3rem 0;
    min-width: 100%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.18s cubic-bezier(0.4,0,0.2,1), transform 0.18s cubic-bezier(0.4,0,0.2,1);
}
.modern-dropdown-list.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: dropdownFadeIn 0.22s cubic-bezier(0.4,0,0.2,1);
}
.modern-dropdown-list.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    animation: dropdownFadeOut 0.22s cubic-bezier(0.4,0,0.2,1);
}
.modern-dropdown-list::-webkit-scrollbar { width: 8px; background: #f3f4f6; }
.modern-dropdown-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

html.dark .modern-dropdown-list {
    background: #1e293b;
    border: 1px solid #1e293b; /* DO NOT CHANGE THIS UNDER ANY CIRCUMSTANCES */
    box-shadow: 0 8px 32px rgba(0,0,0,0.28) !important;
}
html.dark .modern-dropdown-list::-webkit-scrollbar { background: #1e293b; }
html.dark .modern-dropdown-list::-webkit-scrollbar-thumb { background: #374151; }


@keyframes dropdownFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dropdownFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Modern Dropdown Options */
.modern-dropdown-option {
    font-size: 1.04rem;
    font-weight: 300;
    color: #222;
    border-radius: 0.4rem;
    transition: background 0.13s, color 0.13s;
    padding: 0.55rem 1.15rem;
    cursor: pointer;
    margin: 0 0.3rem;
    display: flex;
    align-items: center;
    letter-spacing: 0.01em;
    background: none;
}
.modern-dropdown-option.selected,
.modern-dropdown-option:hover {
    background: #e5e7eb !important;
    color: #111 !important;
    font-weight: 400 !important;
}
.modern-dropdown-list:hover .modern-dropdown-option.selected:not(:hover) {
    background: none !important;
    color: #222 !important;
}
.modern-dropdown-option .dropdown-tick {
    position: relative;
    top: -2px;
}

html.dark .modern-dropdown-option {
    color: #f3f4f6;
    font-weight: 300;
}
html.dark .modern-dropdown-option.selected,
html.dark .modern-dropdown-option:hover {
    background: #374151 !important;
    color: #fff !important;
    font-weight: 400 !important;
}
html.dark .modern-dropdown-list:hover .modern-dropdown-option.selected:not(:hover) {
    background: none !important;
    color: #f3f4f6 !important;
}

/* Form Inputs Focus Styles */
.form-group input[type="text"],
.form-group input[type="number"] {
    border-width: 1px !important;
    transition: none !important;
}
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
input[type="checkbox"]:focus {
    border-width: 1px !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 1.5px #3b82f6 !important;
    outline: none !important;
    background: #F9FaFB !important;
}
html.dark .form-group input[type="text"]:focus,
html.dark .form-group input[type="number"]:focus {
    background: rgba(36,37,50,0.85) !important;
}

/* Counter Input Number Field Reset */
.counter input[type="number"],
.form-group.counter input[type="number"],
input[type="number"].w-full.text-center.bg-transparent.border-0.p-0 {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    appearance: textfield !important;
    -webkit-appearance: textfield;
}

/* Dark Mode: Help Button */
html.dark #dashboard-help-btn span {
    background: #374151 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
}
html.dark #dashboard-help-btn svg {
    color: #a5b4fc !important;
}
html.dark #dashboard-help-btn:hover span {
    background: #4b5563 !important;
}

/* --- Orientation Lock for Mobile --- */
#orientation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff; /* Matches manifest theme */
  z-index: 9999;
  display: none; /* Hidden by default */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
}

html.dark #orientation-overlay {
  background-color: #23243a; /* Matches body dark bg */
}

.orientation-message {
  color: #1f2937;
}

html.dark .orientation-message {
  color: #f3f4f6;
}

.orientation-message svg {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  color: #6366f1;
}

.orientation-message p {
  font-size: 1.1rem;
  font-weight: 500;
  color: #4b5563;
}

html.dark .orientation-message p {
  color: #d1d5db;
}

/*
  This media query targets devices in landscape mode with a small height.
  This effectively selects mobile phones while excluding tablets,
  as tablets in landscape have a much larger height.
*/
@media screen and (max-height: 500px) and (orientation: landscape) {
  body > #app-container, body > #dashboard-help-btn {
    display: none !important;
  }
  #orientation-overlay {
    display: flex;
  }
}
