* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Mitr', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 768px) {
    body {
        padding: 5px;
        align-items: flex-start;
    }
}

.container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 100%;
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
    margin: 10px 0;
}

@media (max-width: 768px) {
    .container {
        border-radius: 16px;
        margin: 5px 0;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

@media (max-width: 768px) {
    .header {
        padding: 25px 20px;
    }

    .header h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .header p {
        font-size: 0.95rem;
    }
}

.content {
    padding: 25px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}

.left-panel {
    display: flex;
    flex-direction: column;
}

.right-panel {
    display: flex;
    flex-direction: column;
}

.card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon {
    font-size: 1.5rem;
}

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

    .card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .card:hover {
        transform: none;
    }

    .card-title {
        font-size: 1.05rem;
        margin-bottom: 10px;
    }

    .icon {
        font-size: 1.3rem;
    }
}

.input-group {
    margin-bottom: 12px;
}

.input-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.input-field {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

@media (max-width: 768px) {
    .input-group {
        margin-bottom: 10px;
    }

    .input-label {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }

    .input-field {
        padding: 10px 12px;
        font-size: 16px;
        /* Important: 16px prevents zoom on iOS */
        border-radius: 8px;
    }
}

.time-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 10px;
}

.time-input-wrapper {
    display: flex;
    flex-direction: column;
}

.time-input-wrapper label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.time-input-wrapper input {
    padding: 8px;
    font-size: 1rem;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.time-input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

@media (max-width: 768px) {
    .time-inputs {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .time-input-wrapper label {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .time-input-wrapper input {
        padding: 8px;
        font-size: 16px;
        /* Important: 16px prevents zoom on iOS */
        border-radius: 8px;
    }
}

select.input-field {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23667eea' 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 12px center;
    background-size: 20px;
    padding-right: 45px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 6px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.quantity-btn {
    width: 35px;
    height: 35px;
    border: none;
    background: #667eea;
    color: white;
    font-size: 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.quantity-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-display {
    flex: 1;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

@media (max-width: 768px) {
    .quantity-control {
        gap: 10px;
        padding: 6px;
        border-radius: 10px;
    }

    .quantity-btn {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
        border-radius: 10px;
    }

    .quantity-btn:hover {
        transform: none;
    }

    .quantity-display {
        font-size: 1.6rem;
    }
}

.calculate-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .calculate-btn {
        padding: 16px;
        font-size: 1.1rem;
        border-radius: 12px;
        margin-top: 5px;
    }

    .calculate-btn:hover {
        transform: none;
    }
}

.result-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    color: white;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    animation: fadeInScale 0.5s ease-out;
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.3);
    height: 100%;
    font-family: 'Sarabun', sans-serif;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-label {
    font-size: 0.95rem;
    opacity: 0.95;
    margin-bottom: 2px;
}

.result-price {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    word-break: break-all;
    font-family: 'Sarabun', sans-serif;
}

.result-breakdown {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    opacity: 0.9;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    gap: 10px;
}

@media (max-width: 768px) {
    .result-card {
        padding: 15px 12px;
        border-radius: 10px;
    }

    .result-label {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    .result-price {
        font-size: 1.8rem;
        margin: 2px 0;
    }

    .result-breakdown {
        margin-top: 8px;
        padding-top: 8px;
        font-size: 0.8rem;
    }

    .breakdown-item {
        margin: 3px 0;
        font-size: 0.8rem;
    }
}

.footer {
    text-align: center;
    padding: 10px 20px;
    color: #999;
    font-size: 0.9rem;
}

.info-badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .footer {
        padding: 15px 10px;
        font-size: 0.8rem;
        line-height: 1.6;
    }

    .info-badge {
        padding: 4px 10px;
        font-size: 0.75rem;
        margin-top: 8px;
    }

    .result-price {
        font-size: 2.5rem;
    }

    .time-inputs {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    white-space: nowrap;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Support Box */
.support-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin: 0 20px 20px 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    animation: slideIn 0.5s ease-out 0.2s both;
}

.support-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 12px;
}

.support-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.support-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tipme-btn {
    background: #FF9800;
    color: white;
}

.tipme-btn:hover {
    background: #F57C00;
    transform: translateY(-2px);
}

.promptpay-btn {
    background: #113566;
    color: white;
}

.promptpay-btn:hover {
    background: #0c2547;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .support-card {
        padding: 15px;
        margin: 0 10px 15px 10px;
    }

    .support-title {
        font-size: 0.9rem;
    }

    .support-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

#inlineQrContainer {
    animation: fadeInScale 0.3s ease-out;
}

/* ====== TAB SWITCHER ====== */
.tab-switcher {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 20px;
}

.tab-btn {
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.tab-btn:hover:not(.active) {
    color: #555;
    background: rgba(102, 126, 234, 0.05);
}

@media (max-width: 768px) {
    .tab-switcher {
        padding: 0 10px;
    }

    .tab-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
        flex: 1;
        text-align: center;
    }
}

/* ====== RESIN RESULT CARD THEME ====== */
.result-card.resin {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.35);
}

.resin-calc-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 8px 20px rgba(79, 172, 254, 0.3);
}

.resin-calc-btn:hover {
    box-shadow: 0 12px 28px rgba(79, 172, 254, 0.45);
}

/* ====== RESIN PRICE PER ML DISPLAY ====== */
.resin-price-per-ml {
    font-size: 0.82rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: right;
}