/* 色変換ツール専用スタイル */

:root {
    --container-max: 1200px;
    --radius-lg: 12px;
    --primary-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-white: #ffffff;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-primary: 0 4px 20px rgba(102, 126, 234, 0.3);
}

body {
    background: var(--bg-white);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    background: var(--primary-grad);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-primary);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.tool-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-card);
    border: 1px solid #e2e8f0;
}

/* カラープレビューセクション */
.color-preview-section {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-card);
}

.color-preview {
    width: 150px;
    height: 150px;
    border-radius: var(--radius-lg);
    background: #ff0000;
    border: 3px solid #e2e8f0;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.color-info {
    flex: 1;
}

.color-info h3 {
    color: #2d3748;
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-info p {
    color: #718096;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* 変換セクション */
.converter-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.format-panel {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.format-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.format-panel h3 {
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 入力グループ */
.input-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.input-group input[type="text"],
.input-group select {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    outline: none;
    background: var(--bg-white);
    transition: all 0.2s ease;
}

.input-group input[type="text"]:focus,
.input-group select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group input[readonly] {
    background: #f8fafc;
    color: #4a5568;
}

/* RGB/HSL/HSV 入力セクション */
.rgb-inputs,
.hsl-inputs,
.hsv-inputs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.rgb-input,
.hsl-input,
.hsv-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.rgb-input label,
.hsl-input label,
.hsv-input label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
}

.rgb-input input,
.hsl-input input,
.hsv-input input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    text-align: center;
    font-weight: 600;
    outline: none;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.rgb-input input:focus,
.hsl-input input:focus,
.hsv-input input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.unit {
    font-size: 0.8rem;
    color: #718096;
    margin-top: -0.25rem;
    font-weight: 500;
}

/* HTML色セクション */
.html-color-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.html-color-section select {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
}

.html-color-section select option {
    padding: 0.5rem;
}

/* ボタンスタイル */
.copy-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 80px;
}

.copy-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

/* ツールセクション */
.tools-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.tool-panel {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: all 0.3s ease;
}

.tool-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.tool-panel h3 {
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#colorPicker {
    width: 120px;
    height: 60px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
}

#colorPicker:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.generate-btn,
.clear-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.generate-btn {
    background: var(--primary-grad);
    color: white;
    box-shadow: var(--shadow-primary);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.clear-btn {
    background: #e53e3e;
    color: white;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.clear-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
}

/* カラー履歴 */
.color-history {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 50px;
    justify-content: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
}

.history-item {
    width: 35px;
    height: 35px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: scale(1.1);
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* プリセットセクション */
.presets-section {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
}

.presets-section h3 {
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.preset-item {
    height: 80px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
    border: 3px solid transparent;
    font-size: 0.9rem;
}

.preset-item:hover {
    transform: translateY(-2px);
    border-color: #2d3748;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* 情報セクション */
.info-section {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f4dd 100%);
    border: 2px solid #48bb78;
    padding: 2rem;
    border-radius: var(--radius-lg);
}

.info-section h3 {
    color: #2f855a;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.info-item {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid #e2e8f0;
}

.info-item h4 {
    color: #2f855a;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.info-item p {
    color: #2f855a;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* メッセージスタイル */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.message.error {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header {
        margin-bottom: 2rem;
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tool-card {
        padding: 1.5rem;
    }
    
    .color-preview-section {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .color-preview {
        width: 120px;
        height: 120px;
    }
    
    .converter-section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .format-panel {
        padding: 1.25rem;
    }
    
    .tools-section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tool-panel {
        padding: 1.25rem;
    }
    
    .rgb-inputs,
    .hsl-inputs,
    .hsv-inputs {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .preset-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    .preset-item {
        height: 60px;
        font-size: 0.8rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .info-item {
        padding: 1.25rem;
    }
    
    .presets-section,
    .info-section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }
    
    header {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .tool-card {
        padding: 1rem;
    }
    
    .color-preview-section {
        padding: 1rem;
    }
    
    .color-preview {
        width: 100px;
        height: 100px;
    }
    
    .format-panel,
    .tool-panel,
    .info-item {
        padding: 1rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .copy-btn {
        width: 100%;
    }
    
    .rgb-input input,
    .hsl-input input,
    .hsv-input input {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    #colorPicker {
        width: 100px;
        height: 50px;
    }
    
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preset-item {
        height: 50px;
        font-size: 0.7rem;
    }
    
    .color-history {
        padding: 0.5rem;
    }
    
    .history-item {
        width: 30px;
        height: 30px;
    }
    
    .presets-section,
    .info-section {
        padding: 1rem;
    }
    
    .message {
        right: 10px;
        left: 10px;
        top: 10px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}