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

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 50%, #6366F1 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: #334155;
    line-height: 1.6;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    animation: fadeIn 0.6s ease-out;
}

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

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

.header {
    background: white;
    border-radius: 20px;
    padding: 35px 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.header:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.header-content h1 {
    font-size: 2.5em;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    font-weight: 700;
}

.header-content .subtitle {
    color: #64748B;
    font-size: 1.05em;
    font-weight: 400;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #F1F5F9;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #CBD5E1;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(203, 213, 225, 0.7);
}

.status-indicator.connected {
    background: #10B981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-connected 2s infinite;
}

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

.status-text {
    font-size: 0.9em;
    color: #64748B;
    font-weight: 500;
}

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

@keyframes pulse-connected {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

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

.main-content {
    flex: 1;
}

section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

section:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

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

.upload-area {
    border: 3px dashed #C7D2FE;
    border-radius: 16px;
    padding: 60px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.upload-area:hover {
    border-color: #6366F1;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
}

.upload-area:hover::before {
    opacity: 1;
}

.upload-area.dragover {
    border-color: #8B5CF6;
    background: linear-gradient(135deg, #EDE9FE 0%, #DDD6FE 100%);
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.25);
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.2));
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.upload-area h2 {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    font-size: 1.6em;
    font-weight: 600;
}

.upload-area p {
    color: #64748B;
    font-size: 1em;
    font-weight: 400;
    line-height: 1.6;
}

.file-name {
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border-left: 4px solid #10B981;
    border-radius: 12px;
    color: #047857;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
    animation: slideIn 0.3s ease-out;
}

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

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

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

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

.settings-group label {
    margin-bottom: 10px;
    font-weight: 600;
    color: #334155;
    font-size: 0.95em;
}

.settings-group select {
    padding: 12px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: #334155;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
}

.settings-group select:hover {
    border-color: #C7D2FE;
    background: #F8FAFC;
}

.settings-group select:focus {
    border-color: #6366F1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

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

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 14px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Noto Sans JP', sans-serif;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    min-width: 220px;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #CBD5E1 0%, #94A3B8 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.btn-secondary {
    background: #F1F5F9;
    color: #475569;
    min-width: 160px;
    justify-content: center;
    border: 2px solid #E2E8F0;
}

.btn-secondary:hover {
    background: #E2E8F0;
    border-color: #CBD5E1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.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: 18px;
    text-align: center;
    font-weight: 600;
    color: #6366F1;
    font-size: 1.05em;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #E2E8F0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 50%, #6366F1 100%);
    background-size: 200% 100%;
    width: 0%;
    animation: progress 2s ease-in-out infinite, shimmer 2s linear infinite;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

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

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

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

.result-section {
    padding: 20px;
}

.result-card {
    margin-bottom: 25px;
    padding: 25px;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    border-left: 5px solid #6366F1;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.result-card h3 {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 18px;
    font-size: 1.2em;
    font-weight: 600;
}

.text-result {
    background: white;
    padding: 20px;
    border-radius: 12px;
    line-height: 1.8;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    word-wrap: break-word;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
    color: #334155;
}

.text-result::-webkit-scrollbar {
    width: 8px;
}

.text-result::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 4px;
}

.text-result::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.text-result::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.btn-copy {
    padding: 10px 18px;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-copy:active {
    transform: translateY(0);
}

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

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

.metadata-item {
    padding: 18px 20px;
    background: white;
    border-radius: 12px;
    border: 2px solid #E2E8F0;
    transition: all 0.3s ease;
}

.metadata-item:hover {
    border-color: #C7D2FE;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.metadata-item .label {
    display: block;
    font-weight: 600;
    color: #6366F1;
    margin-bottom: 8px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-item span:last-child {
    display: block;
    color: #334155;
    font-size: 1.15em;
    font-weight: 600;
}

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

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

.segments-container::-webkit-scrollbar {
    width: 8px;
}

.segments-container::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 4px;
}

.segments-container::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.segments-container::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.segment {
    padding: 16px 18px;
    margin-bottom: 12px;
    background: white;
    border-left: 4px solid #10B981;
    border-radius: 10px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.segment:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.segment-time {
    font-size: 0.85em;
    color: #64748B;
    margin-bottom: 8px;
    font-weight: 500;
}

.segment-text {
    color: #334155;
    line-height: 1.7;
}

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

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

.btn-export {
    flex: 1;
    min-width: 160px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.95em;
}

.btn-export:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.btn-export:active {
    transform: translateY(0);
}

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

.error-section {
    padding: 20px;
}

.error-message {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border-left: 5px solid #EF4444;
    color: #991B1B;
    padding: 18px 22px;
    border-radius: 12px;
    margin-bottom: 18px;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
    font-weight: 500;
}

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

.footer {
    text-align: center;
    padding: 25px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9em;
    margin-top: 30px;
    font-weight: 400;
}

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

@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;
    }
}
