/**
 * Lighter Land WooCommerce Custom Stylesheet
 * RTL layout helpers, WooCommerce form overrides, and dark mode support
 */

/* Form Input & Select Enhancements */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background-color: #f5f5f4;
    border: 1px solid #e7e5e4;
    outline: none;
    transition: all 0.2s ease;
}

.dark .woocommerce form .form-row input.input-text,
.dark .woocommerce form .form-row textarea,
.dark .woocommerce form .form-row select {
    background-color: #18181b;
    border-color: #27272a;
    color: #f4f4f5;
}

.woocommerce form .form-row input.input-text:focus,
.dark .woocommerce form .form-row input.input-text:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px #f59e0b;
}

/* WooCommerce Quantity Input */
.quantity-wrapper input[type="number"] {
    -moz-appearance: textfield;
}
.quantity-wrapper input[type="number"]::-webkit-outer-spin-button,
.quantity-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* WooCommerce Review Table Overrides */
.woocommerce-checkout-review-order-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid #e7e5e4;
}

.dark .woocommerce-checkout-review-order-table th,
.dark .woocommerce-checkout-review-order-table td {
    border-color: #27272a;
}

/* Payment Methods List */
#payment ul.payment_methods {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

#payment ul.payment_methods li {
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background-color: #f5f5f4;
    border: 1px solid #e7e5e4;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
}

.dark #payment ul.payment_methods li {
    background-color: #18181b;
    border-color: #27272a;
}

/* Primary Checkout Place Order Button */
#payment #place_order {
    width: 100%;
    padding: 1rem;
    border-radius: 0.75rem;
    background-color: #f59e0b;
    color: #000;
    font-weight: 900;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.2);
    transition: all 0.2s ease;
}

#payment #place_order:hover {
    filter: brightness(1.1);
}

/* Dark inputs everywhere (register page has no .woocommerce wrapper). */
input.input-text,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
    background-color: #18181b !important;
    color: #F4F4F5;
    border: 1px solid #3f3f46;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #F4F4F5 !important;
    -webkit-box-shadow: 0 0 0 1000px #18181b inset !important;
    box-shadow: 0 0 0 1000px #18181b inset !important;
    caret-color: #F4F4F5;
    transition: background-color 9999s ease-in-out 0s;
}

/* --------------------------------------------------------------------------
 * WooCommerce notices (checkout login / coupon toggles, messages, errors)
 * WooCommerce core styles these with a white background, which shows up as
 * full-width white bands in the theme's dark mode. Normalize them here.
 * -------------------------------------------------------------------------- */
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-message,
.woocommerce .woocommerce-error {
    position: relative;
    margin: 0 0 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid #e7e5e4;
    border-right: 3px solid #f59e0b;
    border-radius: 0.75rem;
    background-color: #f5f5f4;
    color: #44403c;
    font-size: 0.8125rem;
    line-height: 1.7;
    list-style: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* The default WooCommerce icon font isn't loaded, so hide the broken glyph box. */
.woocommerce .woocommerce-info::before,
.woocommerce .woocommerce-message::before,
.woocommerce .woocommerce-error::before {
    display: none;
}

.dark .woocommerce .woocommerce-info,
.dark .woocommerce .woocommerce-message,
.dark .woocommerce .woocommerce-error {
    background-color: #18181b;
    border-color: #3f3f46;
    border-right-color: #f59e0b;
    color: #d4d4d8;
    box-shadow: none;
}

.woocommerce .woocommerce-info a,
.woocommerce .woocommerce-message a,
.woocommerce .woocommerce-error a {
    color: #b45309;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dark .woocommerce .woocommerce-info a,
.dark .woocommerce .woocommerce-message a,
.dark .woocommerce .woocommerce-error a {
    color: #fbbf24;
}

/* Login / coupon panels revealed by the toggles above. */
.woocommerce form.woocommerce-form-login,
.woocommerce form.woocommerce-form-coupon {
    margin: 0 0 1.25rem;
    padding: 1.25rem;
    border: 1px solid #e7e5e4;
    border-radius: 0.75rem;
    background-color: #f5f5f4;
}

.dark .woocommerce form.woocommerce-form-login,
.dark .woocommerce form.woocommerce-form-coupon {
    background-color: #18181b;
    border-color: #3f3f46;
}

/* --------------------------------------------------------------------------
 * Material Symbols Outlined (mockup design system)
 * -------------------------------------------------------------------------- */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* Filled heart for liked items — Material Symbols needs FILL=1 to draw solid. */
.material-symbols-outlined.wished {
    font-variation-settings: 'FILL' 1;
    color: #ef4444 !important;
}

/* theme-custom.css loads after Tailwind, so .material-symbols-outlined's
   display:inline-block would otherwise override Tailwind's .hidden. */
.material-symbols-outlined.hidden {
    display: none;
}

/* --------------------------------------------------------------------------
 * Checkout (WooCommerce core CSS is deliberately NOT loaded on this page)
 * -------------------------------------------------------------------------- */

/* The generic dark-input rule above uses !important for the register page.
   The checkout uses the mockup's exact input skin, so win that specificity. */
.ll-checkout-form input[type="text"],
.ll-checkout-form input[type="tel"],
.ll-checkout-form input[type="email"],
.ll-checkout-form textarea,
.ll-checkout-form select {
    background-color: var(--ll-surface) !important;
    color: var(--ll-on-surface) !important;
    border: 1px solid var(--ll-outline) !important;
    border-radius: 0.5rem !important;
    padding: 0.625rem 0.875rem !important;
    font-size: 12px !important;
    line-height: 18px !important;
}
.ll-checkout-form input:focus,
.ll-checkout-form textarea:focus,
.ll-checkout-form select:focus {
    border-color: #d97706 !important;
    outline: none !important;
}
/* WooCommerce prepends notices directly into the checkout form. The form is a
   12-column grid, so without this they collapse into one narrow column. */
form.checkout.ll-checkout-form > .woocommerce-error,
form.checkout.ll-checkout-form > .woocommerce-message,
form.checkout.ll-checkout-form > .woocommerce-info,
form.checkout.ll-checkout-form > .woocommerce-NoticeGroup {
    grid-column: 1 / -1;
    width: 100%;
}

.ll-checkout-form .form-row {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    clear: none;
}

.ll-checkout-form .form-row.form-row-wide,
.ll-checkout-form .form-row#order_comments_field,
.ll-checkout-form .form-row#billing_country_field,
.ll-checkout-form .form-row#billing_address_1_field,
.ll-checkout-form .form-row#billing_address_2_field {
    grid-column: 1 / -1;
}

.ll-checkout-form .form-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    color: #1c1917;
}

.dark .ll-checkout-form .form-row label {
    color: #f4f4f5;
}

.ll-checkout-form .form-row .required {
    color: #ef4444;
    text-decoration: none;
}

.ll-checkout-form .woocommerce-input-wrapper {
    display: block;
    width: 100%;
}

.ll-checkout-form textarea.input-text {
    min-height: 72px;
    resize: vertical;
}

/* The alternate address is collapsed until the visitor opts in. */
.ll-checkout-form .shipping_address {
    display: none;
}

/* Persian WooCommerce turns province/city into select2 boxes. Without the
   WooCommerce stylesheet they fall back to a white skin; match the mockup. */
.select2-container--default .select2-selection--single {
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 0.75rem;
    height: auto;
    min-height: 42px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f4f4f5;
    line-height: 40px;
    font-size: 0.875rem;
    padding-left: 14px;
    padding-right: 32px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    left: 6px;
    right: auto;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #a1a1aa;
}
.select2-dropdown {
    background-color: #18181b;
    border-color: #27272a;
    color: #f4f4f5;
}
.select2-container--default .select2-results__option {
    padding: 8px 14px;
    font-size: 0.875rem;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3f3f46;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #121214;
    border: 1px solid #27272a;
    color: #f4f4f5;
    border-radius: 0.5rem;
    padding: 6px 10px;
}

/* Shipping + gateway cards — selection is real: the radios are in sections 3
   & 4. One class drives the amber border, so only one card per group can look
   selected at a time. */
.ll-checkout-form .ll-shipping-card.ll-card-selected,
.ll-checkout-form .ll-gateway-card.ll-card-selected {
    border-color: #d97706;
    background-color: rgba(217, 119, 6, 0.06);
}

.ll-checkout-form .ll-gateway-radio:focus-visible + span {
    outline: 2px solid #d97706;
    outline-offset: 2px;
}

/* Compact terms checkbox inside the CTA block */
.ll-checkout-form .woocommerce-terms-and-conditions-wrapper {
    font-size: 11px;
    line-height: 1.6;
    color: #a1a1aa;
}

.ll-checkout-form .woocommerce-terms-and-conditions-wrapper label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ll-checkout-form .woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
    accent-color: #d97706;
    margin-top: 2px;
}

/* ===== My Account — account info & address endpoint forms ===== */
.ll-account-panel {
    font-size: 13px;
    color: var(--ll-on-surface);
}

/* Saved addresses list */
.ll-account-panel .woocommerce-Addresses {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
/* WooCommerce floats these columns (48% + clearfix pseudo elements). In a grid
   the pseudo elements become cells and the cards land diagonally — kill them. */
.ll-account-panel .woocommerce-Addresses::before,
.ll-account-panel .woocommerce-Addresses::after {
    display: none;
}
.ll-account-panel .woocommerce-Address {
    float: none !important;
    width: auto !important;
    min-width: 0;
    background: var(--ll-surface);
    border: 1px solid var(--ll-outline);
    border-radius: 12px;
    padding: 18px;
}
.ll-account-panel .woocommerce-Address-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ll-outline);
}
.ll-account-panel .woocommerce-Address-title h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ll-on-surface);
}
.ll-account-panel .woocommerce-Address-title a.edit {
    font-size: 12px;
    font-weight: 600;
    color: #d97706;
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: 8px;
    padding: 5px 10px;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ll-account-panel .woocommerce-Address-title a.edit:hover {
    background: rgba(217, 119, 6, 0.18);
    border-color: #d97706;
}
.ll-account-panel .woocommerce-Address address {
    font-style: normal;
    font-size: 13px;
    line-height: 1.9;
    color: var(--ll-on-surface-variant);
}

/* The panel already prints a heading — hide WooCommerce's duplicate. */
.ll-account-panel form > h2 {
    display: none;
}

/* Form layout: two columns, full-width rows span both. */
.ll-account-panel form.woocommerce-EditAccountForm,
.ll-account-panel .woocommerce-address-fields__field-wrapper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}
.ll-account-panel .form-row {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ll-account-panel .form-row-wide,
.ll-account-panel .form-row.form-row-wide,
.ll-account-panel .woocommerce-address-fields__field-wrapper .form-row-wide,
.ll-account-panel form > p:not([class*="form-row"]),
.ll-account-panel fieldset {
    grid-column: 1 / -1;
}
.ll-account-panel .clear {
    display: none;
}
.ll-account-panel fieldset {
    margin: 0;
    padding: 18px;
    border: 1px solid var(--ll-outline);
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    min-width: 0;
}
.ll-account-panel legend {
    padding: 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ll-on-surface);
}

/* Labels, fields and help text */
.ll-account-panel label {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ll-on-surface);
}
.ll-account-panel .required {
    color: #ef4444;
}
.ll-account-panel input.input-text,
.ll-account-panel input[type="password"],
.ll-account-panel input[type="email"],
.ll-account-panel select,
.ll-account-panel textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--ll-on-surface);
    background: var(--ll-surface);
    border: 1px solid var(--ll-outline);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s ease;
}
.ll-account-panel input.input-text:focus,
.ll-account-panel input[type="password"]:focus,
.ll-account-panel input[type="email"]:focus,
.ll-account-panel select:focus,
.ll-account-panel textarea:focus {
    border-color: #d97706;
}
.ll-account-panel input::placeholder {
    color: var(--ll-on-surface-variant);
}
.ll-account-panel #account_display_name_description,
.ll-account-panel .woocommerce-input-wrapper,
.ll-account-panel .form-row > em {
    font-size: 11px;
    color: var(--ll-on-surface-variant);
}

/* Submit buttons */
.ll-account-panel button[type="submit"],
.ll-account-panel .woocommerce-Button.button {
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    background: #d97706;
    color: #18181b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease;
}
.ll-account-panel button[type="submit"]:hover,
.ll-account-panel .woocommerce-Button.button:hover {
    filter: brightness(1.1);
}

@media (max-width: 640px) {
    .ll-account-panel .woocommerce-Addresses,
    .ll-account-panel form.woocommerce-EditAccountForm,
    .ll-account-panel .woocommerce-address-fields__field-wrapper,
    .ll-account-panel fieldset {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #a8a29e;
    border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
    background: #3f3f46;
}

/* ==========================================================================
   PJAX navigation feedback
   ========================================================================== */

/* The WordPress admin bar uses z-index 99999. Keep the loading line above it
   (its `top` offset is set in theme.js from the admin bar's height). */
#lighterland-pjax-bar {
    z-index: 100001 !important;
    height: 3px;
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.8);
}

#ll-pjax-skeleton {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(18, 18, 20, 0.88);
    background: color-mix(in srgb, var(--ll-surface) 88%, transparent);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

#ll-pjax-skeleton.is-visible {
    display: flex;
}

.ll-skeleton-panel {
    width: min(1120px, calc(100% - 2rem));
    padding: 1.5rem 0;
}

.ll-skeleton-line,
.ll-skeleton-img,
.ll-skeleton-card {
    background: linear-gradient(
        90deg,
        var(--ll-surface-container) 25%,
        var(--ll-surface-high) 50%,
        var(--ll-surface-container) 75%
    );
    background-size: 200% 100%;
    animation: ll-skeleton-shimmer 1.15s linear infinite;
    border-radius: 0.5rem;
}

.ll-skeleton-head {
    height: 28px;
    width: 32%;
    margin-bottom: 1.5rem;
}

.ll-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.ll-skeleton-card {
    padding: 0.75rem;
    border: 1px solid var(--ll-outline);
}

.ll-skeleton-img {
    aspect-ratio: 1 / 1;
    margin-bottom: 0.75rem;
}

.ll-skeleton-line.ll-skeleton-title {
    height: 16px;
    width: 85%;
    margin-bottom: 0.5rem;
}

.ll-skeleton-line.ll-skeleton-price {
    height: 20px;
    width: 55%;
}

@keyframes ll-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (max-width: 1024px) {
    .ll-skeleton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .ll-skeleton-grid { grid-template-columns: minmax(0, 1fr); }
    .ll-skeleton-head { width: 60%; }
}
