/* Main container */
.product-variations-container {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(400px, 1fr); /* Sağ kolonu küçülttük */
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
}

/* Left Column Styles */
.variations-left-column {
    grid-column: 1 / 2;
    padding: 20px;
    background: linear-gradient(145deg, #f9f9f9, #f1f1f1);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Variation Set */
.variation-set {
    position: relative;
    padding: 20px;
    border: 1px solid #e8ecef;
    border-radius: 8px;
    background: #fff;
    transition: background-color 0.3s ease;
    animation: fadeIn 0.3s ease-in-out;
}

.variation-set.removing {
    animation: fadeOut 0.3s ease-in-out forwards; /* Kaldırma animasyonu */
}

.variation-set:first-child .remove-variation {
    display: none;
}

.variation-set:hover {
    background-color: #fafafa;
}

/* Dropdown Container */
.variation-dropdowns {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)); /* 5 sütun: Material, Color, Size, Pieces, Price */
    gap: 15px;
    align-items: start;
    width: 100%;
}

.dropdown-container {
    display: flex;
    flex-direction: column;
}

/* Select Elements */
.variation-select {
    min-width: 100px; /* Minimum genişlik */
    width: 120px;
    padding: 8px 30px 8px 10px; /* Padding küçültüldü */
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px; /* Font boyutu küçültüldü */
    font-weight: 400;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1em; /* Ok simgesi boyutu küçültüldü */
    transition: all 0.3s ease;
}

.variation-select:hover {
    border-color: #3b82f6;
    transform: scale(1.01);
}

.variation-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Pieces Input */
.Pieces-input {
    width: 100%;
    padding: 8px 10px; /* Padding küçültüldü */
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px; /* Font boyutu küçültüldü */
    transition: all 0.3s ease;
}

.Pieces-input:hover {
    border-color: #3b82f6;
    transform: scale(1.01);
}

.Pieces-input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Price Area */
.variation-price {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Sola hizala */
    padding: 0;
    width: 100%;
    min-width: 120px;
    grid-column: 5 / 6; /* Price alanı 5. sütunda */
    align-self: start; /* Yukarıdan hizala */
}

.price-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Sola hizala */
    gap: 6px; /* Elemanlar arası boşluk */
}

.variation-total-price {
    font-size: 1.2em;
    font-weight: 600;
    color: #2563eb;
    line-height: 1.2;
    text-align: left;
}

.price-per-unit {
    font-size: 0.9em;
    color: #6b7280;
    white-space: nowrap;
    display: block;
    margin-bottom: 4px;
    text-align: left;
}

.discount-info {
    display: block;
    margin-left: 0;
    background: #d1fae5;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    color: #047857;
    padding: 3px 10px;
    width: fit-content;
    text-align: left;
}

/* Remove Button */
.remove-variation {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: #6b7280;
    transition: all 0.3s ease;
    z-index: 2;
}

.remove-variation:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: rotate(90deg);
}

/* Add New Variation Button */
.add-variation-btn {
    position: relative;
    width: 48px;
    height: 48px;
    margin: 24px auto;
    padding: 0;
    background: #22c55e;
    border: 2px #22c55e;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none; /* Outline'ı kaldır */
}

.add-variation-btn::before {
    content: '+';
    font-size: 24px;
    color: #FFFFFF;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-variation-btn::after {
    content: 'Add another variation';
    position: absolute;
    white-space: nowrap;
    color: white;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-variation-btn:hover {
    width: 220px;
    border-radius: 24px;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.add-variation-btn:focus:hover {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2); /* Hover ve focus durumunda aynı gölge */
}

.add-variation-btn:hover::before {
    opacity: 0;
    transform: translateY(-20px);
}

.add-variation-btn:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.add-variation-btn:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    outline: none;
}

.add-variation-btn:disabled:focus {
    box-shadow: none;
}

.add-variation-btn:disabled::before {
    color: #535353;
    opacity: 1;
    transform: none;
}

.add-variation-btn:disabled::after {
    display: none;
}

@keyframes buttonExpand {
    from {
        width: 48px;
        border-radius: 50%;
    }
    to {
        width: 220px;
        border-radius: 24px;
    }
}

/* Right Column */
.variations-right-column {
    position: sticky;
    top: 20px;
    height: fit-content;
    grid-column: 2 / 3;
}

/* Product Image */
.product-image {
    aspect-ratio: 1;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 16px;
}

.variation-image {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 380px;
    display: block;
    margin-bottom: 6px;
    object-fit: contain;
    transition: transform 0.3s ease;
    top: -15px;
    position:relative;
}

.variation-image:hover {
    transform: scale(1.65);
}

.product-image-container {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 16px;
    max-width: 500px;
    margin: 0 auto 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.06);
    padding: 16px;
}

.image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 32px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 6px;
    overflow: hidden;
}

.product-dimensions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    padding: 12px 0;
    background: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Total Section */
.total-section {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 16px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.06);
}

.total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 17px;
    font-weight: 500;
    color: #1f2937;
}

.total-price span {
    color: #2563eb;
    font-weight: 600;
}

/* Add to Cart Button */
.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.add-to-cart-btn:hover {
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

/* Overlay Styles */
.variation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    backdrop-filter: blur(5px);
}

.variation-overlay.active {
    opacity: 1;
    visibility: visible;
}

.variation-alert {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: translateY(-20px);
    transition: all 0.3s ease-in-out;
}

.variation-overlay.active .variation-alert {
    transform: translateY(0);
}

.variation-alert h3 {
    color: #ef4444;
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.variation-alert p {
    margin: 0 0 16px 0;
    color: #6b7280;
    font-size: 15px;
    line-height: 1.6;
}

.variation-alert button {
    padding: 10px 24px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

.variation-alert button:hover {
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
}

.dropdown-title {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 6px;
    padding-left: 2px;
    letter-spacing: 0.02em;
}

.dropdown-container {
    margin-bottom: 0;
}

/* Animasyonlar */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .product-variations-container {
        grid-template-columns: minmax(0, 3fr) minmax(300px, 1fr); /* Sağ kolonu daha da küçülttük */
        gap: 20px;
    }

    .variation-dropdowns {
        grid-template-columns: repeat(3, 1fr); /* 3 sütun: Material, Color, Size */
        gap: 12px;
    }

    .dropdown-container:nth-child(4) { /* Pieces */
        grid-column: 1 / 2; /* Pieces, Material'ın altına */
    }

    .variation-price {
        grid-column: 2 / 4; /* Price, Color ve Size'ın altına, 2. ve 3. sütunu kaplar */
        align-self: start;
        padding-top: 0;
    }

    .variation-select,
    .Pieces-input {
        width: 100%; /* Genişliği artır */
    }
}

@media (max-width: 992px) {
    .product-variations-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .variations-left-column {
        grid-column: 1 / 2;
    }

    .variations-right-column {
        grid-column: 1 / 2;
        position: static; /* Sticky özelliğini kaldır */
    }

    .variation-dropdowns {
        grid-template-columns: repeat(2, 1fr); /* 2 sütun: Material, Color */
        gap: 12px;
    }

    .dropdown-container:nth-child(3) { /* Size */
        grid-column: 1 / 2; /* Size, Material'ın altına */
    }

    .dropdown-container:nth-child(4) { /* Pieces */
        grid-column: 2 / 3; /* Pieces, Color'ın altına */
    }

    .variation-price {
        grid-column: 1 / 3; /* Price tüm satırı kaplar */
        padding-top: 12px;
    }
}

@media (max-width: 768px) {
    .product-variations-container {
        padding: 16px;
    }

    .variation-dropdowns {
        grid-template-columns: 1fr; /* Tek sütun: Hepsi dikey */
        gap: 10px;
    }

    .dropdown-container:nth-child(3),
    .dropdown-container:nth-child(4) {
        grid-column: auto; /* Normal akışa dön */
    }

    .variation-price {
        grid-column: 1 / 2; /* Price tüm satırı kaplar */
        padding-top: 0;
    }

    .variation-set {
        padding: 12px;
    }

    .variations-left-column {
        padding: 12px;
    }

    .add-variation-btn {
        width: 40px;
        height: 40px;
        margin: 16px auto;
    }

    .add-variation-btn:hover {
        width: 200px;
    }

    .add-variation-btn::before {
        font-size: 20px;
    }

    .add-variation-btn::after {
        font-size: 14px;
    }
}