:root {
    --vi-green: #43a900;
    --vi-green-light: #ccffaa;
    --bs-body-bg: #e6e6e6;
    --bs-border-color: #227600;
    --bs-success-rgb: 67, 169, 0;
}

.navbar-dark {
    --bs-navbar-color: rgba(255, 255, 255, 0.95);
    --bs-navbar-hover-color: rgba(255, 255, 255, 1.0);
    --bs-navbar-active-color: #000;
    --bs-navbar-disabled-color: rgba(255, 255, 255, 0.4);
    --bs-navbar-brand-color: #ffffff;
    --bs-navbar-brand-hover-color: #ffffff;
    --bs-navbar-toggler-border-color: rgba(255, 255, 255, 0.3);
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.card {
    --bs-card-bg: #fff;
}


.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #44aa00;
    --bs-btn-border-color: #44aa00;
    --bs-btn-hover-color: #000;
    --bs-btn-hover-bg: #ccffaa;
    --bs-btn-hover-border-color: #44aa00;
    --bs-btn-active-color: #000;
    --bs-btn-active-bg: #ccffaa;
    --bs-btn-active-border-color: #ccffaa;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #44aa00;
    --bs-btn-disabled-border-color: #44aa00;
}


/* ---------- Dark mode ---------- */
[data-bs-theme="dark"] {
    --bs-body-bg: #010;
    .card {
        --bs-card-bg: #121;
    }
    .alt-idiom-card {
        background-color: #121 !important;
        border-left-color: var(--vi-green) !important;
        color: #fff !important;
    }
    .alt-idiom-card .card-text,
    .alt-idiom-card .text-muted {
        color: #adb5bd !important;
    }
    .alt-idiom-card .card-title {
        color: #fff !important;
    }
    .alt-idiom-card:hover {
        box-shadow: 0 6px 16px rgba(0,0,0,0.5) !important;
    }
    .bad-idiom-card {
        background-color: #210 !important;
        border-left-color: #dc3545 !important;
    }
}

[data-bs-theme="dark"] .profile-header {
    background: var(--vi-green-light);
}
[data-bs-theme="dark"] .profile-header h1 {
    color: #000;
}

/* Cards */
.idiom-card {
    border-left: 4px solid var(--vi-green);
    transition: box-shadow 0.15s;
}
.idiom-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.bad-idiom-card {
    border-left-color: #dc3545;
    background-color: #fff0f0;
}

/* Vote widget */
.vote-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 2.5rem;
}
.vote-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    font-size: 1.1rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.1s, background 0.1s;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}
.vote-btn:hover { color: var(--vi-green); background: var(--vi-green-light); }
.vote-btn.active-up { color: var(--vi-green); }
.vote-btn.active-down { color: #dc3545; }
.vote-score {
    font-weight: 700;
    font-size: 0.95rem;
}

/* Alt idiom cards */
.alt-idiom-card {
    border-left: 4px solid var(--vi-green);
    transition: box-shadow 0.15s;
    background-color: #f0fff0;
}
.alt-idiom-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.alt-idiom-card .card-body {
    padding: 1.25rem;
}

/* Mobile tweaks */
@media (max-width: 576px) {
    .vote-widget { flex-direction: row; gap: 4px; }
}

/* Moderation nav badge */
.nav-mod-link {
    position: relative;
}
.mod-pending-badge {
    position: absolute;
    top: 4px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    background-color: #ffc107;
    color: #212529;
    border-radius: 8px;
}

/* Status badges */
.badge-pending { background-color: #ffc107; color: #212529; }
.badge-approved { background-color: #198754; }
.badge-rejected { background-color: #dc3545; }
.badge-sm { font-size: 0.55em; padding: 0.25em 0.5em; }

/* Search input */
.search-spinner { display: none; }
.htmx-request .search-spinner { display: inline-block; }

/* Profile */
.profile-header {
    background: var(--vi-green-light);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Mobile tweaks */
@media (max-width: 576px) {
    .alt-idiom-row { flex-wrap: wrap; }
    .vote-widget { flex-direction: row; gap: 4px; }
}

/* Store admin idiom chips */
.idiom-chip-area {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 2rem;
}
.idiom-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35em 0.5em;
    font-size: 0.9rem;
}
.idiom-chip .btn-close {
    width: 0.6em;
    height: 0.6em;
    font-size: 0.6em;
}
.idiom-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bs-body-bg);
    border-radius: 0.375rem;
    margin-top: 0.25rem;
}
.idiom-search-results:empty {
    display: none;
}

/* Store admin variants */
.variant-row td {
    vertical-align: top;
}
.image-preview img {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
}

/* ---------- Public store cards ---------- */
.product-card {
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--bs-border-color);
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.product-card-img {
    height: 220px;
    object-fit: contain;
    background-color: #ffffff;
}
.product-card-placeholder {
    background-color: var(--bs-tertiary-bg);
}
.product-card-images {
    position: relative;
    height: 220px;
    background-color: #ffffff;
    overflow: hidden;
}
.product-card-images img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}
.product-card-images img.active {
    opacity: 1;
}

@media (max-width: 576px) {
    .product-card-img {
        height: 180px;
    }
    .product-card-images {
        height: 180px;
    }
}

/* ---------- Product detail page ---------- */
.product-main-image {
    min-height: 360px;
    overflow: hidden;
}

.product-detail-image {
    max-height: 400px;
    object-fit: contain;
    cursor: zoom-in;
}

.product-image-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.92);
    padding: 1rem;
}

.product-image-modal img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}

.product-image-modal-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2001;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.product-image-modal-close:hover,
.product-image-modal-close:focus {
    opacity: 1;
}

.product-thumbnail {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 2px solid var(--bs-border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: opacity 0.15s, border-color 0.15s;
}

.product-thumbnail:hover {
    opacity: 0.8;
    border-color: var(--vi-green);
}

.variant-option-btn {
    position: relative;
    cursor: pointer;
    transition:
        color 0.7s ease,
        background-color 0.7s ease,
        border-color 0.7s ease,
        box-shadow 0.7s ease,
        opacity 0.7s ease;
}

.variant-unavailable {
    opacity: 0.65;
}

#size-options button {
    min-width: 3.5rem;
}

.color-swatch-btn {
    padding: 1px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: none;
}

.color-swatch-btn.color-swatch-selected {
    border-color: var(--bs-success);
}

.color-swatch {
    display: block;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .color-swatch {
    border-color: rgba(255, 255, 255, 0.5);
}

.not-available-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    color: #dc3545;
    background-color: var(--bs-body-bg);
    border-radius: 50%;
    width: 1.1rem;
    height: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: scale(1.15); }
    20% { transform: scale(1.08); }
    30% { transform: rotate(-6deg) scale(1.03); }
    50% { transform: rotate(6deg) scale(1); }
    70% { transform: rotate(-2deg) scale(1); }
    80% { transform: rotate(2deg) scale(1); }
    90% { transform: rotate(-1deg) scale(1); }
}

.wiggle {
    animation: wiggle 1.25s ease-in-out 0.25s;
}

@media (max-width: 576px) {
    .product-main-image {
        min-height: 260px;
    }
    .product-detail-image {
        max-height: 280px;
    }
}

/* ---------- Clickable featured card ---------- */
.card[href]:hover,
a.card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

/* ---------- Alt idiom shop link ---------- */
.alt-shop-link {
    font-size: 1rem;
    opacity: 0.75;
    text-decoration: none;
    vertical-align: middle;
}
.alt-shop-link:hover {
    opacity: 1;
}

/* ---------- Cart quantity field on product detail ---------- */
.cart-qty-field {
    width: 5rem;
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    line-height: 1.5;
}

/* ---------- Navbar cart icon + badge ---------- */
.cart-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: 1.25rem;
}

.cart-badge {
    position: absolute;
    top: 0;
    right: .25rem;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    background-color: #ffc107;
    color: #212529;
    border-radius: 8px;
    display: none;
}

/* ---------- Cart page ---------- */
.cart-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0.25rem;
    background-color: var(--bs-tertiary-bg);
}

.cart-thumb-placeholder {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-tertiary-bg);
    border-radius: 0.25rem;
    color: var(--bs-secondary-color);
    font-size: 1.5rem;
}

.cart-qty-control input[type="number"] {
    width: 4rem;
    text-align: center;
}

/* hide browser spin buttons on cart qty inputs */
.cart-qty-control input[type="number"]::-webkit-inner-spin-button,
.cart-qty-control input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.cart-qty-control input[type="number"] {
    -moz-appearance: textfield;
}

/* ---------- django-simple-captcha ---------- */
.captcha {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    border: 1px solid var(--bs-border-color);
    margin-bottom: 0.5rem;
}

.captcha ~ input[type="text"],
.captcha ~ input[type="text"].form-control {
    margin-top: 0.5rem;
}

.captcha ~ a,
.captcha ~ audio {
    display: inline-block;
    margin-top: 0.5rem;
    margin-right: 0.75rem;
}
