/* CSS Reset และ Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #222e50;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    min-height: 100vh;
    padding: 10px;
}

/* Container */
.container {
    max-width: 420px;
    margin: 0 auto;
    background: #f8fafc;
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(30, 64, 175, 0.10);
    overflow: hidden;
    min-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: #fff;
    text-align: center;
    padding: 18px 10px;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: 0.5px;
}

.header p {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main {
    flex: 1;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Calculator Card */
.calculator-card {
    background: #fff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    font-size: 16px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #4facfe;
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.input-group input[type="number"] {
    padding-right: 60px;
}

.unit {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-weight: 500;
    pointer-events: none;
    margin-top: 14px;
}

/* Buttons */
.calculate-btn,
.clear-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-bottom: 15px;
}

.calculate-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.3);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

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

.clear-btn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e9ecef;
}

.clear-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Result Section */
.result-section {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.result-section.hidden {
    display: none;
}

.result-section h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 600;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.result-label {
    font-weight: 500;
    color: #4a5568;
}

.result-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

/* Info Box */
.info-box {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #4facfe;
}

.info-box p {
    margin-bottom: 5px;
    color: #4a5568;
    font-size: 14px;
}

/* Info Card */
.info-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border-left: 5px solid #4facfe;
}

.info-card h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 600;
}

.info-card ul {
    list-style: none;
}

.info-card li {
    padding: 8px 0;
    color: #4a5568;
    font-size: 14px;
    position: relative;
    padding-left: 20px;
}

.info-card li:before {
    content: "•";
    color: #4facfe;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.info-card strong {
    color: #2d3748;
}

/* Footer */
.footer {
    background: #1e3a8a;
    text-align: center;
    padding: 10px 0;
    color: #fff;
    font-size: 13px;
    border-top: none;
    margin-top: auto;
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .header {
        padding: 25px 15px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .main {
        padding: 20px 15px;
    }
    
    .calculator-card {
        background: #e0e7ff;
        border-radius: 12px;
        padding: 18px;
        box-shadow: 0 6px 18px rgba(30, 64, 175, 0.07);
        border: 1px solid #c7d2fe;
    }
    .header h1 {
        font-size: 22px;
    }
    
    .result-value {
        font-size: 20px;
    }
    
    .calculate-btn,
    .clear-btn {
        font-size: 16px;
        padding: 15px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section:not(.hidden) {
    animation: fadeIn 0.5s ease-out;
}

/* Dark mode support for system preference */
@media (prefers-color-scheme: dark) {
    /* Keep light theme for better readability on mobile */
}