/**
 * Product Categorization Modal Styles
 * Aligned with Shido Design System
 */

/* ============================================
   MODAL CONTAINER
   ============================================ */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.product-modal.hidden {
    display: none;
}

/* Backdrop */
.product-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================
   MODAL CONTENT
   ============================================ */
.product-modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: productModalSlideIn 0.3s ease-out;
}

@keyframes productModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   HEADER
   ============================================ */
.product-modal-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--glass-border);
}

.product-modal-header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 167, 31, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffa71f;
    flex-shrink: 0;
}

.product-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.product-modal-subtitle {
    margin: 4px 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.product-modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.product-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ============================================
   BODY
   ============================================ */
.product-modal-body {
    padding: var(--spacing-lg);
}

/* Product Info Card */
.product-info {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.product-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
}

.product-platform {
    background: var(--accent-primary);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.product-price {
    color: var(--accent-green);
    font-weight: 600;
}

/* ============================================
   TYPE SELECTOR
   ============================================ */
.product-type-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-sm);
}

/* Grid: 3 columns on first row, 2 centered on second */
.product-type-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.product-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md) var(--spacing-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.product-type-btn i,
.product-type-btn svg {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.product-type-btn:hover {
    border-color: #ffa71f;
    background: rgba(255, 167, 31, 0.08);
}

.product-type-btn:hover i,
.product-type-btn:hover svg {
    color: #ffa71f;
}

.product-type-btn.active {
    border-color: #ffa71f;
    background: rgba(255, 167, 31, 0.15);
    box-shadow: 0 0 0 1px #ffa71f, 0 4px 12px rgba(255, 167, 31, 0.3);
}

.product-type-btn.active i,
.product-type-btn.active svg {
    color: #ffa71f;
}


/* Position Downsell and Backend as single-column width, centered in row 2 */
.product-type-btn:nth-child(4) {
    grid-column: 1 / 2;
}

.product-type-btn:nth-child(5) {
    grid-column: 3 / 4;
}


/* ============================================
   NUMBER SELECTOR
   ============================================ */
.product-number-selector {
    margin-top: var(--spacing-md);
}

.product-number-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--spacing-xs);
    justify-content: space-between;
}

.product-number-btn {
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.product-number-btn:hover {
    border-color: #ffa71f;
    background: rgba(255, 167, 31, 0.08);
}

.product-number-btn.active {
    border-color: #ffa71f;
    background: #ffa71f;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 167, 31, 0.3);
}

/* ============================================
   LABEL INPUT
   ============================================ */
.product-label-input {
    margin-top: var(--spacing-md);
}

.product-label-wrapper {
    position: relative;
}

.product-label-field {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-right: 60px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.product-label-field:focus {
    outline: none;
    border-color: #ffa71f;
    box-shadow: 0 0 0 2px rgba(255, 167, 31, 0.15);
}

.product-label-field::placeholder {
    color: var(--text-muted);
}

.product-label-counter {
    position: absolute;
    right: var(--spacing-sm);
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   PREVIEW
   ============================================ */
.product-save-preview {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(67, 233, 123, 0.1);
    border: 1px solid rgba(67, 233, 123, 0.25);
    border-radius: var(--radius-sm);
    color: var(--accent-green);
    font-size: 0.875rem;
    align-items: center;
}

.product-save-preview strong {
    color: var(--text-primary);
}

/* ============================================
   FOOTER
   ============================================ */
.product-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--glass-border);
}

.product-modal-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
}

.product-modal-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.product-modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.product-modal-btn-primary {
    background: #ffa71f;
    border: none;
    color: white;
}

.product-modal-btn-primary:hover:not(:disabled) {
    background: #ff9500;
    box-shadow: 0 4px 12px rgba(255, 167, 31, 0.4);
}

.product-modal-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   PENDING COUNT
   ============================================ */
.product-pending-count {
    text-align: center;
    padding: 0 var(--spacing-lg) var(--spacing-md);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: none;
}

/* ============================================
   SIDEBAR NOTIFICATION DOT
   ============================================ */
.product-notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: productPulseDot 2s infinite;
}

@keyframes productPulseDot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */
[data-theme="light"] .product-modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .product-modal-content {
    background: var(--bg-secondary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .product-modal-header-icon {
    background: rgba(255, 167, 31, 0.1);
}

[data-theme="light"] .product-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .product-info {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .product-type-btn {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .product-type-btn:hover {
    background: rgba(255, 167, 31, 0.06);
    border-color: #ffa71f;
}

[data-theme="light"] .product-type-btn.active {
    background: rgba(255, 167, 31, 0.1);
}

[data-theme="light"] .product-number-btn {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .product-number-btn:hover {
    background: rgba(255, 167, 31, 0.06);
}

[data-theme="light"] .product-label-field {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .product-modal-btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .product-modal-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .product-modal {
        padding: var(--spacing-sm);
    }

    .product-modal-content {
        max-width: 100%;
    }

    .product-type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-type-btn:nth-child(4),
    .product-type-btn:nth-child(5) {
        grid-column: auto;
        margin: 0;
        width: 100%;
        justify-self: auto;
    }
}

/* ============================================
   BUNDLE PRICING MODAL
   ============================================ */
.bundle-pricing-content {
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.bundle-pricing-content .product-modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 200px);
    /* Account for header and footer */
}

.bundle-products-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

/* Individual Bundle Product Row */
.bundle-product-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    align-items: center;
}

.bundle-product-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.bundle-product-type {
    min-width: 140px;
}

.bundle-product-type select {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

.bundle-product-type select:focus {
    outline: none;
    border-color: #ffa71f;
}

.bundle-product-price {
    min-width: 100px;
}

.bundle-product-price input {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: right;
}

.bundle-product-price input:focus {
    outline: none;
    border-color: #ffa71f;
}

/* Price Validation Section */
.bundle-price-validation {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.bundle-total-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-xs) 0;
    font-size: 0.9rem;
}

.bundle-total-label {
    color: var(--text-secondary);
}

.bundle-total-value {
    font-weight: 600;
    color: var(--text-primary);
}

.bundle-difference-row .bundle-difference {
    color: #ef4444;
}

.bundle-difference-row.valid .bundle-difference {
    color: var(--accent-green);
}

.bundle-validation-message {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    color: #ef4444;
    font-size: 0.85rem;
}

.bundle-validation-message.valid {
    background: rgba(67, 233, 123, 0.1);
    border-color: rgba(67, 233, 123, 0.25);
    color: var(--accent-green);
}

/* Light Theme Overrides for Bundle Modal */
[data-theme="light"] .bundle-product-row {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .bundle-product-type select,
[data-theme="light"] .bundle-product-price input {
    background: white;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .bundle-price-validation {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}