* {
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Roboto', 'Helvetica', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #faf8f2;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    line-height: 1.6;
}

/* ---------- Language selector ---------- */
.language-selector {
    margin-bottom: 20px;
    text-align: center;
}

.language-selector h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.language-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 800px;
    margin: 0 auto;
}

.language-links a {
    padding: 5px 10px;
    background: #ffffff;
    border: 1px solid #e5e0d5;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: background-color 0.2s, border-color 0.2s;
}

.language-links a:hover {
    background: #f2efe8;
    border-color: #d8d2c6;
}

/* ---------- Header ---------- */
.header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e0d5;
    top: 0;
    margin-bottom: 10px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    color: #222;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #555;
    padding: 10px;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #2563eb;
}

/* ---------- Hamburger ---------- */
.hamburger {
    display: none;
    cursor: pointer;
    padding: 10px;
    width: 30px;
    height: 30px;
    position: relative;
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.hamburger:hover,
.hamburger:active,
.hamburger:focus {
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
}

.hamburger-lines {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #666;
    position: relative;
    transition: background-color 0.3s ease;
}

.hamburger-lines::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: #666;
    top: -6px;
    left: 0;
    transition: transform 0.3s ease;
}

.hamburger-lines::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: #666;
    bottom: -6px;
    left: 0;
    transition: transform 0.3s ease;
}

.hamburger.active .hamburger-lines {
    background-color: transparent;
}

.hamburger.active .hamburger-lines::before {
    transform: rotate(45deg);
    top: 0;
}

.hamburger.active .hamburger-lines::after {
    transform: rotate(-45deg);
    bottom: 0;
}

/* ---------- Layout ---------- */
.container {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: auto;
    padding: 20px;
    width: 100%;
    flex-grow: 1;
    align-items: flex-start;
}

/* ---------- Sidebar ---------- */
.sidebar {
    flex: 0 0 300px;
    background-color: #ffffff;
    color: #333;
    padding: 20px;
    border-radius: 8px;
    margin-left: 30px;
    border: 1px solid #e5e0d5;
    align-self: flex-start;
}

.sidebar h3 {
    margin-top: 0;
    font-size: 18px;
    text-align: center;
    border-bottom: 2px solid #e5e0d5;
    padding-bottom: 10px;
    color: #222;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
}

.sidebar ul li {
    margin-bottom: 10px;
}

.sidebar ul li a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    display: block;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar ul li a:hover {
    background-color: #f2efe8;
    color: #2563eb;
}

/* ---------- Tables ---------- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: #ffffff;
    border: 1px solid #e5e0d5;
    border-radius: 8px;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0ece3;
    color: #333;
}

th {
    background-color: #faf8f2;
    font-weight: bold;
    color: #222;
}

/* ---------- Calculator container ---------- */
.calculator-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e5e0d5;
    border-radius: 8px;
}

.measurement-input {
    margin-bottom: 20px;
}

.measurement-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.measurement-input input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e0d5;
    border-radius: 4px;
    font-size: 16px;
    background: #ffffff;
    color: #333;
}

.calc-btn {
    width: 100%;
    padding: 15px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.calc-btn:hover {
    background: #1d4ed8;
}

.result-container {
    margin-top: 20px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e5e0d5;
    border-radius: 8px;
    text-align: center;
}

.calculator-container input {
    padding: 10px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid #e5e0d5;
    font-size: 1em;
    color: #333;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.calculator-container input:focus {
    border-color: #2563eb;
    outline: none;
}

/* ---------- Content ---------- */
.content {
    flex: 1;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e5e0d5;
}

h1 {
    margin-top: 0;
    font-size: 26px;
    margin-bottom: 20px;
    color: #222;
}

#info {
    margin-top: 40px;
}

#info h2 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #222;
}

#info h3 {
    font-size: 18px;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #333;
}

#info p {
    font-size: 16px;
    margin-top: 10px;
    margin-bottom: 15px;
    color: #555;
}

#info ol,
#info ul {
    padding-left: 0;
    margin-left: 0;
    list-style-position: inside;
}

#info ol li,
#info ul li {
    padding-left: 0;
    margin-left: 0;
    color: #555;
}

/* ---------- Calculator cards ---------- */
.calculator-cards {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.calculator-cards ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.calculator-cards li {
    background: #ffffff;
    border: 1px solid #e5e0d5;
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.calculator-cards li a {
    display: block;
    padding: 20px;
    color: #333;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
    position: relative;
}

.calculator-cards li:hover {
    border-color: #2563eb;
}

/* ---------- Radio & checkbox ---------- */
.conversion-options {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    justify-content: center;
}

.radio-group {
    position: relative;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-group label {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    background-color: #faf8f2;
    color: #555;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
    user-select: none;
}

.radio-group input[type="radio"]:checked + label {
    background-color: #eaf1fd;
    color: #2563eb;
    border-color: #2563eb;
}

.radio-group label:hover {
    background-color: #f2efe8;
}

.radio-group input[type="radio"]:focus + label {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.radio-group input[type="radio"]:active + label {
    transform: scale(0.98);
}

.radio-group input[type="radio"]:disabled + label {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #2563eb;
    border-radius: 4px;
    margin-right: 10px;
    cursor: pointer;
    position: relative;
    background: #ffffff;
}

.input-group input[type="checkbox"]:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.input-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 15px;
}

.footer p {
    padding: 3px;
    font-size: 0.8em;
    color: #888;
}

.footer p a {
    color: #888;
    text-decoration: none;
    padding: 10px;
}

/* ---------- Product table ---------- */
.product-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.product-table th,
.product-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f0ece3;
}

.product-table th {
    background-color: #faf8f2;
    color: #222;
}

.product-table-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    transition: transform 0.2s;
}

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

.table-amazon-button {
    display: inline-block;
    padding: 8px 15px;
    background-color: #FF9900;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
    text-align: center;
}

.table-amazon-button:hover {
    background-color: #FF8800;
}

.product-title {
    color: #333;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    max-height: 2.8em;
    margin-bottom: 10px;
    text-overflow: ellipsis;
}

.product-title:hover {
    color: #2563eb;
}

.number-cell {
    font-weight: bold;
    color: #888;
    width: 50px;
}

.image-cell {
    width: 170px;
}

.button-cell {
    width: 150px;
}

/* ---------- Likert scale ---------- */
.likert-scale {
    display: flex;
    justify-content: space-between;
    margin: 1.5rem 0;
    gap: 10px;
}

.likert-option {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #e5e0d5;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #faf8f2;
    color: #555;
}

.likert-option:hover {
    background-color: #f2efe8;
}

.likert-option.selected {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
    font-weight: bold;
}

@media (max-width: 768px) {
    .likert-scale {
        flex-direction: column;
        gap: 8px;
    }

    .likert-option {
        padding: 10px;
    }
}

/* ---------- Quiz / gender ---------- */
.gender-selection {
    margin: 2rem 0;
    text-align: center;
}

.gender-btn {
    padding: 0.8rem 1.6rem;
    margin: 0 0.5rem;
    background-color: #ffffff;
    border: 2px solid #e5e0d5;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.gender-btn:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

.gender-btn.selected {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

.quiz-container {
    display: none;
    max-width: 800px;
    margin: 0 auto;
}

.question {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: #ffffff;
    border: 1px solid #e5e0d5;
    border-radius: 8px;
}

.question h3 {
    color: #222;
    margin-bottom: 1rem;
}

/* ---------- Options (label style) ---------- */
.options label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #ffffff;
    border: 2px solid #e5e0d5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.options label:hover {
    background: #faf8f2;
    border-color: #2563eb;
}

.options input[type="radio"] {
    display: none;
}

.options input[type="radio"]:checked + span::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 12px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

.options span::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 12px;
    border: 2px solid #d8d2c6;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.options input[type="radio"]:checked + span {
    color: #2563eb;
    font-weight: 600;
}

.options input[type="radio"]:checked ~ label {
    background: #eaf1fd;
    border-color: #2563eb;
}

@media (max-width: 768px) {
    .options label {
        padding: 10px 12px;
        font-size: 14px;
    }

    .options span::before {
        width: 18px;
        height: 18px;
        margin-right: 10px;
    }
}

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

.options input[type="radio"]:checked + span::before {
    animation: pulse 0.3s ease;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.option {
    padding: 0.8rem 1rem;
    background-color: #faf8f2;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    color: #333;
}

.option:hover {
    background-color: #f2efe8;
}

.option.selected {
    background-color: #2563eb;
    color: white;
    border-left-color: #2563eb;
}

/* ---------- Result ---------- */
#result {
    display: none;
    padding: 2rem;
    background-color: #ffffff;
    border: 1px solid #e5e0d5;
    border-radius: 8px;
    margin-top: 2rem;
}

.type-description {
    margin-top: 1.5rem;
    line-height: 1.6;
    color: #333;
}

.type-description h3 {
    color: #2563eb;
    margin: 1.2rem 0 0.5rem;
}

.calc-btn {
    display: block;
    margin: 1.5rem auto;
    padding: 0.8rem 2rem;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.2s ease;
    width: fit-content;
}

.calc-btn:hover {
    background-color: #1d4ed8;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
    .gender-selection {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .gender-btn {
        margin: 0;
        width: 100%;
        padding: 1rem;
    }

    .options {
        flex-direction: column;
    }

    .option {
        padding: 1rem;
    }

    .question {
        padding: 1.2rem;
        margin: 1.2rem 0;
    }

    #result {
        padding: 1.5rem;
    }

    .calc-btn {
        width: 100%;
        padding: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .options {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

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

.question {
    animation: fadeIn 0.4s ease-out;
}

#result {
    animation: fadeIn 0.6s ease-out;
}

/* ---------- Progress ---------- */
.progress-container {
    width: 100%;
    background-color: #f0ece3;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.progress-bar {
    height: 0.5rem;
    background-color: #2563eb;
    border-radius: 0.5rem;
    width: 0%;
    transition: width 0.4s ease, background-color 0.3s ease;
}

/* ---------- Responsive header/layout ---------- */
@media (max-width: 900px) {
    .header {
        margin-bottom: 0;
    }

    .logo {
        font-size: 20px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        right: 0;
        background-color: #ffffff;
        border: 1px solid #e5e0d5;
        width: 200px;
        padding: 20px;
    }

    .nav-links.active {
        display: block;
    }

    .nav-links a {
        display: block;
        padding: 10px;
    }

    .hamburger {
        display: block;
    }

    .container {
        flex-direction: column;
        padding: 15px;
        margin: 0;
    }

    .sidebar {
        flex: 0 0 auto;
        margin-left: 0;
        margin-top: 20px;
        width: 100%;
        max-width: 100%;
        order: 1;
        padding: 15px;
    }

    .content {
        order: 0;
        margin-bottom: 20px;
        padding: 20px;
        width: 100%;
        max-width: 100%;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .sidebar h3 {
        font-size: 16px;
    }

    #info h2 {
        font-size: 18px;
    }

    #info h3 {
        font-size: 1em;
    }

    label,
    select,
    button {
        font-size: 16px;
    }

    select,
    button {
        padding: 8px;
    }

    #result-name {
        font-size: 28px;
    }

    #common-link h2 {
        font-size: 18px;
    }

    #common-link li {
        flex: 1 0 calc(50% - 10px);
    }
}

@media (max-width: 768px) {
    .calculator-cards ul {
        grid-template-columns: 1fr;
    }

    .calculator-cards {
        padding: 10px;
    }

    .size-option {
        padding: 8px 15px;
        min-width: 70px;
    }

    .primary-size {
        font-size: 2.5em;
    }

    .product-table thead {
        display: none;
    }

    .product-table,
    .product-table tbody,
    .product-table tr,
    .product-table td {
        display: block;
        width: 100%;
        text-align: center;
    }

    .product-table tr {
        margin-bottom: 30px;
        border: 1px solid #e5e0d5;
        border-radius: 8px;
        padding: 15px;
        background: #ffffff;
    }

    .product-table td {
        border: none;
        padding: 8px;
    }

    .number-cell {
        font-size: 1.2em;
        color: #FF9900;
        margin-bottom: 10px;
    }

    .image-cell {
        margin: 0 auto;
    }

    .product-table-image {
        width: 200px;
        height: 200px;
        margin: 0 auto;
    }

    .product-title {
        font-size: 1.1em;
        margin: 15px 0;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .button-cell {
        margin-top: 15px;
    }

    .table-amazon-button {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        padding: 12px 20px;
    }

    .number-cell::before {
        content: "#";
    }
}

@media (max-width: 480px) {
    .product-table-image {
        width: 150px;
        height: 150px;
    }

    .product-table tr {
        padding: 10px;
    }

    .product-title {
        font-size: 1em;
        max-width: 250px;
    }
}

/* ---------- Option buttons (quiz options) ---------- */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.option-btn {
    display: block;
    width: 100%;
    padding: 14px 18px;
    text-align: left;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    background: #ffffff;
    border: 2px solid #e5e0d5;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.option-btn:hover {
    border-color: #2563eb;
    background: #faf8f2;
}

.option-btn:active {
    transform: scale(0.99);
}

.option-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.option-btn.selected {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.option-btn:disabled {
    cursor: default;
    opacity: 0.85;
}

.option-btn:disabled:not(.selected) {
    opacity: 0.4;
}

@media (max-width: 600px) {
    .option-btn {
        padding: 12px 14px;
        font-size: 0.95rem;
    }
}
