/* -----------------------------
   Redbaron Public Frontend Styles
   ----------------------------- */

/* Dashboard wrapper */
.redbaron-dashboard-wrapper {
    position: relative;
    overflow: hidden;
    /*max-width: 1000px;*/
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Top bar */
.redbaron-top-bar-wrapper {
    position: sticky;
    top: 0;
    z-index: 9;
    padding-top: 15px;
    background: #fff;
}

.redbaron-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding: 5px 20px;
    background: #f7f7f7;
    border-radius: 4px;
    border: 1px solid #ccc;
}

#redbaron-menu-trigger {
    cursor: pointer;
    font-size: 20px;
    background: none;
    border: none;
}

/* Add Unit trigger button */
#redbaron-add-unit-trigger {
    cursor: pointer;
    font-size: 22px;
    background: none;
    border: none;
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    line-height: 1;
}

#redbaron-add-unit-trigger:hover {
    background: #e2e2e2;
}

/* Analytics trigger button */
#redbaron-analytics-trigger {
    background: none;
    border: none;
    cursor: pointer;
    color: #000;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#redbaron-analytics-trigger:hover {
    background: #e2e2e2;
}

#redbaron-analytics-trigger svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Slide-in category menu (from right) */
.redbaron-slide-menu {
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    height: 100%;
    background: #fafafa;
    border-left: 1px solid #ccc;
    border-radius: 0 6px 6px 0;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    transition: right 0.35s ease;
    z-index: 20;
    padding-bottom: 20px;
}

.redbaron-slide-menu.open {
    right: 0;
}

.redbaron-slide-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    font-weight: bold;
}

#redbaron-close-menu {
    background: none;
    border: none;
    font-size: 25px;
    cursor: pointer;
}

.redbaron-slide-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.redbaron-slide-menu li {
    padding: 0px 15px;
    cursor: pointer;
}

.redbaron-slide-menu li:hover {
    background-color: #e2e2e2;
}

/* Slide-in Add Unit Panel (from left) */
.redbaron-add-panel {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100%;
    background: #fafafa;
    border-right: 1px solid #ccc;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    transition: left 0.35s ease;
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.redbaron-add-panel.open {
    left: 0;
}

.redbaron-add-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1;
}

#redbaron-close-add-panel {
    background: none;
    border: none;
    font-size: 25px;
    cursor: pointer;
}

.redbaron-add-panel-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Add Unit Form */
.redbaron-add-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.redbaron-add-form input[type="text"],
.redbaron-add-form input[type="number"],
.redbaron-add-form select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 14px;
}

.redbaron-image-label {
    font-size: 13px;
    color: #555;
    margin-bottom: -5px;
}

.redbaron-add-form input[type="file"] {
    font-size: 13px;
}

/* Multiple pieces toggle */
.redbaron-multi-qty-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: #333;
}

.redbaron-multi-qty-toggle input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Submit button */
.redbaron-submit-btn {
    width: 100%;
    padding: 10px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.redbaron-submit-btn:hover {
    background: #333;
}

.redbaron-submit-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.redbaron-submit-btn--secondary {
    background: #f0f0f0;
    color: #000;
    border: 1px solid #ccc;
    margin-top: 5px;
}

.redbaron-submit-btn--secondary:hover {
    background: #e2e2e2;
}

/* Danger button (delete) */
.redbaron-submit-btn--danger {
    background: #c62828;
    margin-top: 5px;
}

.redbaron-submit-btn--danger:hover {
    background: #b71c1c;
}

/* Success state */
.redbaron-add-success {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.redbaron-success-message {
    color: #2e7d32;
    font-weight: bold;
    font-size: 15px;
    margin: 0;
}

/* Units grid */
.redbaron-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Desktop: 4 columns */
@media (min-width: 1024px) {
    .redbaron-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Unit card */
.redbaron-unit-card {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    background-color: #fff;
    transition: box-shadow 0.2s;
}

.redbaron-unit-card:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Card image area — positioning context for badge and edit icon */
.redbaron-card-image-area {
    position: relative;
}

/* SOLD badge */
.redbaron-sold-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #c62828;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 2;
    letter-spacing: 0.5px;
}

/* Pieces remaining badge */
.redbaron-remaining-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 3px;
    z-index: 2;
}

/* Edit icon button */
.redbaron-edit-trigger {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255,255,255,0.85);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 5px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.redbaron-edit-trigger:hover {
    background: #fff;
}

.redbaron-edit-trigger svg {
    display: block;
    width: 14px;
    height: 14px;
}

/* Square image display in grid */
.redbaron-unit-card .redbaron-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 10px;
    display: block;
}

.redbaron-unit-card .redbaron-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.redbaron-unit-card input[type="text"],
.redbaron-unit-card input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    border-radius: 5px;
    height: auto;
}

.redbaron-unit-sku {
    margin-bottom: 0px;
    font-size: 13px;
}

.redbaron-sku-label {
    font-size: 13px;
}

/* Password form */
.redbaron-password-wrapper {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
}

.redbaron-password-wrapper .button.button-primary {
    margin-top: 10px;
    padding: 1px 20px;
}

.redbaron-password-wrapper h2 {
    font-size: 20px;
}

/* Overlay */
.redbaron-dashboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.redbaron-dashboard-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* No scroll when overlay is active */
body.redbaron-no-scroll {
    overflow: hidden;
}

/* Logout button */
#redbaron-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin: 0 10px;
    color: #000;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#redbaron-logout-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Slide-in Edit Unit Panel (from right) */
.redbaron-edit-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100%;
    background: #fafafa;
    border-left: 1px solid #ccc;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    transition: right 0.35s ease;
    z-index: 19;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.redbaron-edit-panel.open {
    right: 0;
}

.redbaron-edit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1;
}

#redbaron-close-edit-panel {
    background: none;
    border: none;
    font-size: 25px;
    cursor: pointer;
}

.redbaron-edit-panel-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.redbaron-edit-panel-body input[type="text"],
.redbaron-edit-panel-body input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 14px;
}

/* Sold so far text */
.redbaron-sold-so-far {
    font-size: 13px;
    color: #555;
    margin: 0;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

/* Sold toggle switch */
.redbaron-sold-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.redbaron-sold-toggle-label {
    font-size: 14px;
    color: #333;
}

.redbaron-toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
}

.redbaron-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.redbaron-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.2s ease;
}

.redbaron-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.redbaron-toggle-switch input:checked + .redbaron-toggle-slider {
    background: #c62828;
}

.redbaron-toggle-switch input:checked + .redbaron-toggle-slider::before {
    transform: translateX(18px);
}

/* Analytics overlay (near full screen) */
.redbaron-analytics-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 30;
    display: none;
    justify-content: center;
    align-items: center;
}

.redbaron-analytics-overlay.open {
    display: flex;
}

.redbaron-analytics-inner {
    background: #fff;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.redbaron-analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    font-weight: bold;
}

#redbaron-close-analytics {
    background: none;
    border: none;
    font-size: 25px;
    cursor: pointer;
}

.redbaron-analytics-body {
    padding: 15px;
    overflow-y: auto;
}

/* Analytics table */
.redbaron-analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.redbaron-analytics-table th,
.redbaron-analytics-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.redbaron-analytics-table th {
    background: #f9f9f9;
    font-weight: bold;
    border-bottom: 2px solid #ddd;
}

.redbaron-analytics-table tfoot tr {
    background: #f0f0f0;
    border-top: 2px solid #ddd;
}

.redbaron-analytics-table tfoot td {
    padding: 10px 12px;
}

/* Pagination */
.redbaron-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 15px 0 5px;
    flex-wrap: wrap;
}

.redbaron-pagination button {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.redbaron-pagination button:hover {
    background: #f0f0f0;
}

.redbaron-pagination button.active {
    background: #000;
    color: #fff;
    border-color: #000;
    cursor: default;
}

.redbaron-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.redbaron-pagination .redbaron-pagination-ellipsis {
    font-size: 13px;
    color: #999;
    padding: 0 4px;
    line-height: 34px;
}