/* JC Black palette from the Recetario reference, isolated to WeroTV. */
:root {
    color-scheme: dark;
    --w-body: #161616;
    --w-card: #262626;
    --w-input: #393939;
    --w-soft: #303030;
    --w-sidebar: #1c1c1c;
    --w-border: #6f6f6f;
    --w-divider: #393939;
    --w-text: #ffffff;
    --w-muted: #c6c6c6;
    --w-accent: #a6c8ff;
    --w-tint: rgba(166, 200, 255, .13);
    --w-ring: rgba(166, 200, 255, .55);
}

/* Shared confirmation and feedback surfaces. */
#confirm-modal {
    z-index: 180;
}

#confirm-modal .modal-content {
    max-width: 480px;
    background: var(--w-card);
    border-color: var(--w-border);
}

.confirmation-word {
    margin: 0 0 24px;
    text-align: left;
}

.confirmation-word label {
    display: block;
    color: var(--w-muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.confirmation-word strong {
    color: var(--w-text);
}

.confirmation-word input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--w-input);
    color: var(--w-text);
    border: 1px solid var(--w-border);
}

.confirmation-word input:focus {
    outline: 2px solid var(--w-accent);
    outline-offset: 2px;
}

#confirm-action-btn {
    background: #b52936;
}

#confirm-action-btn:hover:not(:disabled) {
    background: #d13241;
}

#confirm-modal button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

#notification.app-notification {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 250;
    width: max-content;
    max-width: min(600px, calc(100vw - 32px));
    padding: 18px 24px;
    border: 1px solid var(--w-border);
    border-left-width: 5px;
    border-radius: 14px;
    background: var(--w-card);
    color: var(--w-text);
    box-shadow: 0 12px 40px #0008;
    font-size: 15px;
    line-height: 1.5;
}

#notification.app-notification.is-error {
    border-left-color: #ff7b86;
}

#notification.app-notification.is-success {
    border-left-color: #34d399;
}

#notification[hidden] {
    display: none;
}

.catalog-content table {
    table-layout: fixed;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.catalog-content th,
.catalog-content td {
    text-align: center;
    overflow-wrap: anywhere;
}

.catalog-content tbody td {
    border-bottom: 1px solid var(--w-divider);
}

.catalog-content th:first-child,
.catalog-content th:last-child {
    width: 25%;
}

.catalog-content thead {
    background: var(--w-soft) !important;
}

html[data-theme="classic"] {
    --w-body: #111827;
    --w-card: #1f2937;
    --w-input: #374151;
    --w-soft: #374151;
    --w-sidebar: #111827;
    --w-border: #4b5563;
    --w-divider: #1f2937;
    --w-text: #f9fafb;
    --w-muted: #9ca3af;
    --w-accent: #60a5fa;
    --w-tint: rgba(59, 130, 246, .15);
    --w-ring: rgba(59, 130, 246, .45);
}

html[data-theme="black"] body {
    background: var(--w-body);
    color: #e0e0e0;
}

html[data-theme="black"] .bg-gray-900 {
    background-color: var(--w-body);
}

html[data-theme="black"] .bg-gray-800 {
    background-color: var(--w-card);
}

html[data-theme="black"] .bg-gray-700 {
    background-color: var(--w-input);
}

html[data-theme="black"] .bg-gray-600 {
    background-color: #525252;
}

html[data-theme="black"] [class~="bg-gray-800/50"] {
    background-color: rgba(38, 38, 38, .5);
}

html[data-theme="black"] [class~="bg-gray-700/50"] {
    background-color: rgba(57, 57, 57, .5);
}

html[data-theme="black"] [class~="hover:bg-gray-700/30"]:hover {
    background-color: rgba(57, 57, 57, .3);
}

html[data-theme="black"] [class~="hover:bg-gray-700/70"]:hover {
    background-color: rgba(57, 57, 57, .7);
}

html[data-theme="black"] #open-sale-modal {
    background: var(--w-accent);
    color: #161616;
    box-shadow: none;
}

html[data-theme="black"] #open-sale-modal:hover {
    background: #c6dcff;
}

html[data-theme="black"] :is(.border-gray-800, .border-gray-700, .divide-gray-700 > :not([hidden]) ~ :not([hidden])) {
    border-color: #525252;
}

html[data-theme="black"] .border-gray-600 {
    border-color: var(--w-border);
}

html[data-theme="black"] :is(.text-gray-300, .text-gray-200) {
    color: #e0e0e0;
}

html[data-theme="black"] :is(.text-gray-400, .text-gray-500) {
    color: var(--w-muted);
}

html[data-theme="black"] :is(.text-blue-400, .text-blue-500, .text-cyan-400) {
    color: var(--w-accent);
}

html[data-theme="black"] :is(.hover\:bg-gray-800, .hover\:bg-gray-700, .hover\:bg-gray-600):hover {
    background-color: #393939;
}

html[data-theme="black"] .table-header {
    background-color: var(--w-input);
}

html[data-theme="black"] .table-row:nth-child(even) {
    background-color: var(--w-card);
}

html[data-theme="black"] .table-row:hover {
    background-color: var(--w-soft);
}

html[data-theme="black"] .startup-status {
    background: var(--w-card);
    border-color: var(--w-border);
    color: var(--w-text);
}

html[data-theme="black"] #loading-overlay {
    background: rgba(22, 22, 22, .9);
}

html[data-theme="black"] .spinner {
    border-left-color: var(--w-accent);
}

#main-sidebar {
    width: 256px;
    flex: 0 0 256px;
    min-width: 0;
    height: 100dvh;
    background: var(--w-sidebar);
    border-color: var(--w-divider);
    gap: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--w-border) transparent;
    transition: width .2s ease, flex-basis .2s ease, transform .2s ease;
}

#app-container>main {
    min-width: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 24px;
}

.sidebar-brand>svg {
    flex-shrink: 0;
    color: var(--w-accent);
}

.sidebar-brand-name {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.5px;
    color: var(--w-text);
}

.sidebar-brand-caption {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    color: var(--w-muted);
    margin-top: 2px;
}

#main-sidebar .nav-link {
    min-height: 46px;
    gap: 12px;
    border: 1px solid transparent;
    color: var(--w-muted);
}

#main-sidebar .nav-link.active {
    color: var(--w-accent);
    background: var(--w-tint);
    border-color: var(--w-ring);
}

#main-sidebar .nav-link:not(.active):hover {
    background: var(--w-soft);
    color: var(--w-text);
}

#main-sidebar :is(.nav-link, .sidebar-action)> :is(i, svg) {
    margin: 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-label {
    white-space: nowrap;
}

.sidebar-section-label {
    color: var(--w-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    padding: 0 12px;
    margin: 0 0 12px;
}

.sidebar-footer {
    margin-top: auto;
    flex-shrink: 0;
}

#main-sidebar .sidebar-action {
    min-height: 42px;
    gap: 10px;
}

.sidebar-settings {
    border-top: 1px solid var(--w-divider);
    margin-top: 18px;
    padding-top: 12px;
}

.sidebar-utility {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    gap: 12px;
    border-radius: 10px;
    color: var(--w-muted);
    font-size: 14px;
    text-align: left;
}

.sidebar-utility:hover {
    background: var(--w-soft);
    color: var(--w-text);
}

.sidebar-utility svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.sidebar-utility:focus-visible,
#main-sidebar a:focus-visible,
#main-sidebar button:focus-visible {
    outline: 2px solid var(--w-accent);
    outline-offset: 2px;
}

#sidebar-toggle-btn svg {
    transition: transform .2s;
}

#sidebar-close-btn {
    display: none;
}

.theme-panel {
    position: fixed;
    z-index: 90;
    width: 280px;
    max-width: calc(100vw - 32px);
    padding: 18px;
    border: 1px solid var(--w-border);
    border-radius: 16px;
    background: var(--w-card);
    color: var(--w-text);
    box-shadow: 0 16px 48px #0008;
}

.theme-panel[hidden],
.sidebar-tooltip[hidden] {
    display: none;
}

.theme-panel h2 {
    font-size: 15px;
    font-weight: 600;
}

.theme-panel p {
    color: var(--w-muted);
    font-size: 12px;
    margin: 4px 0 16px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: 1px solid var(--w-divider);
    border-radius: 10px;
    text-align: left;
}

.theme-option:hover {
    background: var(--w-soft);
}

.theme-option[aria-pressed="true"] {
    border-color: var(--w-accent);
    background: var(--w-tint);
}

.theme-option:focus-visible {
    outline: 2px solid var(--w-accent);
    outline-offset: 2px;
}

.theme-option strong {
    display: block;
    font-size: 13px;
}

.theme-option small {
    display: block;
    margin-top: 2px;
    color: var(--w-muted);
    font-size: 11px;
}

.theme-option .theme-check {
    margin-left: auto;
    color: var(--w-accent);
    visibility: hidden;
}

.theme-option[aria-pressed="true"] .theme-check {
    visibility: visible;
}

.theme-swatch {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid #777;
    background: linear-gradient(135deg, #161616 50%, #a6c8ff 50%);
}

.theme-swatch-classic {
    background: linear-gradient(135deg, #111827 50%, #3b82f6 50%);
}

.sidebar-tooltip {
    position: fixed;
    z-index: 95;
    padding: 7px 11px;
    border: 1px solid var(--w-border);
    border-radius: 8px;
    background: var(--w-card);
    color: var(--w-text);
    box-shadow: 0 6px 20px #0005;
    font-size: 12px;
    pointer-events: none;
}

@media (min-width:768px) {
    html.sidebar-collapsed #main-sidebar {
        width: 76px;
        flex-basis: 76px;
        padding: 16px 10px;
    }

    html.sidebar-collapsed #main-sidebar :is(.sidebar-label, .sidebar-section-label, .sidebar-brand-copy) {
        display: none;
    }

    html.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding: 10px 0 24px;
    }

    html.sidebar-collapsed #main-sidebar :is(.nav-link, .sidebar-action, .sidebar-utility) {
        justify-content: center;
        padding: 11px 0;
    }

    html.sidebar-collapsed #sidebar-toggle-btn svg {
        transform: rotate(180deg);
    }
}

@media (max-width:767px) {
    #main-sidebar {
        width: min(280px, 88vw);
    }

    #sidebar-toggle-btn {
        display: none;
    }

    #sidebar-close-btn {
        display: flex;
        width: 32px;
        height: 32px;
        padding: 6px;
        margin-left: auto;
    }

    html.sidebar-mobile-open {
        overflow: hidden;
    }
}

@media (prefers-reduced-motion:reduce) {

    #main-sidebar,
    #sidebar-toggle-btn svg {
        transition: none;
    }
}