/* Neo-Brutalist Resets & Utilities */
* {
    box-sizing: border-box;
}

body {
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F2F0E9;
    border-left: 2px solid black;
}

::-webkit-scrollbar-thumb {
    background: #D48C7E;
    border: 2px solid black;
}

::-webkit-scrollbar-thumb:hover {
    background: #000000;
}

/* Utility classes */
.border-r-2-black {
    border-right: 2px solid black;
}

.border-b-2-black {
    border-bottom: 2px solid black;
}

.border-t-2-black {
    border-top: 2px solid black;
}

.border-l-2-black {
    border-left: 2px solid black;
}

/* Range Input - Cross Browser */
input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    width: 100%;
}

/* Webkit (Chrome, Safari, Edge) */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    background: #D48C7E;
    border: 2px solid black;
    border-radius: 0;
    margin-top: -8px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: black;
    border-radius: 0;
}

/* Firefox */
input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    background: #D48C7E;
    border: 2px solid black;
    border-radius: 0;
    cursor: pointer;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 4px;
    background: black;
    border-radius: 0;
}

/* Focus states for accessibility */
input[type="range"]:focus {
    outline: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
    outline: 3px solid #D48C7E;
    outline-offset: 2px;
}

input[type="range"]:focus-visible::-moz-range-thumb {
    outline: 3px solid #D48C7E;
    outline-offset: 2px;
}

/* Paper preview sizing: preserve A4 aspect and scale responsively with the viewport */
#capture-area.paper-preview {
    /* Default to portrait A4-ish ratio */
    aspect-ratio: 1 / 1.414;
    width: min(90vw, calc(80vh * 0.707)); /* 0.707 = 1/1.414 */
    max-width: 500px;
    height: auto;
    transition: width 0.24s ease, max-width 0.24s ease;
    flex-shrink: 0;
    overflow: hidden;
}

#capture-area.paper-preview.landscape {
    aspect-ratio: 1.414 / 1;
    width: min(80vw, calc(80vh * 1.414));
    max-width: 800px;
}

#capture-area.paper-preview.portrait {
    aspect-ratio: 1 / 1.414;
    width: min(90vw, calc(80vh * 0.707));
    max-width: 500px;
}

@media (max-width: 640px) {
    #capture-area.paper-preview {
        width: min(95vw, calc(60vh * 0.707));
    }
    #capture-area.paper-preview.landscape {
        width: min(95vw, calc(60vh * 1.414));
    }
}

/* Scale wrapper: apply uniform scaling to everything inside the preview */
#capture-scale-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transform: scale(1);
    transition: transform 0.18s ease;
}

/* Keep only the top-level sign content fully sized.
   Avoid forcing nested `.flex` blocks (icon/text) to 100% height,
   which prevents true centering in the PDF capture. */
#capture-scale-wrap > .flex {
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* --- SVG sizing + label centering (preview + PDF + picker) --- */
#sign-svg-container {
    overflow: hidden;
}

#sign-svg-container svg,
#sign-svg-container img,
#category-list svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
}

#category-list img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* General focus-visible for buttons and interactive elements */
button:focus-visible,
textarea:focus-visible {
    outline: 2px solid #D48C7E;
    outline-offset: 2px;
}

/* Alignment button active state */
.align-btn.bg-terracotta {
    background-color: #D48C7E;
}

/* Red translucent box behind the main sign text */
#sign-text-display {
    position: relative;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 0.25rem;
    box-sizing: border-box;
    z-index: 1;
    overflow: hidden;
}

#sign-text-display::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 0, 0, 0.0); /* red with 50% opacity */
    z-index: -1; /* sit behind the text */
}

/* Specific layout for the fire exit panel sign (no text) to keep it centered */

/* Layout for mandatory panel sign — icons fill top, editable text fills bottom */
.mandatory-panel-layout .flex.flex-col.h-full.items-center {
    justify-content: flex-start !important;
    align-items: center !important;
    padding-top: 2% !important;
}

.mandatory-panel-layout .flex.flex-col.h-full.items-center > div:first-child {
    flex: 0 1 auto !important;
    padding-top: 0 !important;
    align-items: center !important;
}

.mandatory-panel-layout #sign-svg-container {
    max-height: 62% !important;
    width: 100% !important;
    aspect-ratio: unset !important;
}

.mandatory-panel-layout #sign-text-display {
    height: auto !important;
    min-height: 3rem;
    flex: 1 1 auto;
    max-height: 38%;
}

.fire-exit-panel-layout #sign-text-display {
    display: none !important;
}

.fire-exit-panel-layout .flex.flex-col.h-full.items-center {
    justify-content: start !important;
    align-items: end !important;
}
.fire-exit-panel-layout .flex.flex-col.h-full.items-center > div:first-child {
    flex: 0 1 auto !important;
    padding-top: 0 !important;
    align-items: center !important;
}

.fire-exit-panel-layout #sign-svg-container {
    max-height: 95% !important;
    width: 100% !important;
    transform: translateY(-1%) !important;
    transition: transform 0.18s ease;
}
