/* ========================================
   グローバルスタイル
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* カラーパレット */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #a78bfa;
    --accent-color: #ec4899;
    --success-color: #10b981;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 80px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   ヘッダー
======================================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.logo i {
    font-size: 32px;
}

.reset-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ========================================
   メインコンテンツ
======================================== */
.main-content {
    padding: 40px 0;
}

/* ========================================
   ステップインジケーター
======================================== */
.step-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.step-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.step.active .step-circle {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.step.completed .step-circle {
    background: var(--success-color);
    color: white;
}

.step-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.step.active .step-label {
    color: var(--primary-color);
}

.step-line {
    flex: 1;
    height: 3px;
    background: var(--border-color);
    margin: 0 10px;
    position: relative;
    top: -30px;
}

/* ========================================
   セクションカード
======================================== */
.section {
    margin-bottom: 30px;
}

.section-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title i {
    color: var(--primary-color);
}

/* ========================================
   アップロードエリア
======================================== */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    background: var(--background);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
}

.upload-placeholder i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.upload-placeholder p {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.image-preview {
    position: relative;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.change-image-btn {
    margin-top: 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.change-image-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ========================================
   歯形スタイルグリッド
======================================== */
.tooth-style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tooth-style-item {
    background: var(--background);
    border: 3px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tooth-style-item:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.tooth-style-item.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(167, 139, 250, 0.1) 100%);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.tooth-style-icon {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.tooth-style-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tooth-style-description {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========================================
   シェードガイド
======================================== */
.shade-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.shade-tab {
    flex: 1;
    min-width: 150px;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.shade-tab:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
}

.shade-tab.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: transparent;
}

.shade-guide {
    margin-bottom: 30px;
}

.shade-category-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.shade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.shade-item {
    aspect-ratio: 1;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.shade-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.shade-item.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.shade-label {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
    z-index: 1;
}

/* ========================================
   ボタン
======================================== */
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

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

.button-group {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ========================================
   処理中オーバーレイ
======================================== */
.processing-overlay {
    text-align: center;
    padding: 80px 40px;
}

.processing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 6px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.processing-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.processing-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   比較表示
======================================== */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 30px;
}

.comparison-item {
    text-align: center;
}

.comparison-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding: 8px 16px;
    background: var(--background);
    border-radius: 8px;
}

.comparison-item img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.comparison-arrow {
    font-size: 32px;
    color: var(--primary-color);
}

/* ========================================
   サマリーボックス
======================================== */
.summary-box {
    background: var(--background);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 30px;
}

.summary-box h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-item {
    display: flex;
    gap: 12px;
}

.summary-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.summary-value {
    font-weight: 700;
    color: var(--primary-color);
}

/* ========================================
   フッター
======================================== */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 30px 20px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

.footer p {
    margin: 8px 0;
    font-size: 14px;
}

.footer-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    opacity: 0.9;
}

/* ========================================
   レスポンシブデザイン
======================================== */
@media (max-width: 768px) {
    .step-indicator {
        padding: 20px 15px;
    }

    .step-circle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .step-label {
        font-size: 11px;
    }

    .step-line {
        margin: 0 5px;
        top: -26px;
    }

    .section-card {
        padding: 24px;
    }

    .section-title {
        font-size: 22px;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-placeholder i {
        font-size: 48px;
    }

    .tooth-style-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }

    .tooth-style-item {
        padding: 16px;
    }

    .tooth-style-icon {
        font-size: 36px;
    }

    .tooth-style-name {
        font-size: 14px;
    }

    .tooth-style-description {
        font-size: 12px;
    }

    .shade-tabs {
        flex-direction: column;
    }

    .shade-tab {
        width: 100%;
    }

    .shade-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 8px;
    }

    .comparison-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .comparison-arrow {
        transform: rotate(90deg);
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .logo {
        font-size: 20px;
    }

    .logo i {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .section-card {
        padding: 20px;
    }

    .section-title {
        font-size: 20px;
    }

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

    .shade-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}