:root {
    --card-radius: 8px;
    --transition-speed: 0.3s;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --discount-color: #e74c3c;
    --text-muted: #999;
}

.brand-header {
    width: 100%;
    height: clamp(200px, 30vh, 300px);
    display: grid;
    place-items: center;
    background: var(--brand-bg, #fff);
    margin-bottom: 2rem;
}

.brand-banner {
    width: 150px;
    height: 150px;
    object-fit: contain;
    transition: transform var(--transition-speed) ease;
}

.brand-banner:hover {
    transform: scale(1.05);
}

.discount-banner {
    text-align: center;
    padding: 1rem;
    margin-bottom: 2rem;
    background: var(--discount-color);
    color: white;
}

.discound-title{
    text-align: center;
    font-size: 1rem;
    margin-bottom: 50px;
    font-weight: 500;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(350px, 100%), 1fr));
    gap: 2rem;
    padding: 1rem;
    container-type: inline-size;
}

.product-card {
    background: white;
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: transform var(--transition-speed) ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-image {
    height: 400px;
    object-fit: contain;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed) ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.product-info h3 {
    font-size: 1.1rem;
}

.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.discounted-price-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.discounted-price {
    color: var(--discount-color);
    font-weight: 700;
    font-size: 1.2rem;
}

.original-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.discount-badge {
    background: var(--discount-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: calc(var(--card-radius) / 2);
    font-size: 0.8rem;
    font-weight: 500;
}

.featured-card {
    border: none !important;
    position: relative;
    transition: transform 0.5s ease;
    height: 486px;
}

.featured-card:hover {
    cursor: default;
    transform: none;
}

.featured-image {
    height: 100% !important;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 80px !important; 
    border: 1px lightgray solid;
    border-radius: var(--card-radius);
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%) !important;
    animation: gradientShift 8s ease-in-out infinite;
    overflow: hidden;
}

.featured-image::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.1) 0%, transparent 70%);
    top: -50px;
    left: -50px;
    animation: pulse 4s ease-in-out infinite;
}

.featured-image::after {
    content: '';
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.08) 0%, transparent 70%);
    bottom: 60px;
    right: -30px;
    animation: pulse 4s ease-in-out infinite reverse;
}

.beans-background {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, rgba(139, 69, 19, 0.05) 0%, transparent 70%);
}

.bg-bean {
    width: 100px !important;
    height: 100px !important;
    position: absolute;
    animation: float 3s ease-in-out infinite;
    will-change: transform;
    transform: translateZ(0);
    filter: drop-shadow(0 0 5px rgba(139, 69, 19, 0.2));
}

.bg-bean:nth-child(1) {
    top: 15%;
    right: 10%;
    transform: rotate(15deg);
    animation: float1 4s ease-in-out infinite;
}

.bg-bean:nth-child(2) {
    top: 45%;
    left: 10%;
    transform: rotate(-25deg);
    animation: float2 5s ease-in-out infinite;
}

.bg-bean:nth-child(3) {
    top: 65%;
    right: 30%;
    transform: rotate(40deg);
    animation: float3 6s ease-in-out infinite;
}

.partnership-details {
    width: 100%;
    height: 80px;
    background-color: white;
    position: absolute !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #000;
    bottom: 0;
    padding: 0 30px;
}

.partnership-details > .partnership-red {
    background: linear-gradient(90deg, red, rgb(255, 85, 85));
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
}

.d-button-container {
    width: 100%;
    height: calc(100% - 80px);
    position: absolute;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Button Switch Styles */
.switch {
    display: block;
    width: 150px;
    height: 195px;
    border-radius: 5px;
    padding: 20px;
    perspective: 700px;
    box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px black, inset 0 2px 2px -2px white, inset 0 0 2px 15px #47434c, inset 0 0 2px 22px black;
}

.switch input {
    display: none;
}

.switch .button {
    display: block;
    transition: all 0.3s cubic-bezier(1, 0, 1, 1);
    transform-origin: center center -20px;
    transform: translateZ(20px) rotateX(-25deg);
    transform-style: preserve-3d;
    background-color: #9b0621;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.switch .button::before {
    content: "";
    background: linear-gradient(rgba(255, 255, 255, 0.8) 10%, rgba(255, 255, 255, 0.3) 30%, #650000 75%, #320000) 50% 50%/97% 97%, #b10000;
    background-repeat: no-repeat;
    width: 100%;
    height: 50px;
    transform-origin: top;
    transform: rotateX(-90deg);
    position: absolute;
    top: 0;
}

.switch .button::after {
    content: "";
    background-image: linear-gradient(#650000, #320000);
    width: 100%;
    height: 50px;
    transform-origin: top;
    transform: translateY(50px) rotateX(-90deg);
    position: absolute;
    bottom: 0;
}

.switch .characters {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(90deg);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: 700;
    background-repeat: no-repeat;
}

.switch .shine {
    transition: all 0.3s cubic-bezier(1, 0, 1, 1);
    opacity: 0.3;
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(white, transparent 3%) 50% 50%/97% 97%, 
                linear-gradient(rgba(255, 255, 255, 0.5), transparent 50%, transparent 80%, rgba(255, 255, 255, 0.5)) 50% 50%/97% 97%;
    background-repeat: no-repeat;
}

.switch .shadow {
    transition: all 0.3s cubic-bezier(1, 0, 1, 1);
    opacity: 1;
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent 70%, rgba(0, 0, 0, 0.8));
    background-repeat: no-repeat;
}

.switch input:checked + .button {
    transform: translateZ(20px) rotateX(25deg);
    box-shadow: 0 -10px 20px #ff1818;
}

.switch input:checked + .button .light {
    animation: flicker 0.2s infinite 0.3s;
}

.switch input:checked + .button .shine {
    opacity: 1;
}

.switch input:checked + .button .shadow {
    opacity: 0;
}

.modal-shtype {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.4s ease-out;
}

.shtype-modal-container-main {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content-shtype {
    background: linear-gradient(to bottom right, #ffffff, #f8f8f8);
    margin: auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content-shtype h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: #333;
    text-align: center;
    font-weight: 600;
}

.modal-close-x {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close-x:hover {
    background: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

.offer-container {
    width: 100%;
    border: 1px solid lightgray;
    border-radius: 11px;
    margin-top: 30px;
    margin-bottom: 20px;
    border: none;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.offer-container:hover {
    transform: translateY(-5px);
}

.offer-container-content {
    padding: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

.image-offer-text {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.image-offer-text > img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
}

.offer-text-container > h1 {
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 5px;
}

.offer-text-container > h2 {
    font-size: 0.95rem;
    color: #e53e3e;
    margin: 0;
    text-align: left;
}

.offer-container-content > button {
    min-width: 150px;
    width: 150px !important;
    padding: 10px 20px;
    background-color: red;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(45deg, #e53e3e, #ef5350);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(229,62,62,0.2);
}

.offer-container-content > button:hover {
    background-color: #a00808;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(229,62,62,0.3);
    background: linear-gradient(45deg, #dc2626, #ef5350);
}

.modal.modal-closing {
    animation: fadeOut 0.3s ease-out forwards;
}

.modal.modal-closing .modal-content-shtype {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0) rotate(15deg); }
    50% { transform: translate(-10px, -15px) rotate(20deg); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0) rotate(-25deg); }
    50% { transform: translate(15px, -20px) rotate(-20deg); }
}

@keyframes float3 {
    0%, 100% { transform: translate(0, 0) rotate(40deg); }
    50% { transform: translate(-5px, -25px) rotate(45deg); }
}

@keyframes flicker {
    0% { opacity: 1; }
    80% { opacity: 0.8; }
    100% { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes gradientShift {
    0%, 100% { background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%); }
    50% { background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideOut {
    from { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to { 
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .products-grid {
        gap: 1rem;
    }

    .brand-header {
        height: 200px;
    }

    .product-info {
        display: flex;
        gap: 0.5rem;
    }

    .price-container {
        align-items: flex-start;
    }
    
    .featured-card {
        height: 400px;
    }
    
    .partnership-details {
        font-size: 16px;
        padding: 0 15px;
    }
    
    .switch {
        width: 130px;
        height: 170px;
    }

    .featured-image::before {
        width: 150px;
        height: 150px;
    }

    .featured-image::after {
        width: 100px;
        height: 100px;
    }

    .modal-content-shtype {
        width: 95%;
        margin: 5% auto;
    }
}

@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    }

    .product-card, 
    .featured-card {
        height: 480px;
    }

    .partnership-details {
        font-size: 18px;
    }

    .switch {
        width: 160px;
        height: 200px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 10px;
    }

    .product-card,
    .featured-card {
        height: 350px;
    }

    .product-image {
        height: 300px;
    }
}

@media (max-width: 640px) {
    .modal-content-shtype {
        padding: 20px;
    }

    .offer-container-content {
        flex-direction: column;
        gap: 15px;
    }

    .image-offer-text {
        width: 100%;
    }

    .offer-container-content > button {
        width: 100%;
    }

    .modal-content-shtype h2 {
        font-size: 1.5rem;
    }
}

@supports (animation-timeline: scroll()) {
    .product-card {
        animation: fade-in linear both;
        animation-timeline: view();
        animation-range: entry 20% cover 30%;
    }

    @keyframes fade-in {
        from { 
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
