/* ===========================================
   jnm-video - ヒアリング型動画生成UI
   =========================================== */

:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-secondary: #64748b;
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-background: #0f172a;
    --color-surface: #1e293b;
    --color-surface-light: #334155;
    --color-text: #f8fafc;
    --color-text-muted: #94a3b8;
    --color-border: #475569;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===========================================
   レイアウト
   =========================================== */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================================
   ヘッダー
   =========================================== */
.header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 10px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 5px;
}

/* ===========================================
   プログレスバー
   =========================================== */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    height: 4px;
    background: var(--color-surface-light);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, #a855f7 100%);
    width: 20%;
    transition: width 0.3s ease;
}

.step-indicator {
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

/* ===========================================
   画面管理
   =========================================== */
.screen {
    display: none;
    flex: 1;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================================
   カード
   =========================================== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 30px 25px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.card-description {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 25px;
}

/* ===========================================
   オプションカード
   =========================================== */
.option-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.option-grid.small {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.option-card {
    background: var(--color-surface-light);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.option-card.selected {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.15);
}

.option-card.small {
    padding: 15px 10px;
}

.option-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.option-card.small .option-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.option-label {
    font-weight: 500;
    font-size: 0.95rem;
}

.option-card.small .option-label {
    font-size: 0.8rem;
}

.option-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 5px;
}

/* ===========================================
   フォーム
   =========================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.required {
    color: var(--color-error);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-surface-light);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.mt-10 {
    margin-top: 10px;
}

/* ===========================================
   URL入力（プレフィックス付き）
   =========================================== */
.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--color-border);
    border: 2px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.form-input.has-prefix {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ===========================================
   ヒントボックス
   =========================================== */
.hint-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    padding: 15px;
    margin-bottom: 20px;
}

.hint-box p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 5px 0;
}

.hint-box p:first-child {
    margin-top: 0;
}

.hint-box p:last-child {
    margin-bottom: 0;
}

/* ===========================================
   予習中画面
   =========================================== */
.prelearn-status {
    text-align: left;
    max-width: 280px;
    margin: 0 auto;
}

/* ===========================================
   AI提案表示
   =========================================== */
.ai-suggestion {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--color-success);
    display: none;
}

.ai-suggestion.show {
    display: block;
}

.ai-suggestion-label {
    font-weight: 600;
    margin-bottom: 3px;
}

.ai-suggestion-value {
    color: var(--color-text);
}

/* ===========================================
   スタイル選択
   =========================================== */
.style-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.style-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--color-surface-light);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.style-card:hover {
    border-color: var(--color-primary);
}

.style-card.selected {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.15);
}

.style-preview {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.style-preview.dark {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.style-preview.light {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.style-preview.gradient {
    background: linear-gradient(135deg, #0f172a 0%, #581c87 50%, #0f172a 100%);
}

.style-sample-text {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.style-sample-text.dark-text {
    color: #1e293b;
}

.style-info {
    flex: 1;
}

.style-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.style-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ===========================================
   確認リスト
   =========================================== */
.confirm-list {
    background: var(--color-surface-light);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 25px;
}

.confirm-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.confirm-item:last-child {
    border-bottom: none;
}

.confirm-label {
    width: 120px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.confirm-value {
    flex: 1;
    font-weight: 500;
}

/* ===========================================
   ボタン
   =========================================== */
.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

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

.btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

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

.btn-secondary {
    background: var(--color-surface-light);
    color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-border);
}

.btn-generate {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
}

.btn-download {
    width: 100%;
}

/* ===========================================
   エラーメッセージ
   =========================================== */
.error-message {
    color: var(--color-error);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 15px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ===========================================
   生成中画面
   =========================================== */
.generating-card {
    text-align: center;
}

.generating-animation {
    margin: 30px 0;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--color-surface-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

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

.generating-progress {
    margin-bottom: 30px;
}

.generating-bar {
    height: 8px;
    background: var(--color-surface-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.generating-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, #a855f7 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.generating-percent {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.status-list {
    text-align: left;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.status-item.active {
    color: var(--color-text);
}

.status-item.active .status-icon {
    color: var(--color-primary);
}

.status-item.completed {
    color: var(--color-success);
}

.status-item.completed .status-icon {
    color: var(--color-success);
}

.status-icon {
    font-size: 1.2rem;
}

.timer-display {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ===========================================
   完成画面
   =========================================== */
.preview-container {
    margin: 20px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
}

.preview-container video {
    width: 100%;
    display: block;
}

/* ===========================================
   フッター
   =========================================== */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: auto;
}

/* ===========================================
   レスポンシブ
   =========================================== */
@media (max-width: 480px) {
    .app-container {
        padding: 15px;
    }

    .card {
        padding: 25px 20px;
    }

    .card-title {
        font-size: 1.2rem;
    }

    .option-grid {
        grid-template-columns: 1fr;
    }

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

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

    .btn {
        width: 100%;
    }

    .confirm-item {
        flex-direction: column;
        gap: 5px;
    }

    .confirm-label {
        width: auto;
    }
}
