/* 基本スタイル */
.subtitle {
    text-align: center;
    color: #64748b;
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

/* カテゴリ選択 */
.category-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.category-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    min-width: 80px;
}

.category-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
}

.category-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* 換算セクション */
.converter-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.convert-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: end;
    margin-bottom: 2rem;
}

.convert-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.convert-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.convert-input-group {
    display: flex;
    gap: 0.5rem;
}

.convert-input {
    flex: 2;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: white;
    font-family: 'Courier New', monospace;
}

.convert-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.convert-input:read-only {
    background: #f8fafc;
    color: #059669;
    font-weight: 600;
}

.convert-select {
    flex: 3;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.convert-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* スワップボタン */
.swap-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn {
    padding: 0.75rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: rotate(180deg) scale(1.1);
}

.swap-icon {
    width: 20px;
    height: 20px;
}

/* 結果表示 */
.result-display {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.result-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #15803d;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.copy-result-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-result-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.copy-result-btn.copied {
    background: linear-gradient(135deg, #059669, #047857);
}

.copy-icon {
    width: 14px;
    height: 14px;
}

/* よく使われる換算 */
.common-conversions {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.conversions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.conversion-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversion-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-2px);
}

.conversion-from {
    font-weight: 600;
    color: #374151;
}

.conversion-arrow {
    color: #3b82f6;
    font-weight: bold;
    margin: 0 0.5rem;
}

.conversion-to {
    font-weight: 600;
    color: #059669;
}

/* 単位一覧表 */
.units-reference {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.units-table {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.units-table-header {
    background: #1f2937;
    color: white;
    padding: 1rem;
    display: grid;
    grid-template-columns: 2fr 1fr 3fr;
    gap: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.units-table-row {
    padding: 0.75rem 1rem;
    display: grid;
    grid-template-columns: 2fr 1fr 3fr;
    gap: 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.units-table-row:hover {
    background: #f1f5f9;
}

.units-table-row:last-child {
    border-bottom: none;
}

.unit-name {
    font-weight: 600;
    color: #374151;
}

.unit-symbol {
    font-family: 'Courier New', monospace;
    color: #6b7280;
}

.unit-description {
    color: #4b5563;
}

/* 説明セクション */
.action-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .category-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .category-btn {
        width: 100%;
        min-width: auto;
    }
    
    .convert-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .swap-container {
        order: 3;
    }
    
    .swap-btn {
        transform: rotate(90deg);
    }
    
    .swap-btn:hover {
        transform: rotate(270deg) scale(1.1);
    }
    
    .convert-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .conversions-grid {
        grid-template-columns: 1fr;
    }
    
    .conversion-item {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .conversion-arrow {
        transform: rotate(90deg);
    }
    
    .units-table-header,
    .units-table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: left;
    }
    
    .units-table-header {
        display: none;
    }
    
    .units-table-row {
        padding: 1rem;
        border-bottom: 2px solid #e5e7eb;
    }
    
    .unit-name::before {
        content: "単位: ";
        font-weight: 400;
        color: #6b7280;
    }
    
    .unit-symbol::before {
        content: "記号: ";
        font-weight: 400;
        color: #6b7280;
    }
    
    .unit-description::before {
        content: "説明: ";
        font-weight: 400;
        color: #6b7280;
    }
}

@media (max-width: 480px) {
    .category-section,
    .converter-section,
    .common-conversions,
    .units-reference,
    .action-section {
        padding: 1.5rem;
    }
    
    .convert-input,
    .convert-select {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .result-text {
        font-size: 1rem;
    }
    
    .conversion-item {
        padding: 0.75rem;
    }
    
    .units-table-row {
        padding: 0.75rem;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.conversion-item,
.units-table-row {
    animation: fadeIn 0.3s ease-out;
}

/* エラー状態 */
.convert-input.error {
    border-color: #ef4444;
    background: #fef2f2;
}

/* ローディング状態 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 小数点以下の桁数調整 */
.convert-input[readonly] {
    font-size: 0.95rem;
}