@import './reset.css';

* {
    box-sizing: border-box;
}

html,
body {
    height: 100dvh;
}

body {
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23e0e0e0' fill-opacity='0.35'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    font-family: "Afacad", sans-serif;
    color: #222;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
}

hr {
    border-top: 1px solid #ddd;
    border-bottom: none;
    border-right: none;
    border-left: none;
    width: 100%;
    margin: 10px 0;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header */
header {
    display: flex;
    padding: 10px 15px;
    width: 100%;
    border-bottom: solid 1px #aaa;
    font-weight: 700;
    text-align: left;
    background: #fff;
    position: relative;
}

header div.header_logo {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    margin-right: 25px;
    padding-top: 10px;
    text-align: center;
}

.header_icon_cart {
    cursor: pointer;
    display: block;
    margin-left: 15px;
    text-align: center;
    position: relative;
}

.header_icon_cart span {
    display: none;
    position: absolute;
    left: 75%;
    transform: translate(-50%, 0);
    margin-top: 2px;
    padding: 3px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 0.9;
    color: #fff;
    background-color: #222;
    border-radius: 10px;
}

/* Main Layout */
main {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    overflow: hidden;
}

/* Left Sidebar */
#base_left {
    background-color: #fff;
    display: flex;
    flex-direction: row;
    min-height: 0;
    border-right: 1px solid #ccc;
    color: #222;
}

/* Center Area */
#base_center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    min-width: 0;
}

/* Image Upload Area */
.image_upload {
    margin-bottom: 15px;
}

.image_upload a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    color: #666;
    transition: all 0.2s;
}

.image_upload a:hover {
    border-color: #888;
    background: #f9f9f9;
}

.image_upload svg {
    margin-bottom: 8px;
}

.image_upload div {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Images Container */
.images_container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.images_container .image_item {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s;
}

.images_container .image_item:hover {
    border-color: #888;
}

.images_container .image_item.selected {
    border-color: #222;
    border-width: 3px;
}

.images_container .image_item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Acrylic Preview Area */
#acrylic_container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
}

#acrylic_wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#acrylic_preview {
    display: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#acrylic_preview.active {
    display: block;
}

#acrylic_preview:active {
    cursor: grabbing;
}

/* DPI Warning */
.dpi_warning {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 0.85rem;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.dpi_warning svg {
    flex-shrink: 0;
}

.dpi_warning span {
    flex: 1;
    text-align: center;
}

.dpi_warning.critical {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Image Controls — Segmented Card */
#image_controls {
    width: 100%;
    max-width: 500px;
    margin-top: 12px;
}

.image_controls_card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #d0d0d0;
    overflow: hidden;
}

.image_controls_segments {
    display: flex;
    align-items: stretch;
}

.image_controls_segment {
    flex: 1;
    padding: 8px 12px 10px;
    min-width: 0;
}

.image_controls_divider {
    width: 1px;
    background: #e0e0e0;
    flex-shrink: 0;
}

.image_controls_header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 7px;
}

.image_controls_label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    user-select: none;
}

.image_controls_value {
    font-size: 0.7rem;
    color: #999;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.image_controls_row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.image_controls_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    flex-shrink: 0;
    text-decoration: none;
}

.image_controls_btn:hover {
    background: #e8e8e8;
    border-color: #999;
    color: #222;
}

.image_controls_btn:active {
    background: #ddd;
}

.image_controls_row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    min-width: 0;
    cursor: pointer;
}

.image_controls_row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #222;
    border-radius: 50%;
    cursor: pointer;
}

.image_controls_row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #222;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.image_controls_footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px;
    background: #fafafa;
    border: none;
    border-top: 1px solid #e0e0e0;
    font-size: 0.73rem;
    font-family: inherit;
    color: #777;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.image_controls_footer:hover {
    background: #f0f0f0;
    color: #333;
}

/* Product Summary */
#product_summary {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.9rem;
    margin: 0 auto;
    color: #222;
}

.summary_item,
.summary_price {
    padding: 8px 16px;
    transition: background-color 0.2s;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.summary_item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.summary_item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.summary_price {
    font-weight: 600;
    border-right: none;
}

.summary_icon {
    flex-shrink: 0;
    opacity: 0.8;
}

.summary_separator {
    display: none;
}

.summary_label {
    display: none;
}

.summary_value {
    font-weight: inherit;
}

/* Cart Overlay */
.popup_cart {
    position: fixed;
    box-sizing: border-box;
    min-width: 400px;
    top: 60px;
    right: 0;
    padding: 10px;
    margin-right: 5px;
    overflow-y: auto;
    border-radius: 4px;
    box-shadow: none;
    background-color: rgba(250, 250, 250, 0.95);
    border: solid 1px #ccc;
    color: #111;
    z-index: 100;
}

.popup_cart_control {
    display: flex;
    width: 100%;
    padding: 10px;
}

.popup_cart_control a {
    width: 50%;
}

.cart_svg_button {
    color: #333;
    text-align: center;
}

.cart_svg_button svg {
    margin: 0 auto;
    display: block;
    margin-top: 5px;
}

.cart_svg_button div {
    margin-top: 5px;
}

.popup_cart_content {
    padding: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Cart Items */
.cart_item {
    background: #f7f7f7;
    border-radius: 7px;
    margin-bottom: 10px;
    overflow: hidden;
}

.cart_item:last-child {
    margin-bottom: 0;
}

.cart_item_body {
    padding: 10px 12px;
}

.cart_item_header {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.cart_item_preview {
    width: 56px;
    min-width: 56px;
    height: 56px;
}

.cart_item_preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.cart_item_header_info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart_item_header_row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.cart_item_size {
    font-size: 0.8rem;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart_item_price {
    font-size: 0.82rem;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    padding-left: 8px;
}

.cart_item_selects {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 0 2px;
}

.cart_item_select {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart_item_select label {
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 75px;
    min-width: 75px;
}

.cart_item_select select {
    flex: 1;
    padding: 5px 4px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: inherit;
    background: #fff;
    color: #333;
}

.cart_item_actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.cart_item_quantity {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart_item_quantity button {
    width: 26px;
    height: 26px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cart_item_quantity button:hover {
    background: #eee;
}

.cart_item_quantity span {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    color: #222;
}

.cart_item_delete {
    color: #c44;
    font-size: 0.72rem;
    cursor: pointer;
    text-decoration: none;
}

.cart_item_delete:hover {
    text-decoration: underline;
}

.cart_empty {
    color: #999;
    font-size: 0.85rem;
    text-align: center;
    padding: 20px 0;
}

/* Overlay */
#overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 90;
}

/* Upload Queue */
.popup_upload_queue_no_landscape {
    display: none;
}

/* Utility classes */
.code_init_hidden {
    display: none !important;
}

/* Footer */
footer {
    box-sizing: border-box;
    width: 100%;
    border-top: solid 1px #ddd;
    background: #fff;
}

/* Orientation Media Queries */
@media screen and (orientation:portrait) {
    #base_left {
        display: none;
    }
}

@media screen and (orientation:landscape) {
    footer {
        display: none;
    }
}

/* LANDSCAPE BASE MENU */
#landscape_base_menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' %3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' x2='0' y1='0' y2='1' gradientTransform='rotate(0,0.5,0.5)'%3E%3Cstop offset='0' stop-color='%23000000'/%3E%3Cstop offset='1' stop-color='%23000000'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpattern id='b' width='6' height='6' patternUnits='userSpaceOnUse'%3E%3Ccircle fill='%23FFFFFF' cx='3' cy='3' r='3'/%3E%3C/pattern%3E%3Crect width='100%25' height='100%25' fill='url(%23a)'/%3E%3Crect width='100%25' height='100%25' fill='url(%23b)' fill-opacity='0.07'/%3E%3C/svg%3E");
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

#landscape_base_menu a {
    padding: 10px;
    background-color: #333;
    border-radius: 5px;
    margin: 4px 4px;
}

#landscape_base_menu a+a {
    margin-top: 0px;
}

#landscape_base_menu a {
    color: #ddd;
}

#landscape_base_menu a.selected {
    background-color: #eee;
    color: #222;
}

/* PORTRAIT BASE MENU */
#portrait_base_menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' %3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' x2='0' y1='0' y2='1' gradientTransform='rotate(0,0.5,0.5)'%3E%3Cstop offset='0' stop-color='%23000000'/%3E%3Cstop offset='1' stop-color='%23000000'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpattern id='b' width='6' height='6' patternUnits='userSpaceOnUse'%3E%3Ccircle fill='%23FFFFFF' cx='3' cy='3' r='3'/%3E%3C/pattern%3E%3Crect width='100%25' height='100%25' fill='url(%23a)'/%3E%3Crect width='100%25' height='100%25' fill='url(%23b)' fill-opacity='0.07'/%3E%3C/svg%3E");
    background-attachment: fixed;
    display: flex;
    flex-direction: row;
}

#portrait_base_menu a {
    padding: 10px;
    background-color: #333;
    border-radius: 5px;
    margin: 4px 4px;
}

#portrait_base_menu a+a {
    margin-left: 0px;
}

#portrait_base_menu a {
    color: #ddd;
}

#portrait_base_menu a.selected {
    background-color: #eee;
    color: #222;
}

/* LANDSCAPE CONTROL PANELS */
.landscape_control {
    width: 230px;
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 10px 10px 5px 10px;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
}

.control_title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 15px;
    text-align: center;
}

/* ORIENTATION BUTTONS */
.acrylic_orientation_buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.orientation_button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}

.orientation_button:hover {
    background: #f5f5f5;
    border-color: #999;
}

.orientation_button.selected {
    background: #222;
    border-color: #222;
    color: #fff;
}

/* SIZE PRESETS */
.acrylic_size_presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.size_preset_button {
    padding: 8px 4px;
    font-size: 0.75rem;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.size_preset_button:hover {
    background: #f5f5f5;
    border-color: #999;
}

.size_preset_button.selected {
    background: #222;
    color: #fff;
    border-color: #222;
}

/* CUSTOM SIZE */
.acrylic_custom_size {
    padding: 10px 0;
}

.custom_size_label {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.custom_size_controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.size_button_group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.size_button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 30px;
    background: #333;
    color: #fff;
    border-radius: 3px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.size_button:hover {
    background: #555;
}

.size_display {
    font-size: 1rem;
    font-weight: 600;
    color: #222;
    min-width: 90px;
    text-align: center;
}

/* PORTRAIT CONTROL PANELS */
.portrait_control {
    display: flex;
    flex-direction: row;
    padding: 8px;
    overflow-x: auto;
    gap: 8px;
    min-height: 110px;
    align-items: stretch;
}

.portrait_control .control_title {
    display: none;
}

.portrait_control .acrylic_orientation_buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.portrait_control .acrylic_size_presets {
    display: none;
}

.portrait_control .acrylic_custom_size {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: 8px;
    flex-shrink: 0;
}

.portrait_control .acrylic_custom_size .custom_size_label {
    display: none;
}

.portrait_control .acrylic_custom_size .custom_size_controls {
    flex-direction: row;
    gap: 8px;
}

.portrait_control .acrylic_custom_size .size_button_group {
    flex-direction: column;
}

.portrait_control .acrylic_custom_size .size_display {
    font-size: 0.85rem;
    min-width: auto;
}

.portrait_control .size_preset_button {
    white-space: nowrap;
    flex-shrink: 0;
}

.portrait_control .acrylic_custom_wrapper,
.portrait_control .acrylic_orientation_wrapper {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.portrait_control .portrait_option_label {
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 6px;
    white-space: nowrap;
    text-align: center;
}

.portrait_control .image_upload {
    margin-bottom: 0;
    align-self: stretch;
    display: flex;
}

.portrait_control .image_upload a {
    flex-direction: column;
    padding: 10px 20px;
    gap: 5px;
    flex: 1;
    align-items: center;
    justify-content: center;
}

.portrait_control .image_upload svg {
    margin-bottom: 0;
}

.portrait_control .images_container_portrait {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
}

.portrait_control .images_container_portrait .image_item {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s;
}

.portrait_control .images_container_portrait .image_item:hover {
    border-color: #888;
}

.portrait_control .images_container_portrait .image_item.selected {
    border-color: #222;
    border-width: 3px;
}

.portrait_control .images_container_portrait .image_item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portrait_control.code_target_size_block {
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
}

.portrait_control.code_target_images_block {
    overflow-x: hidden;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .size_detail {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .summary_label {
        display: none;
    }
}
