/* ============================================
   リセット・基本スタイル
   ============================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* ============================================
   コンテナ
   ============================================ */

.container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   ヘッダー
   ============================================ */

.header {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 5px;
}

.header-content .subtitle {
    color: #888;
    font-size: 1em;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #4CAF50;
}

.status-indicator.disconnected {
    background: #f44336;
    animation: none;
}

.status-text {
    font-size: 0.9em;
    color: #666;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   メインコンテンツ
   ============================================ */

.main-content {
    flex: 1;
}

section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ============================================
   アップロードセクション
   ============================================ */

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f3f3f3;
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #ede7f6;
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.upload-area h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.5em;
}

.upload-area p {
    color: #888;
    font-size: 0.95em;
}

.file-name {
    margin-top: 15px;
    padding: 10px;
    background: #e8f5e9;
    border-left: 4px solid #4CAF50;
    border-radius: 4px;
    color: #2e7d32;
    font-weight: 500;
}

/* ============================================
   設定セクション
   ============================================ */

.settings-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-group {
    display: flex;
    flex-direction: column;
}

.settings-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.settings-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.settings-group select:hover,
.settings-group select:focus {
    border-color: #667eea;
    outline: none;
}

/* ============================================
   ボタンセクション
   ============================================ */

.button-section {
    padding: 20px;
    text-align: center;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-width: 200px;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
    min-width: 150px;
    justify-content: center;
}

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

.btn-text {
    display: inline-block;
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   プログレスバー
   ============================================ */

.progress-section {
    padding: 20px;
}

.progress-info {
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    color: #667eea;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 10%;
    }
    50% {
        width: 80%;
    }
    100% {
        width: 90%;
    }
}

/* ============================================
   結果セクション
   ============================================ */

.result-section {
    padding: 20px;
}

.result-card {
    margin-bottom: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    border-radius: 6px;
}

.result-card h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.text-result {
    background: white;
    padding: 15px;
    border-radius: 6px;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.btn-copy {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.btn-copy:hover {
    background: #764ba2;
}

/* ============================================
   メタデータ
   ============================================ */

.metadata-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.metadata-item {
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.metadata-item .label {
    display: block;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.metadata-item span:last-child {
    display: block;
    color: #333;
    font-size: 1.1em;
}

/* ============================================
   セグメント
   ============================================ */

.segments-container {
    max-height: 400px;
    overflow-y: auto;
}

.segment {
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-left: 3px solid #4CAF50;
    border-radius: 4px;
    position: relative;
}

.segment-time {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 5px;
}

.segment-text {
    color: #333;
    line-height: 1.5;
}

/* ============================================
   エクスポート
   ============================================ */

.export-section {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-export {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.btn-export:hover {
    background: #45a049;
}

/* ============================================
   エラーセクション
   ============================================ */

.error-section {
    padding: 20px;
}

.error-message {
    background: #ffebee;
    border-left: 4px solid #f44336;
    color: #c62828;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* ============================================
   フッター
   ============================================ */

.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    margin-top: 20px;
}

/* ============================================
   レスポンシブ
   ============================================ */

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .header-content h1 {
        font-size: 2em;
    }

    .settings-section {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .btn {
        width: 100%;
    }

    .export-section {
        flex-direction: column;
    }

    .btn-export {
        width: 100%;
    }

    section {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5em;
    }

    .upload-icon {
        font-size: 2em;
    }

    .upload-area h2 {
        font-size: 1.2em;
    }

    .metadata-section {
        grid-template-columns: 1fr;
    }
}
