:root {
    --primary: #d32f2f;
    --primary-hover: #b71c1c;
    --primary-light: rgba(211, 47, 47, 0.05);
    --bg: #f8f9fa;
    --text: #212529;
    --sub: #868e96;
    --card: #ffffff;
    --border: #e9ecef;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 240px;
}

header {
    background: #1a1a1a;
    color: #fff;
    padding: 40px 20px;
    text-align: center;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

header p {
    font-size: 0.9rem;
    color: #adb5bd;
    font-weight: 400;
}

.order-period-badge {
    display: inline-block;
    margin-top: 15px;
    padding: 6px 18px;
    background: var(--primary);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.3);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.order-period-badge:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(211, 47, 47, 0.4);
    color: #fff;
}

.container {
    max-width: 600px;
    margin: -30px auto 0;
    padding: 0 20px;
}

.input-card {
    background: var(--card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group {
    display: flex;
    gap: 8px;
    padding: 4px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    background: #fff;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-fetch {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    white-space: nowrap;
}

#loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--sub);
    font-weight: 600;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

.product-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    transition: transform 0.2s;
}

.product-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.product-img {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    background: #f1f3f5;
    object-fit: cover;
    flex-shrink: 0;
}

.product-main-info {
    flex: 1;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 4px;
    line-height: 1.4;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.main-price {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--primary);
}


.product-desc {
    font-size: 0.8rem;
    color: #666;
    background: #fdfdfd;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    margin-top: 5px;
    line-height: 1.5;
}

.selector-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.selector-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--sub);
    text-transform: uppercase;
}

.type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.type-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
}

.type-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.type-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.opt-select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    background: #fff;
    cursor: pointer;
}

.opt-select:focus {
    border-color: var(--primary);
}

.btn-toggle {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    background: #f1f3f5;
    color: #495057;
}

.btn-toggle.selected {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.2);
}

.btn-toggle:disabled {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}

.floating-cart {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    padding: 16px;
    border-radius: 28px 28px 0 0;
    z-index: 1000;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom, 24px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.floating-cart.visible {
    transform: translateX(-50%) translateY(0);
}

.floating-cart.collapsed {
    transform: translateX(-50%) translateY(calc(100% - 74px));
}

@media (max-width: 400px) {
    body {
        padding: 12px;
        padding-bottom: 160px;
    }

    header {
        padding: 30px 15px;
        border-radius: 0 0 24px 24px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 14px;
        margin-bottom: 16px;
        border-radius: 20px;
    }

    .card-title {
        font-size: 1.05rem;
    }

    .btn-toggle {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 12px;
    }

    .floating-cart {
        border-radius: 24px 24px 0 0;
    }

    .cart-calc-text {
        font-size: 0.85rem;
    }
}


.cart-toggle-btn {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 24px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cart-breakdown {
    margin-bottom: 15px;
    text-align: right;
}

.shipping-info-box {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
    background: var(--primary-light);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
    display: inline-block;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.total-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sub);
}

.total-price {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
}

.btn-share {
    background: #FEE500;
    color: #3c1e1e;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s;
}

.btn-share:hover {
    background: #fada00;
}

.sold-out-badge {
    color: var(--sub);
    font-weight: 700;
    margin-right: 5px;
}

.grass-fed-only {
    font-size: 0.85rem;
    font-weight: 800;
    color: #2e7d32;
    background: #e8f5e9;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
}
