/* ===================================
   PRODUCT MODAL STYLES
   ================================ */

/* === Modal Foundation === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.53);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.7);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* === Product Modal Container === */
.modal-product {
    padding: 22px var(--spacing-md) var(--spacing-xl) var(--spacing-xl);
    background-color: var(--color-card-bg);
    border-radius: var(--radius);
    max-width: 945px;
    width: 100%;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* === Modal Header === */
.modal-product__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
    padding-right: var(--spacing-xs);
}

.modal-product__header span {
    font-weight: 600;
    font-size: 24px;
    line-height: 36px;
    color: var(--color-text-light);
    flex: 1;
}

.modal-product__header svg {
    cursor: pointer;
    transition: opacity var(--transition-fast);
    position: relative;
    z-index: 1000;
}

.modal-product__header svg:hover {
    opacity: 0.8;
}

/* === Product Image === */
.modal-product__img {
    position: relative;
    background-color: rgba(50, 50, 50, 1);
    border-radius: var(--spacing-md);
    height: 200px;
    margin-bottom: var(--spacing-xl);
}

.modal-product__img img {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -33px;
    width: 255px;
    height: 255px;
}

.modal-product__title {
    font-weight: 400;
    font-size: 24px;
    line-height: 36px;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
}

/* === Accordion Container === */
.acord-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: 28px;
    max-height: 305px;
    overflow-y: auto;
    padding-right: var(--spacing-xs);
}

.acord-container::-webkit-scrollbar {
    width: 11px;
}

.acord-container::-webkit-scrollbar-track {
    background: var(--color-scrollbar-track);
    border-radius: 5px;
}

.acord-container::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 5px;
}

/* === Accordion Items === */
.acord-item {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: none;
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s ease forwards;
}

.acord-item:hover {
    transform: translateY(-2px);
}

.acord-item.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Staggered animation delays */
.acord-item:nth-child(2) { animation-delay: 0.1s; }
.acord-item:nth-child(3) { animation-delay: 0.2s; }
.acord-item:nth-child(4) { animation-delay: 0.3s; }
.acord-item:nth-child(5) { animation-delay: 0.4s; }
.acord-item:nth-child(6) { animation-delay: 0.5s; }
.acord-item:nth-child(7) { animation-delay: 0.6s; }
.acord-item:nth-child(8) { animation-delay: 0.7s; }

.acord-header {
    padding: 11px var(--spacing-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background-color: var(--color-card-bg);
}

.acord-header span {
    font-weight: 600;
    font-size: 16px;
    line-height: 72%;
    color: var(--color-text-light);
    margin-left: var(--spacing-md);
}

.acord-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.acord-header:hover::before {
    left: 100%;
}

.acord-icon {
    width: 18px;
    height: 12px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    margin-left: auto;
}

.acord-item.active .acord-icon {
    transform: rotate(180deg);
}

/* === Accordion Content === */
.acord-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.3s ease,
        opacity 0.3s ease;
    opacity: 0;
    background: rgba(32, 32, 32, 1);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.acord-item.active .acord-content {
    max-height: 500px;
    padding: var(--spacing-md);
    opacity: 1;
}

.acord-text {
    width: 844px;
    height: 96px;
    font-weight: 400;
    font-size: 16px;
    line-height: 24px;
    color: var(--color-text-tertiary);
}

.acord-text strong {
    font-weight: 500;
}

.acord-text p {
    margin-bottom: var(--spacing-md);
}

.acord-text p:last-child {
    margin-bottom: 0;
}

/* === Accordion Items List === */
.acord-items__title {
    font-weight: 400;
    font-size: 16px;
    line-height: 24px;
    color: var(--color-text-tertiary);
    margin-bottom: var(--spacing-xs);
}

.acord-items__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
    gap: var(--spacing-xs);
}

.acord-items__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-xs) 5px 7px 5px;
    background-color: var(--color-card-bg);
    border-radius: var(--spacing-xs);
}

.acord-items__item img {
    width: 42px;
    height: 42px;
    margin-bottom: 11px;
}

.acord-items__item span {
    font-weight: 600;
    font-size: 16px;
    line-height: 24px;
    color: var(--color-text-tertiary);
}

/* ===================================
   PRODUCT FORM & ACTIONS
   ================================ */

/* === Form Container === */
.modal-product__form-container {
    background: linear-gradient(135deg, rgba(42, 42, 42, 0.9), rgba(32, 32, 32, 0.95));
    border: 1px solid rgba(215, 51, 60, 0.2);
    border-radius: var(--radius-sm);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    position: relative;
    overflow: visible;
}

.modal-product__form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
}

/* === Price Display === */
.modal-product__price-strip {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(74, 222, 128, 0.05));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    position: relative;
    overflow: hidden;
    flex: 1;
    min-height: 56px;
    display: flex;
    align-items: center;
}

.modal-product__price-strip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.6), rgba(74, 222, 128, 0.4), rgba(34, 197, 94, 0.6));
}

/* === Price and Server Display Row === */
.modal-product__price-server-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    align-items: stretch;
}

/* === Server Display === */
/* Interactive Server Selector */
.modal-product__server-strip {
    flex: 1;
    border-radius: var(--radius-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    position: relative;
    min-height: 56px;
    align-items: center;
    background: linear-gradient(135deg, rgba(171, 207, 255, 0.05), rgba(171, 207, 255, 0.02));
    border: 1px solid rgba(171, 207, 255, 0.2);
    overflow: visible;
    z-index: 100;
}

.modal-product__server-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    position: relative;
    width: 100%;
}

.modal-product__server-label {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.server-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--panel-body, #2A2A2A);
    border: 1px solid var(--border-color, #3B3B3B);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    min-width: 250px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.server-dropdown-wrapper:hover {
    border-color: rgba(171, 207, 255, 0.4);
}

.server-dropdown-wrapper.open {
    border-color: #ABCFFF;
    box-shadow: 0 0 0 2px rgba(171, 207, 255, 0.1);
}

.modal-product__flag-icon {
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    object-fit: cover;
    display: block;
}

.server-dropdown-text {
    color: #E5E5E5;
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-dropdown-arrow {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease, stroke 0.2s ease;
}

.server-dropdown-wrapper:hover .server-dropdown-arrow {
    stroke: #ABCFFF;
}

.server-dropdown-wrapper.open .server-dropdown-arrow {
    transform: rotate(180deg);
}

.server-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--panel-body, #2A2A2A);
    border: 1px solid var(--border-color, #3B3B3B);
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    overflow: hidden;
    display: none;
}

.server-dropdown-wrapper.open .server-dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.server-dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.server-dropdown-option:hover {
    background: rgba(171, 207, 255, 0.1);
}

.server-dropdown-option.selected {
    background: rgba(171, 207, 255, 0.15);
}

.server-dropdown-option img {
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.server-dropdown-option span {
    color: #E5E5E5;
    font-size: 0.95rem;
    font-weight: 500;
}

#serverSelectorLoading {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #ABCFFF;
    display: none !important;
    white-space: nowrap;
}

.modal-product__price-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-content: center;
    position: relative;
    z-index: 1;
}

.modal-product__price-container svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.modal-product__price-label {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-product__price-amount {
    font-weight: 700;
    font-size: 20px;
    color: #4ADE80;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* === Action Buttons === */
.modal-product__buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.modal-product__buttons--btn {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    text-decoration: none;
    flex: 1;
    min-width: 120px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    
    /* Default: Add to Cart styling */
    background: var(--gradient-red);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(175, 22, 22, 0.4);
    border: 1px solid var(--color-red-primary);
}

.modal-product__buttons--btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.6s ease;
}

.modal-product__buttons--btn:hover::before {
    left: 100%;
}

.modal-product__buttons--btn span {
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Default button hover (Add to Cart) */
.modal-product__buttons--btn:hover:not(.gift-btn):not(.subscribe-btn):not(.cancel-btn) {
    background: var(--gradient-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(175, 22, 22, 0.6);
    color: var(--color-white);
}

.modal-product__buttons--btn:active:not(.gift-btn):not(.subscribe-btn):not(.cancel-btn) {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(175, 22, 22, 0.4);
}

/* Button Variants */
.modal-product__buttons--btn.gift-btn {
    background: linear-gradient(125deg, var(--color-red-primary), var(--color-red-secondary));
    color: var(--color-white);
    box-shadow: 0 4px 16px rgba(175, 22, 22, 0.4);
    border: 1px solid var(--color-red-primary);
}

.modal-product__buttons--btn.gift-btn:hover {
    background: linear-gradient(125deg, var(--color-red-hover-primary), var(--color-red-hover-secondary));
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(175, 22, 22, 0.6);
    border: 1px solid var(--color-red-hover-primary);
}

.modal-product__buttons--btn.subscribe-btn {
    background: linear-gradient(145deg, var(--color-red-primary), var(--color-red-secondary));
    color: var(--color-white);
    box-shadow: 0 4px 16px rgba(175, 22, 22, 0.4);
    border: 1px solid var(--color-red-primary);
}

.modal-product__buttons--btn.subscribe-btn:hover {
    background: linear-gradient(145deg, var(--color-red-hover-primary), var(--color-red-hover-secondary));
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(175, 22, 22, 0.6);
}

.modal-product__buttons--btn.cancel-btn {
    background: linear-gradient(135deg, rgba(75, 75, 75, 1), rgba(60, 60, 60, 1));
    color: var(--color-text-secondary);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(75, 75, 75, 0.5);
}

.modal-product__buttons--btn.cancel-btn:hover {
    background: linear-gradient(135deg, rgba(90, 90, 90, 1), rgba(75, 75, 75, 1));
    color: var(--color-white);
    box-shadow: var(--shadow-md);
}

/* === Gift Actions === */
.modal-product__gift-actions {
    background: rgba(42, 42, 42, 0.5);
    border: 1px solid rgba(175, 22, 22, 0.3);
    border-radius: var(--radius-xs);
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.modal-product__gift-actions input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(42, 42, 42, 0.8);
    border: 1px solid rgba(175, 22, 22, 0.4);
    border-radius: 6px;
    color: var(--color-text-light);
    font-size: 14px;
    margin-bottom: var(--spacing-sm);
    transition: all 0.3s ease;
}

.modal-product__gift-actions input:focus {
    outline: none;
    border-color: var(--color-red-primary);
    box-shadow: 0 0 8px rgba(175, 22, 22, 0.3);
}

.modal-product__gift-actions input::placeholder {
    color: var(--color-text-placeholder);
}

/* === Out of Stock State === */
.modal-product__out-of-stock {
    text-align: center;
    padding: var(--spacing-lg);
    margin: var(--spacing-md) 0;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xs);
    position: relative;
    overflow: hidden;
}

.modal-product__out-of-stock::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.8), rgba(255, 255, 255, 0.6), rgba(239, 68, 68, 0.8));
}

.modal-product__out-of-stock span {
    color: #EF4444;
    font-weight: 800;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===================================
   RESPONSIVE DESIGN
   ================================ */

/* Tablet (Below 768px) */
@media (max-width: 768px) {
    .modal {
        padding: var(--spacing-md);
        width: 95%;
        max-height: 95vh;
    }

    .modal-product {
        padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) var(--spacing-md);
        max-height: calc(95vh - 30px);
    }

    .modal-product__form-container {
        padding: var(--spacing-md);
        margin: var(--spacing-md) 0;
    }

    .modal-product__price-quantity-row {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: stretch;
    }

    .modal-product__price-server-row {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: stretch;
    }

    .modal-product__price-display {
        justify-content: center;
    }

    .modal-product__quantity-compact {
        min-width: 100%;
    }

    .modal-product__buttons {
        flex-direction: column;
    }

    .modal-product__buttons--btn,
    .modal-product__buttons--btn.gift-btn,
    .modal-product__buttons--btn.subscribe-btn,
    .modal-product__buttons--btn.cancel-btn {
        min-width: 100% !important;
        height: 49px !important;
        min-height: 49px !important;
        max-height: none !important;
    }

    .acord-container {
        max-height: 200px;
    }

    .modal-product__img {
        height: 150px;
        margin-bottom: var(--spacing-md);
    }

    .modal-product__img img {
        width: 200px;
        height: 200px;
        top: -25px;
    }
}

/* Mobile (Below 480px) */
@media (max-width: 480px) {
    .modal {
        padding: var(--spacing-xs);
        width: 98%;
        max-height: 98vh;
    }

    .modal-product {
        padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-md) var(--spacing-md);
        max-height: calc(98vh - 20px);
    }

    .modal-product__header span {
        font-size: 20px;
        line-height: 28px;
    }

    .modal-product__title {
        font-size: 20px;
        line-height: 28px;
    }

    .modal-product__price-server-row {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: stretch;
    }

    .modal-product__server-label {
        font-size: 13px;
    }
    
    .server-dropdown-wrapper {
        min-width: 200px;
        padding: 0.4rem 0.6rem;
    }
    
    .server-dropdown-text {
        font-size: 13px;
    }
    
    .modal-product__flag-icon {
        width: 20px;
        height: 13px;
    }
    
    .server-dropdown-arrow {
        width: 12px;
        height: 12px;
    }
    
    .server-dropdown-option {
        padding: 0.6rem;
    }
    
    .server-dropdown-option span {
        font-size: 13px;
    }
    
    .server-dropdown-option img {
        width: 20px;
        height: 13px;
    }
    
    .server-dropdown-menu {
        min-width: 200px;
    }

    .acord-container {
        max-height: 150px;
    }

    .modal-product__img {
        height: 120px;
        margin-bottom: var(--spacing-md);
    }

    .modal-product__img img {
        width: 150px;
        height: 150px;
        top: -20px;
    }
}

/* ===================================
   CUSTOM SERVER SELECTOR ANIMATIONS
   ================================ */

#customServerSelector {
    display: none !important;
}

#customServerSelector.initialized {
    display: flex !important;
    animation: slideInUp 0.4s ease-out;
}

.server-dropdown-wrapper.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

#serverSelectorLoading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===================================
   ANIMATIONS
   ================================ */

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}