* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.main-container {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1000px;
    height: auto;
    max-height: none;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 2fr 3fr;
    gap: 15px;
    height: 100%;
    width: 100%;
}

.section-column {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-section {
    width: 100%;
    padding: 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: block !important;
    flex-direction: column;
    height: 100%;
}

.measurement-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group.required label:after {
    content: " *";
    color: #e53e3e;
}

.result-section {
    width: 100%;
    padding: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: none;
    overflow-y: visible;
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 12px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

label {
    display: block;
    margin-bottom: 8px;
    color: #2d3748;
}

input[type="number"],
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #2d3748;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    cursor: pointer;
}

select:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 1px #4299e1;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 5px;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

.customize-btn {
    width: 100%;
    padding: 12px;
    background-color: #38b2ac;
    color: white;
    border: none;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.result {
    background: transparent;
    padding: 5px;
    border-radius: 8px;
    margin-bottom: 3px;
}

.result h2 {
    color: #1a365d;
    font-size: 15px;
    margin-bottom: 4px;
    font-weight: 500;
}

.result.hidden {
    display: none;
}

.size-card {
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    margin-bottom: 3px;
}

.size-card.highlight {
    border: 1px solid #60a5fa;
    background-color: #f0f7ff;
}

.size-result-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.size-result {
    font-size: 16px;
    color: #2d3748;
    font-weight: 500;
}

.best-fit-badge {
    background-color: #60a5fa;
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

#result .size-card:hover {
    box-shadow: 0 2px 4px rgba(96, 165, 250, 0.1);
}

#alternativeResult .size-card {
    background-color: white;
    border: 1px solid #e2e8f0;
}

.size-explanation {
    margin-top: 10px;
    font-size: 14px;
    color: #4a5568;
    font-style: italic;
}

#alternativeResult .size-explanation {
    color: #4a5568;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 15px;
}

.size-details {
    color: #4a5568;
    line-height: 1.6;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: #2d3748;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    background-color: #38b2ac;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
}

.hidden {
    display: none;
}

.product-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: auto;
    min-height: 300px;
    max-height: 80vh;
    overflow-y: auto;
}

.product-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-card.selected {
    border-color: #4299e1;
    background-color: #ebf8ff;
}

.product-icon {
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card h3 {
    margin: 0;
    color: #2d3748;
    font-size: 14px;
    line-height: 1.2;
}

.selected-product {
    display: none;
    align-items: center;
    margin-top: 5px;
    padding: 10px;
    background-color: #f0f9ff;
    border-radius: 6px;
}

.selected-product .product-icon {
    font-size: 28px;
    margin-right: 10px;
}

#selectedProductName {
    font-weight: 600;
    color: #2d3748;
}

.size-reference {
    background: #f7fafc;
    padding: 6px;
    border-radius: 8px;
    margin-top: 2px;
}

.size-reference h2 {
    color: #2d3748;
    margin-bottom: 6px;
    font-size: 15px;
}

.size-chart {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 6px;
    overflow: visible;
    margin-top: 3px;
}

.size-chart table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.size-chart th,
.size-chart td {
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #e2e8f0;
    word-wrap: break-word;
    hyphens: auto;
}

.size-chart tr.highlight {
    background-color: #ebf8ff;
}

.size-chart tr.highlight td {
    background-color: #ebf8ff;
    font-weight: 500;
}

.size-chart tr.alternative-highlight {
    background-color: #faf5ff;
}

.size-chart tr.alternative-highlight td {
    background-color: #faf5ff;
    font-weight: 500;
    color: #6b46c1;
}

/* Form styles for better layout */
#sizeForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#measurementForm {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Mobile styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .main-container {
        padding: 10px;
        margin: 10px;
        max-height: none;
    }

    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Ẩn tất cả section trừ product grid */
    #measurementForm, 
    .result-section {
        display: none;
    }

    /* Hiển thị product grid mặc định */
    #productGrid {
        display: block;
    }

    .section-column.active {
        display: block;
    }

    .product-grid {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    #measurementForm {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    .result-section {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);  /* Tăng từ 3 lên 4 cột trên tablet */
    }
}

.optional-measurements {
    margin: 15px 0;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.optional-measurements h4 {
    margin-bottom: 15px;
    color: #2d3748;
    font-size: 16px;
}

.optional-measurements .measurement-input {
    margin-bottom: 12px;
}

.optional-measurements input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #2d3748;
}
