/*
    MerchStudio version 0.01 - Core CSS File
    Copyright (c) 2025 Michael Lewis White and MerchStudio Inc.
    Common CSS (both admin and client side) for MerchStudio App
    @version common/css/common.css - 0.01 - 05-01-2025 - totaltec
    @version common/css/common.css - 0.02 - 11-10-2026 - merchstudio (MERCH_MOB5: 16px fields on phones)

    # included by client/css_load.tpl, admin/css_load.tpl
*/

/* Main Styles */
html {
    margin: 0;
    padding: 0;
    line-height: 1.5rem;
    /*
     * This is the fundamental style to prevent the entire page from
     * scrolling horizontally when a child element overflows.
     */
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-size: 16px;
    font-family:
        'Manrope',
        'Open Sans',
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        Arial,
        sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s ease-out; /* Smooth appearance */
}

hr {
    margin: 1em 0;
    height: 1px;
    background-color: var(--line);
    border: none;
}

h1, h2, .merch_title {
    font-family:
        'DM Serif Display',
        Georgia,
        'Times New Roman',
        serif;
    font-weight: 400;
    font-style: normal;
}

h1 {
    margin: 0 0 10px;
    padding: 10px;
    font-size: 26px;
    text-align: center;
}

h2 {
    margin: 0;
    padding: 8px 0;
    font-size: 22px;
}

h3 {
    margin: 0;
    padding: 5px 0;
    font-size: 18px;
}

label[for] {
    cursor: pointer;
}

a,
a:link,
a:visited {
    text-decoration: underline;
    color: var(--link);
}

a:hover,
a:focus {
    text-decoration: none;
    color: var(--link_hover);
}

a:active {
  color: var(--link_active);
}

/* Reset for big margins and padding */
figure,
article {
    margin: 0;
    padding: 0;
}

.center {
    margin: 0 auto;
    text-align: center;
}

.pad_20 {
    padding: 20px;
}

.accent_bg {
    background: var(--subtle);
    border: 0;
    color: var(--text);
}

.color_accent {
    color: var(--accent);
}

.color_subtle {
    color: var(--subtle);
}

.highlight {
    color: var(--highlight);
}

.shadow {
    box-shadow: 2px 2px 4px 2px var(--shadow);
}

.inline {
    display: inline-block;
    vertical-align: middle;
}

/**
 * Header: Used in both admin and client
 * Our header background is now fully controlled by
 * --header_bg and --header_bg_gradient_end variables
 */
#merch_header {
    padding: 0 10px;
    font-size: 14px;
    background: linear-gradient(
        to bottom,
        var(--header_bg),
        var(--header_bg_gradient_end)
    );
    transition: background 0.3s ease-out;
}

#merch_header .merch_title {
    vertical-align: middle;
}

/**
 * Main Content container: Wrap around page content excluding header
 */
#merch_main {
    padding: min(30px, 7%);
    flex-grow: 1; /* Allow the main content to grow and push the footer */
}

#merch_main p {
    color: var(--text);
    margin: 10px 0;
}

.container{
  border: 1px solid var(--line);
  border-radius: 1em;
  margin-bottom: 20px;
  padding: min(3em, 15%);

  h2, p { margin-top: 1em }
}

/**
 * Footer: Used in both admin and client
 */
#merch_footer {
    padding: 0 10px;
    font-size: 14px;
    background: linear-gradient(
        to bottom,
        var(--footer_bg),
        var(--footer_bg_gradient_end)
    );
    transition: background 0.3s ease-out
}

/**
 * Form Inputs - Styling the defaults!
 *
 * Form inputs go wide in this App! Max is 400px or 96% of their container
 *
 * Example html for half width input:
<div class="inline_input">
    <input type="text" name="my_input">
</div>
 *
 */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="datetime-local"],
input[type="date"],
input[type="time"] {
    display: block;
    width: 96%;
    max-width: 400px;
    padding: 0.6em 0.8em;
    font-size: 16px;
    margin: 8px 0;
    box-sizing: border-box;
}

input[type="text"].med,
input[type="search"].med,
input[type="number"].med,
input[type="password"].med,
input[type="email"].med {
    max-width: 250px;
}

input[type="text"].small,
input[type="search"].small,
input[type="number"].small,
input[type="password"].small,
input[type="email"].small {
    max-width: 100px;
}

input[readonly],
textarea[readonly] {
    background-color: var(--info_bg);
    color: var(--text);
    cursor: text;
}

.inline_input {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10%;
    width: 96%;
    max-width: 400px;
}

.inline_input input[type="text"] {
    width: 43%;
}

.inline_controls .inline_input {
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
}

.add_slug_ui .action_icon,
.inline_controls .action_icon {
    margin: 5px;
}

.inline_controls .inline_input input[type="text"] {
    width: 60%;
}

.password_wrap {
  position: relative;
  display: block;
}

.password_wrap .password_eyeball {
  position: absolute;
  top: 50%;
  right: 30px;
  width: 30px;
  transform: translateY(-50%);
  color: var(--line);
  cursor: pointer;
}

/* Wrapper for an input that contains an icon */
.input_wrapper.with_icon {
    position: relative;
}

.input_wrapper.with_icon .input_icon_prefix {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--middle_grey);
}

.input_wrapper.with_icon input {
    padding-left: 35px; /* Make space for the icon */
}

textarea {
    display: block;
    width: 96%;
    max-width: 500px;
    margin: 8px auto;
    padding: 5px;
    font-size: 16px;
    box-sizing: border-box;
    min-height: 150px;
}

.required.error {
  border-color: var(--accent_red);
  border-width: 2px;
  background-color: #ffe0e0;
}

/**
 * CHECKBOX: Elevating the standard!
 *
 * Example html to use this cool style:
<input type="checkbox" id="my_checkbox" name="my_checkbox">
<label for="my_checkbox">Your Checkbox Label</label>
 *
 */
input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 24px;
    width: 24px;
}

input[type="checkbox"] + label {
    display: inline-block;
    position: relative;
    margin: 10px;
    vertical-align: middle;
    cursor: pointer;
    line-height: 24px;
    padding-left: 35px;
}

/* Target the custom visual next to the label on focus of the input */
input[type="checkbox"]:focus + label::before {
    outline: 2px solid var(--accent_blue);
    outline-offset: 2px;
}

/* The custom visual for the checkbox */
input[type="checkbox"] + label::before {
    content: "";
    position: absolute;
    top: 0px;
    left: 0px;
    height: 24px;
    width: 24px;
    background-color: transparent;
    border: 2px solid var(--middle_grey);
    transition: all 0.3s ease-out;
}

/* When that box is checked! */
input[type="checkbox"]:checked + label::before {
    background-color: var(--base);
    transform: rotate(0deg) scale(1);
    opacity: 1;
    border: 2px solid var(--base);
}

/* The fancy checkmark */
input[type="checkbox"]:checked + label::after {
    position: absolute;
    content: "";
    left: 10px;
    top: 2px;
    height: 14px;
    width: 8px;
    border: solid var(--text);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(1);
    opacity: 1;
    transition: all 0.3s ease-out;
}

/**
 * Input Switch Styles
 *
 * Example:
<div class="input_switch_wrapper">
    <label class="input_switch" for="theme_toggle">
        <input type="checkbox" id="theme_toggle">
        <div class="slider round"></div>
    </label>
    <label for="theme_toggle">Dark Mode</label>
</div>
 *
 */
.input_switch_wrapper {
    display: flex;
    align-items: center; /* Vertically align the switch and label */
    margin: 10px; /* Consistent with our other input margins */
}

.input_switch_wrapper label {
    margin-left: 10px; /* Space between the switch and the label */
    font-size: 1em; /* Keep the label text readable */
    white-space: nowrap;
}

label.input_switch {
    position: relative;
    display: inline-block;
    margin-left: 0;
    width: 60px; /* Adjust width as needed */
    height: 34px; /* Adjust height as needed */
}

.input_switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--hover);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--bg);
    transition: .4s;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
}

input:checked + .slider {
    background-color: var(--highlight);
}

input:focus + .slider {
    box-shadow: 0 0 5px var(--highlight);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider::after {
    /* Can be used for more complex visual cues if needed */
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/*
 * Icons for theme switch (applied when .theme class is on .input_switch)
 * ⚡️💪✅☰🐞
 * You can find more unicode icons here: https://symbl.cc/
 */
.input_switch.theme .slider:before {
    content: "☀️";
    color: var(--text);
}

.input_switch.theme input:checked + .slider:before {
    content: "🌙";
    background-color: #222;
    color: #fff;
}

/**
 * SELECT BOX - Super stylish MerchStudio select!
 *
<div class="select_wrapper">
    <select name="my_select">
        <option value="option1">Option 1</option>
        <option value="option2">Option 2</option>
    </select>
</div>
 */
select {
    width: 100%;
    padding: 0.6em 0.8em;
    font-size: 16px;
    font-family: 'Manrope', sans-serif;
    font-weight: bold;
    line-height: 1.3;
    box-sizing: border-box;
    margin: 8px 0;
    border: 1px solid var(--line);
    box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
    appearance: none;
    background-repeat: no-repeat, repeat;
    background-position: right 0.7em top 50%, 0 0;
    background-size: 0.65em auto, 100%;
    cursor: pointer;
    transition: background-color 0.3s ease-out,
                color 0.3s ease-out,
                border-color 0.3s ease-out;
}

/* Container for potential arrow magic */
.select_wrapper,
.multi_wrapper {
    position: relative;
    display: block;
    width: 96%;
    max-width: 400px;
}

/* Modifiers for smaller dropdowns */
.select_wrapper.small_select {
    width: auto;
    min-width: 120px;
    max-width: 180px;
}

/* Our bespoke arrow */
.select_wrapper::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.7em;
    width: 0;
    height: 0;
    border-left: 0.4em solid transparent;
    border-right: 0.4em solid transparent;
    border-top: 0.4em solid var(--button_text);
    pointer-events: none;
    transform: translateY(-50%);
}

select:focus { /* When it's in focus */
    border-color: var(--accent_blue);
    outline: none;
    box-shadow: 0 0 0 0.2em rgba(138, 196, 255, 0.25); /* A subtle focus ring */
}

/**
 * BUTTONS & SUBMIT INPUTS - Interactive elements with MerchStudio flair!
 *
 * Default Button Example:
<button type="button" class="merch_button">Click Me</button>
 *
 * Submit Input Example:
<input type="submit" class="merch_button" value="Submit">
 *
 */
button {
    cursor: pointer;
}

input[type="file"]:not([hidden]),
button.merch_button,
input[type="submit"].merch_button,
a.merch_button {
    display: inline-flex;
    align-items: center;
    appearance: none;
    font-family: 'Manrope', sans-serif;
    font-weight: bold;
    font-size: 1em;
    border-radius: 2px;
    cursor: pointer;
    padding: 0.75em 1.5em;
    margin: 10px;
    min-width: 130px;
    height: auto;
    line-height: normal;
    text-decoration: none; /* Remove underline from <a> tags */
    color: var(--button_text);
    background-color: var(--button_bg);
    border: 1px solid var(--button_border);
    box-shadow: none;
    transition-property: background-color, border-color, color;
    transition-duration: 0.3s;
    transition-timing-function: ease-in-out;
}

input[type="file"]:hover,
button.merch_button:hover,
input[type="submit"].merch_button:hover,
a.merch_button:hover {
    background-color: var(--button_hover_bg);
    border-color: var(--button_hover_border);
}

input[type="file"]:active,
button.merch_button:active,
input[type="submit"].merch_button:active,
a.merch_button:active {
    background-color: var(--button_active_bg);
    border-color: var(--button_active_border);
}

input[type="file"]:focus,
button.merch_button:focus,
input[type="submit"].merch_button:focus,
a.merch_button:focus {
    outline: none;
    box-shadow: 0 0 0 0.2em rgba(138, 196, 255, 0.5);
}

.merch_button.small {
    min-width: auto;
    padding: 0.4em 0.8em;
    margin: 0 0 0 5px;
    font-size: 0.9em;
}

input[type="file"]:disabled,
button.merch_button:disabled,
input[type="submit"].merch_button:disabled,
a.merch_button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--button_bg);
    border-color: var(--button_border);
}

#image_drop_zone input[type="file"] {
    display: none;
}

/* Go Button (Green used in Checkout) */
button.merch_button.go,
a.merch_button.go {
    background: var(--accent_green);
    color: var(--base);
}

/**
 * MerchStudio - Common UI Components
 */

/* Merch Button with icon */

/**
 * Common Component: Copy Button
 * A reusable, minimal button for copy-to-clipboard actions.
 */
/* A wrapper to give the parent element relative positioning */
.copy_button_wrapper {
    position: relative;
}
/* Generic styling for a small, icon-only copy button */
.copy_button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.5;
    transition: all 0.2s ease-in-out;
    z-index: 5; /* Ensures it's above the content */
}
.copy_button:hover {
    opacity: 1;
    background-color: var(--hover);
    border-color: var(--line);
}
.copy_button .merch_icon {
    color: var(--text);
    width: 20px;
    height: 20px;
    transition: color 0.2s;
}

/*
 *  Sticky Save Bar feature
 */
/* The .action_panel is the container for form submission buttons. */
.action_panel {
    transition: opacity 0.3s ease-out; /* For fade out */
}

/*
    When the .action_panel also has the .save_bar class,
    it becomes a fixed bar at the bottom of the viewport.
    JavaScript logic adds/removes this class.
*/
.action_panel.save_bar {
    position: fixed;
    bottom: 0;
    z-index: 10;

    background-color: var(--base);
    padding: 10px 20px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.08);

    opacity: 0.90; /* Target opacity from animation */

    animation-name: sticky_save_slide;
    animation-duration: 0.3s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;

    box-sizing: border-box;

    transition: opacity 0.2s ease-in-out;
}

.action_panel.save_bar:hover {
    opacity: 1;
}

.sentinel {
    height: 1px;
    visibility: hidden;
    pointer-events: none;
    margin-bottom: -1px;
}

/**
 * Icons
 */
.merch_icon {
    display: inline-block;
    width: 36px;
    height: 36px;
    vertical-align: middle;
}

.merch_icon.small {
    width: 24px;
    height: 24px;
}

.merch_icon.large {
    width: 48px;
    height: 48px;
}

.merch_icon.huge {
    width: 96px;
    height: 96px;
}

/* Merch Button with icon */
.merch_button span {
    padding: 0 0 0 5px;
}

/**
 * Merch Message (merch_msg)
 */
#merch_msg {
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    padding: 0 0 10px;
    z-index: 1000;
    overflow: hidden;
    pointer-events: none;
}

#merch_msg > div {
    width: 400px;
    padding: 15px 20px;
    text-align: center;
    position: relative;
    pointer-events: auto;
    max-width: 80%;
    color: var(--text);
    background-color: var(--base);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow);
    transform: translateY(-100%);
    transition: transform 0.2s ease-in-out, /* match merch_msg_slide_out */
                background-color 0.3s ease-out,
                color 0.3s ease-out,
                box-shadow 0.3s ease-out;
}

#merch_msg > div.success {
    background-color: #d1e7dd; /* A darker tint of green */
    color: #0f5132; /* A darker shade of green for text */
    border-bottom: 2px solid #0f5132;
}

#merch_msg > div.error {
    background-color: #f8d7da; /* A darker tint of red */
    color: #842029; /* A darker shade of red for text */
    border-bottom: 2px solid #842029;
}

#merch_msg > div.info {
    background-color: #e6f2ff;
    color: #0052cc;
    border-bottom: 2px solid #0052cc;
}

#merch_msg > div.show {
    transform: translateY(0);
}

.merch_msg_content {
    margin-right: 60px;
    text-align: center;
}

.merch_msg_close {
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    min-width: 60px;
    background-color: inherit;
    color: inherit;
    border: none;
    padding: 8px;
    margin: 0;
    border-radius: 0 0 10px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.merch_msg_close:hover {
    opacity: 1;
}

#merch_msg > div.success .merch_msg_close:hover {
    background-color: #0f5132; /* Darker green for hover background */
    color: #fff; /* White text for contrast on hover */
}

#merch_msg > div.error .merch_msg_close:hover {
    background-color: #842029; /* Darker red for hover background */
    color: #fff; /* White text for contrast on hover */
}

#merch_msg > div.info .merch_msg_close:hover {
    background-color: #8ac4ff; /* Accent Blue (as before for info) */
    color: #222; /* Primary Dark text for contrast */
}

.merch_info {
    margin: 20px auto;
    padding: 20px;
    max-width: 420px;
    border-radius: 15px;
    background: var(--info_bg);
    color: var(--text);
    transition: background-color 0.3s ease-out,
                color 0.3s ease-out;
}

/**
 * Generic Dropdown Panel
 *
<div class="drop_panel_cont">
    <div class="drop_trigger">
        <span>Open Panel</span>
    </div>
    <div class="drop_panel">
        <p>This is the content of the dropdown panel.</p>
        <p>It can contain various elements.</p>
    </div>
</div>
 *
 */
.drop_panel_cont {
    position: relative;
    display: inline-block;
}

.drop_trigger {
    cursor: pointer;
    padding: 5px;
    border: 1px solid var(--line);
    background-color: var(--base);
    color: var(--text);
    transition: background-color 0.3s ease-in-out,
                border-color 0.3s ease-in-out,
                color 0.3s ease-in-out;
}

.drop_panel {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 150px;
    padding: 10px;
    border: 1px solid var(--line);
    border-top: none;
    background-color: var(--bg);
    box-shadow: 0px 4px 8px 0px var(--shadow);
    z-index: 110;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-in-out,
                visibility 0.3s ease-in-out,
                transform 0.3s ease-in-out,
                background-color 0.3s ease-in-out,
                border-color 0.3s ease-in-out,
                color 0.3s ease-in-out,
                box-shadow 0.3s ease-in-out;
}
.drop_panel.right {
    left: auto;
    right: 0;
}
.drop_panel.center {
    left: 50%;
    /* We combine the horizontal centering with the existing vertical
       transform used for the open/close animation. */
    transform: translateX(-50%) translateY(-10px);
}
.drop_panel_cont:hover .drop_panel.center,
.drop_panel.center.open {
    /* When opened, we maintain the horizontal centering and
       set the vertical position to 0. */
    transform: translateX(-50%) translateY(0);
}
.drop_panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.drop_panel p {
    color: var(--text);
}
/* Hover to open */
.drop_panel_trigger:hover .drop_panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
/*
 * Styles for buttons inside dropdown panels to ensure consistent alignment
 * of icons and text, and to prevent text wrapping. Button menus.
 */
.drop_panel .merch_button,
.drop_panel .menu_item_control,
.drop_panel button.merch_button:disabled {
    display: flex;
    color: var(--contrast);
    align-items: center;
    justify-content: flex-start; /* Align content to the left */
    width: 100%;
    margin: 0;
    padding: 0.75em;
    box-sizing: border-box;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--line);
    background-color: transparent;
}
.drop_panel .merch_button:last-child,
.drop_panel .menu_item_control:last-child {
    border-bottom: none; /* No border on the very last item */
}
.drop_panel .merch_button:hover,
.drop_panel .menu_item_control:hover {
    background-color: var(--hover);
}
.drop_panel .merch_button span {
    white-space: nowrap; /* This prevents the text from wrapping */
    margin-left: 10px; /* Adds space between the icon and text */
}

/**
 * Pages: Home page, Auth page, Cart page, etc
 */




/**
 * Merch Modal System Styles
 * Styles for the common modal dialog (merch_modal.tpl)
 */
.merch_modal_overlay {
    position: fixed; /* Stay in place even if page scrolls */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent black */
    z-index: 999; /* Below merch_msg (1000) but above most */
    display: flex; /* For centering the modal container */
    align-items: center; /* Vertical centering */
    justify-content: center; /* Horizontal centering */
    opacity: 0; /* Initially hidden */
    visibility: hidden; /* Initially hidden */
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.merch_modal_overlay.open {
    opacity: 1;
    visibility: visible;
}

.merch_modal_container {
    background-color: var(--bg); /* Uses theme background */
    color: var(--text); /* Uses theme text color */
    border-radius: 8px; /* Consistent rounded corners */
    box-shadow: 0 4px 15px 2px var(--shadow); /* Theme shadow */
    width: 95%; /* Responsive width */
    max-width: 600px; /* Max width for larger screens */
    max-height: 90vh; /* Max height to prevent overflow */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Handles internal scrolling */
    transform: scale(0.95); /* Initial state for open animation */
    transition: transform 0.3s ease-out,
                max-width 0.3s ease-out, /* Animate width changes */
                background-color 0.3s ease-out, /* Theme transitions */
                color 0.3s ease-out,
                box-shadow 0.3s ease-out;
}

/* Class for a wider modal */
.merch_modal_container.wide {
    max-width: 1000px;
}

/* Class for an even wider modal */
.merch_modal_container.extra_wide {
    max-width: 1850px;
}

.merch_modal_overlay.open .merch_modal_container {
    transform: scale(1); /* Animate to full size */
}

.merch_modal_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--line); /* Theme line color */
    background-color: var(--base); /* Slightly different bg? */
    transition: border-color 0.3s ease-out,
                background-color 0.3s ease-out;
}

.merch_modal_title_text {
    font-size: 1.25em; /* Larger than default h3 */
    font-family: 'DM Serif Display', Georgia, serif; /* Title font */
    font-weight: 400;
    color: var(--text); /* Ensure it uses theme text */
    margin: 0; /* Remove default h2 margin */
    padding: 0; /* Remove default h2 padding */
    text-align: left; /* Override centered h2 if needed */
}

.merch_modal_close_x {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin: -5px; /* Offset padding for alignment */
    color: var(--text); /* Ensure icon uses theme color */
    opacity: 0.8;
    transition: opacity 0.2s ease-out, color 0.3s ease-out;
}

.merch_modal_close_x:hover {
    opacity: 1;
    color: var(--highlight);
}

.merch_modal_content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.merch_modal_content p:first-child {
    margin-top: 0; /* Consistent spacing */
}

.merch_modal_content p:last-child {
    margin-bottom: 0; /* Consistent spacing */
}

/* Styling for forms within modal content */
.merch_modal_content form .form_field {
    margin-bottom: 15px;
}

.merch_modal_content form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Inputs in modal will use general input styling from common.css
   but we can add modal specific adjustments if needed here */
.merch_modal_content input[type="text"],
.merch_modal_content input[type="password"],
.merch_modal_content input[type="datetime-local"],
.merch_modal_content input[type="date"],
.merch_modal_content input[type="time"],
.merch_modal_content textarea,
.merch_modal_content .select_wrapper > select {
    /* Ensure they don't go wider than modal content area */
    /* General input styles already handle max-width, this is fine */
    margin-left: 0; /* Align with label */
    margin-right: 0;
}

/* Styles for our new simple file input component */
.file_input_simple {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
}

.file_input_simple .file_name_display {
    font-style: italic;
    color: var(--middle_grey);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* We add a max-width to prevent it from pushing other elements */
    max-width: 250px;
}

.merch_modal_footer {
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 10px; /* Space between buttons */
    padding: 15px 20px;
    border-top: 1px solid var(--line); /* Theme line color */
    background-color: var(--base); /* Match header or distinct */
    transition: border-color 0.3s ease-out,
                background-color 0.3s ease-out;
}

/* Ensure merch_button styling applies correctly in footer */
.merch_modal_footer .merch_button {
    margin: 0; /* Override default button margin if needed */
}

/* Styles for content opened in a new window */
body.modal_window_body {
    padding: 20px;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.modal_window_content {
    background-color: var(--base);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--line);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevents this wrapper from scrolling */
}

/* Make the modal content a flex container */
.merch_modal_content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/**
 * Sortable styling
 */
.sortable_item {
    transition: transform 0.2s ease-in-out,
                opacity 0.2s ease-in-out,
                box-shadow 0.2s ease-in-out;
}

.sortable_placeholder {
    background-color: var(--info_bg);
    border: 2px dashed var(--accent);
    opacity: 0.6;
    border-radius: 4px;
    box-sizing: border-box;
    flex-shrink: 0; /* Prevents shrinking during animation */
}

/* We apply the correct animation based on a JS-added class. */
.sortable_placeholder.placeholder_horizontal {
    animation: grow_in_placeholder_horizontal 0.15s ease-out;
}

.sortable_placeholder.placeholder_vertical {
    animation: grow_in_placeholder_vertical 0.15s ease-out;
}

.sortable_item.is_dragging {
    opacity: 0.75;
    box-shadow: 0 5px 15px var(--shadow);
    transform: scale(1.03) rotate(1deg);
    z-index: 100;
}

.drag_handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 24px;
    height: 36px;
    margin-right: 10px;
    cursor: grab;
    background-color: var(--info_bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    transition: color 0.2s ease-out,
                background-color 0.3s ease-out;
}

.drag_handle:hover {
    color: var(--base);
    background-color: var(--highlight);
}

.is_dragging .drag_handle,
.drag_handle:active {
    cursor: grabbing;
}

/**
 * System-wide Notices
 */
.system_warning {
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 1px dashed var(--text);
    background-color: var(--accent_red);
    color: var(--contrast);
    border-radius: 4px;
    font-weight: bold;
}

/**
 * Pagination Controls
 * Styles for our reusable pagination component.
 */
.pagination {
    display: grid; /* We use Grid for a robust column layout. */
    grid-template-columns: auto 1fr auto; /* Prev | flexible space | Next */
    align-items: center;
    gap: 5px;
    width: 100%;
}

.page_numbers {
    display: flex; /* This element remains a flex container for the links. */
    align-items: center;
    gap: 5px;
    overflow-x: auto; /* It handles its own internal scrolling. */
    justify-content: flex-start;
    /* Hide the scrollbar for a clean look */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    /* Enable smooth, momentum-based scrolling on iOS */
    -webkit-overflow-scrolling: touch;
}
.page_numbers::-webkit-scrollbar {
    display: none;
}

.page_nav,
.page_number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid var(--line);
    background-color: var(--base);
    color: var(--text);
    border-radius: 4px;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    font-weight: 600;
    transition: all 0.2s ease-out;
}

.page_nav:hover,
.page_number:hover {
    background-color: var(--hover);
    border-color: var(--highlight);
    color: var(--highlight);
}

.page_number.current {
    background-color: var(--highlight);
    border-color: var(--highlight);
    color: var(--bg);
    pointer-events: none; /* The current page is not clickable */
}

.page_nav.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    background-color: var(--info_bg);
}

.page_ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--middle_grey);
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    font-weight: 600;
}

/* Responsive Considerations */
@media (max-width: 800px) {
    body.no_scroll {
        overflow: hidden;
    }

    .merch_modal_container {
        width: 95%; /* More width on small screens */
        max-height: 95vh;
    }
    .merch_modal_header,
    .merch_modal_content,
    .merch_modal_footer {
        padding: 15px; /* Slightly less padding */
    }
    .merch_modal_title_text {
        font-size: 1.1em;
    }
    .merch_modal_footer {
        flex-direction: column-reverse; /* Stack buttons vertically */
    }
    .merch_modal_footer .merch_button {
        width: 100%; /* Make buttons full width */
        margin-bottom: 10px; /* Space when stacked */
    }
    .merch_modal_footer .merch_button:last-child {
        margin-bottom: 0;
    }
}

/**
 * Effects - kick up the style!
 * CSS effects are designed to work on colored elements and will not show
 * well against lighter colors
 * Example usage:
<button class="shine">Shiny Button</button>
 *
 */
.shine {
  position: relative;
  overflow: hidden;
}

.shine::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: -150%; /* Start further off-screen to accommodate the pause */
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transform: skewX(-25deg);
  animation: shine_pause 4s infinite linear;
  /* Total cycle: 2s pause + 1s animation = 3s */
}

@keyframes shine_pause {
  0% {
    left: -150%; /* Still off-screen at the beginning */
  }
  25% {
    left: -150%; /* Hold the position for the 2-second pause */
  }
  50% {
    left: 100%; /* Animate across during the next 1 second */
  }
  100% {
    left: 150%; /* Keep it off-screen at the end of the cycle */
  }
}

/**
 * Spinning SVG
 * Example usage:
<svg class="merch_icon is_spinning">
    <use href="#spinner_icon"></use>
</svg>
 */
svg.is_spinning {
    animation: merch_spinner_rotate_kf 0.8s linear infinite;
    transform-origin: 50% 50%;
    display: inline-block;
}

@keyframes merch_spinner_rotate_kf {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/*
    Animation keyframes sticky save bar sliding in from the bottom.
*/
@keyframes sticky_save_slide {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0%);
    }
}

/**
 * MerchStudio Sortable Placeholder animation
 */
@keyframes grow_in_placeholder_horizontal {
    from {
        max-width: 0;
        opacity: 0;
    }
    to {
        max-width: 150px; /* Good default for horizontal tabs */
        opacity: 0.6;
    }
}

@keyframes grow_in_placeholder_vertical {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        /* JS sets the height, so we just need a max-height */
        max-height: 100px; /* Good default for vertical items */
        opacity: 0.6;
    }
}

/*
 * Animation for a "dirty" modal when a close is attempted without saving.
 * This provides a clear visual cue to the user that something requires
 * their attention before they can proceed with closing the modal.
*/
@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

.merch_modal_container.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/*
 * Badges for Type and Status
 */
.item_type_badge,
.status_badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid;
}

.status_badge.status_A {
    color: #198754;
    border-color: #198754;
    background-color: #d1e7dd;
}
.status_badge.status_H {
    color: #6c757d;
    border-color: #6c757d;
    background-color: #e9ecef;
}
.status_badge.status_D {
    color: #dc3545;
    border-color: #dc3545;
    background-color: #f8d7da;
}

.item_type_badge {
    color: var(--accent_blue);
    border-color: var(--accent_blue);
    background-color: var(--info_bg);
}

/* --- Animation Keyframes --- */

@keyframes fade_in {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

@keyframes scroll_out_up {
    from { transform: translateY(0); }
    to { transform: translateY(-100%); }
}
@keyframes scroll_in_up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes scroll_out_down {
    from { transform: translateY(0); }
    to { transform: translateY(100%); }
}
@keyframes scroll_in_down {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
/* MERCH_MOB5: phones. Typing fields at 16px so iPhone Safari does not zoom
   the page when one is tapped. Desktop sizes are unchanged. !important
   because themes size some fields by id (the header search box). */
@media (max-width: 767.98px) {
    html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
    html body select,
    html body textarea {
        font-size: 16px !important;
    }
}
