/**
 * RB Jewellers Catalog - Modals Styles
 *
 * @package    RB_Jewellers_Catalog
 * @since      2.0.0
 */

/* ==========================================================================
   Modal
   ========================================================================== */

.rb-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rb-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--rb-overlay);
}

.rb-modal-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--rb-bg);
    border-radius: var(--rb-radius-lg);
    overflow: hidden;
    box-shadow: var(--rb-shadow-lg);
}

.rb-modal-content {
    overflow-y: auto;
    max-height: 90vh;
}

.rb-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: var(--rb-bg);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: var(--rb-text-light);
    z-index: 10;
    box-shadow: var(--rb-shadow);
}

.rb-modal-body {
    display: flex;
    gap: 30px;
    padding: 30px;
}

.rb-modal-gallery {
    flex: 1;
    min-width: 0;
}

.rb-gallery-main {
    position: relative;
    aspect-ratio: 1;
    background: var(--rb-bg-light);
    border-radius: var(--rb-radius);
    overflow: hidden;
}

.rb-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rb-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--rb-bg);
    border: none;
    border-radius: 50%;
    box-shadow: var(--rb-shadow);
    font-size: 18px;
    color: var(--rb-text);
}

.rb-gallery-prev {
    left: 10px;
}

.rb-gallery-next {
    right: 10px;
}

.rb-gallery-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
}

.rb-gallery-thumb {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: var(--rb-radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color var(--rb-transition);
}

.rb-gallery-thumb.active {
    border-color: var(--rb-primary);
}

.rb-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rb-modal-details {
    flex: 1;
    min-width: 0;
}

.rb-modal-badges {
    margin-bottom: 10px;
}

.rb-modal-title {
    margin: 0 0 15px;
    font-size: 24px;
    color: var(--rb-text);
}

.rb-modal-sku,
.rb-modal-category,
.rb-modal-price {
    margin: 0 0 8px;
    font-size: 14px;
}

.rb-modal-sku .rb-label,
.rb-modal-category .rb-label,
.rb-modal-price .rb-label {
    color: var(--rb-text-light);
}

.rb-modal-price .rb-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--rb-primary-dark);
}

.rb-modal-description {
    margin: 20px 0;
    font-size: 14px;
    color: var(--rb-text-light);
    line-height: 1.6;
}

.rb-quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.rb-qty-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--rb-border);
    border-radius: var(--rb-radius);
    overflow: hidden;
}

.rb-qty-btn {
    width: 40px;
    height: 40px;
    background: var(--rb-bg-light);
    border: none;
    font-size: 18px;
    color: var(--rb-text);
}

.rb-qty-value {
    width: 50px;
    height: 40px;
    border: none;
    text-align: center;
    font-size: 16px;
    -moz-appearance: textfield;
}

.rb-qty-value::-webkit-inner-spin-button,
.rb-qty-value::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rb-modal-add-btn {
    width: 100%;
    padding: 15px 30px;
    background: var(--rb-primary);
    border: none;
    border-radius: var(--rb-radius);
    font-size: 16px;
    font-weight: 600;
    color: var(--rb-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background var(--rb-transition);
}

.rb-modal-add-btn:hover {
    background: var(--rb-primary-dark);
}

.rb-modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--rb-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .rb-modal-body {
        flex-direction: column;
        padding: 20px;
    }

    .rb-modal-title {
        font-size: 20px;
    }
}


/* ==========================================================================
   Image Lightbox
   ========================================================================== */

.rb-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rb-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    transition: transform var(--rb-transition);
}

.rb-lightbox-close:hover {
    transform: scale(1.1);
}

.rb-lightbox-content {
    max-width: 90%;
    max-height: 90%;
}

.rb-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.rb-lightbox-prev,
.rb-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background var(--rb-transition);
}

.rb-lightbox-prev:hover,
.rb-lightbox-next:hover {
    background: rgba(255,255,255,0.2);
}

.rb-lightbox-prev {
    left: 20px;
}

.rb-lightbox-next {
    right: 20px;
}

.rb-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}


/* ==========================================================================
   Enhanced Modal
   ========================================================================== */

.rb-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rb-modal-overlay {
    position: absolute;
    inset: 0;
    background: var(--rb-overlay);
}

.rb-modal-container {
    position: relative;
    width: 100%;
    max-width: 950px;
    max-height: 90vh;
    background: var(--rb-bg);
    border-radius: var(--rb-radius-lg);
    overflow: hidden;
    box-shadow: var(--rb-shadow-lg);
}

.rb-modal-content {
    overflow-y: auto;
    max-height: 90vh;
}

.rb-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: var(--rb-bg);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rb-text-light);
    z-index: 10;
    box-shadow: var(--rb-shadow);
    cursor: pointer;
    transition: all var(--rb-transition);
}

.rb-modal-close:hover {
    background: var(--rb-bg-light);
    color: var(--rb-text);
}

.rb-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px;
    gap: 15px;
}

.rb-modal-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

@media (max-width: 768px) {
    .rb-modal-product {
        grid-template-columns: 1fr;
        padding: 20px;
    }
}

.rb-modal-gallery {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rb-modal-image-main {
    aspect-ratio: 1;
    background: var(--rb-bg-light);
    border-radius: var(--rb-radius);
    overflow: hidden;
}

.rb-modal-image-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rb-modal-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
}

.rb-modal-info {
    display: flex;
    flex-direction: column;
}

.rb-modal-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.rb-modal-category {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rb-primary);
    margin-bottom: 10px;
}

.rb-modal-title {
    margin: 0 0 15px;
    font-size: 24px;
    font-weight: 600;
}

.rb-modal-meta {
    font-size: 14px;
    color: var(--rb-text-light);
    margin-bottom: 10px;
}

.rb-modal-meta strong {
    color: var(--rb-text);
}

.rb-modal-price {
    font-size: 20px;
    font-weight: 600;
    color: var(--rb-primary-dark);
    margin-bottom: 15px;
}

.rb-modal-description {
    font-size: 14px;
    color: var(--rb-text-light);
    line-height: 1.7;
    margin-bottom: 20px;
    max-height: 100px;
    overflow-y: auto;
}

.rb-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: auto;
}

.rb-modal-add-to-inquiry {
    width: 100%;
}

.rb-modal-view-details {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--rb-primary);
    font-weight: 500;
}

.rb-modal-view-details:hover {
    color: var(--rb-primary-dark);
}


/* ==========================================================================
   Enhanced Drawer
   ========================================================================== */

.rb-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    z-index: 10001;
    pointer-events: none;
    background: transparent; /* Must be transparent - actual background is on .rb-drawer-container */
}

.rb-drawer.open {
    pointer-events: auto;
}

.rb-drawer-overlay {
    position: fixed;
    inset: 0;
    background: var(--rb-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--rb-transition);
}

.rb-drawer.open .rb-drawer-overlay {
    opacity: 1;
    visibility: visible;
}

.rb-drawer-container {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--rb-bg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--rb-shadow-lg);
    transform: translateX(100%);
    transition: transform var(--rb-transition);
}

.rb-drawer.open .rb-drawer-container {
    transform: translateX(0);
}

.rb-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--rb-border);
}

.rb-drawer-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
}

.rb-drawer-count {
    background: var(--rb-primary);
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

.rb-drawer-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--rb-text-light);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--rb-transition);
}

.rb-drawer-close:hover {
    background: var(--rb-bg-light);
    color: var(--rb-text);
}

.rb-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.rb-drawer-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--rb-text-light);
}

.rb-drawer-empty svg {
    opacity: 0.3;
    margin-bottom: 15px;
}

.rb-drawer-empty p {
    margin: 0 0 5px;
    font-size: 16px;
    color: var(--rb-text);
}

.rb-drawer-empty small {
    font-size: 13px;
}

.rb-drawer-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rb-drawer-items-list li {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--rb-bg-light);
    border-radius: var(--rb-radius);
    margin-bottom: 10px;
    position: relative;
}

.rb-drawer-footer {
    padding: 20px;
    border-top: 1px solid var(--rb-border);
    background: var(--rb-bg);
}

.rb-drawer-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 15px;
}

.rb-drawer-summary strong {
    color: var(--rb-primary);
}

.rb-drawer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rb-drawer-clear {
    flex: 0 0 auto;
}

.rb-drawer-actions .rb-btn:last-child {
    flex: 1;
}


