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

body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* 左側選單 */
.sidebar {
    width: 200px;
    background-color: #2c3e50;
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar h2 {
    margin-bottom: 20px;
    text-align: center;
    color: #ecf0f1;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-item {
    background-color: #34495e;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-align: left;
}

.menu-item:hover {
    background-color: #3498db;
    transform: translateX(5px);
}

.menu-item.active {
    background-color: #e74c3c;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* 右側計算器 */
.calculator {
    flex: 1;
    margin-left: 200px;
    padding: 20px;
    background-color: white;
    min-height: 100vh;
}

.calculator h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.2em;
    border-bottom: 3px solid #3498db;
    padding-bottom: 15px;
}

.converter-container {
    max-width: 600px;
    margin: 0 auto;
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.input-group,
.unit-group,
.result-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 16px;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

input[type="text"] {
    background-color: #ecf0f1;
    color: #2c3e50;
    font-weight: bold;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
    margin-top: 10px;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

#clear-btn {
    background-color: #e74c3c;
}

#clear-btn:hover {
    background-color: #c0392b;
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* 單位表格容器 */
.units-table-container {
    margin-top: 20px;
}

#current-type-title {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.4em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.units-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.unit-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    min-height: 60px;
}

.unit-row:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
}

.unit-row.metric {
    background-color: #e8f5e8;
    border-color: #27ae60;
}

.unit-row.imperial {
    background-color: #fff3cd;
    border-color: #f39c12;
}

.unit-label {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-right: 15px;
    font-weight: bold;
    min-width: 80px;
    text-align: left;
}

.unit-input {
    flex: 1;
    max-width: 200px;
    padding: 10px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    transition: border-color 0.3s ease;
    background-color: white;
    margin-right: 15px;
}

.unit-symbol {
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

.unit-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.unit-input.metric:focus {
    border-color: #27ae60;
    box-shadow: 0 0 5px rgba(39, 174, 96, 0.3);
}

.unit-input.imperial:focus {
    border-color: #f39c12;
    box-shadow: 0 0 5px rgba(243, 156, 18, 0.3);
}

/* 響應式單位表格 */
@media (max-width: 768px) {
    .unit-row {
        padding: 12px;
        min-height: 50px;
    }
    
    .unit-label {
        min-width: 60px;
        font-size: 0.8em;
        margin-right: 10px;
    }
    
    .unit-input {
        max-width: 150px;
        padding: 8px;
        font-size: 14px;
        margin-right: 10px;
    }
    
    .unit-symbol {
        min-width: 30px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .unit-row {
        flex-direction: column;
        align-items: flex-start;
        min-height: auto;
        padding: 10px;
    }
    
    .unit-label {
        margin-right: 0;
        margin-bottom: 5px;
        min-width: auto;
    }
    
    .unit-input {
        width: 100%;
        max-width: none;
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .unit-symbol {
        margin-bottom: 0;
        min-width: auto;
    }
}

/* 語意化標籤樣式調整 */
nav.sidebar {
    /* 保持原有sidebar樣式 */
}

main.calculator {
    /* 保持原有calculator樣式 */
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 15px;
    }
    
    .menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .menu-item {
        flex: 1;
        min-width: 80px;
        text-align: center;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .calculator {
        margin-left: 0;
        padding: 15px;
    }
    
    .calculator h1 {
        font-size: 1.8em;
    }
    
    .converter-container {
        padding: 20px;
    }
    
    .intro-section {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .intro-section h1 {
        font-size: 1.8em;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .feature-item {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .menu {
        flex-direction: column;
    }
    
    .menu-item {
        flex: none;
        width: 100%;
    }
    
    .calculator h1 {
        font-size: 1.5em;
    }
    
    .converter-container {
        padding: 15px;
    }
    
    button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .intro-section {
        padding: 15px;
    }
    
    .intro-section h1 {
        font-size: 1.5em;
    }
    
    .features-section h2 {
        font-size: 1.5em;
    }
}
