/* ===================================================
   Ore AI (My Digital Twin) - Modern Cyber Theme CSS
   =================================================== */

:root {
    --bg-main: #0a0d14;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(28, 36, 56, 0.85);
    --bg-glass: rgba(18, 24, 38, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.25);
    
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.3);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 50;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.status-dot.warning {
    background-color: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
}

/* Main Content Area */
.main-view {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px calc(85px + env(safe-area-inset-bottom, 0px));
    position: relative;
}

/* Tab Views */
.tab-pane {
    display: none;
    min-height: 100%;
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.25s ease forwards;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

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

/* Bottom / Navigation Bar */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-item i, .nav-item .icon {
    font-size: 1.25rem;
}

.nav-item:hover {
    color: var(--text-muted);
}

.nav-item.active {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.12);
}

/* ===================================================
   Tab 1: Capture & Interview Mode
   =================================================== */
.capture-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 12px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 4px;
}

.chat-bubble {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: messagePop 0.2s ease;
}

@keyframes messagePop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.chat-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-bubble.ai {
    align-self: flex-start;
}

.chat-bubble.ore {
    align-self: flex-start;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.chat-bubble.user .avatar {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.chat-bubble.ai .avatar {
    background: linear-gradient(135deg, #10b981, #06b6d4);
}

.chat-bubble.ore .avatar {
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.93rem;
    line-height: 1.55;
    color: var(--text-main);
    word-break: break-word;
    position: relative;
}

.chat-bubble.user .message-content {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(79, 70, 229, 0.35));
    border-color: rgba(99, 102, 241, 0.4);
    border-top-right-radius: 4px;
}

.chat-bubble.ai .message-content {
    border-top-left-radius: 4px;
    border-color: rgba(6, 182, 212, 0.25);
}

.chat-bubble.ore .message-content {
    border-top-left-radius: 4px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(236, 72, 153, 0.15));
    border-color: rgba(245, 158, 11, 0.35);
}

/* リアルタイム記憶抽出バッジ */
.extracted-badge-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.extracted-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.35;
    animation: glowBadge 0.4s ease-out;
}

.extracted-badge.belief {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
}

.extracted-badge.episode {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.4);
    color: #67e8f9;
}

.extracted-badge.tone {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fcd34d;
}

.extracted-badge.idea {
    background: rgba(236, 72, 153, 0.15);
    border-color: rgba(236, 72, 153, 0.4);
    color: #f472b6;
}

@keyframes glowBadge {
    0% { transform: scale(0.92); opacity: 0; }
    50% { transform: scale(1.04); box-shadow: 0 0 12px rgba(16, 185, 129, 0.4); }
    100% { transform: scale(1); opacity: 1; }
}

/* Sound / Voice Control Bar */
.input-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.voice-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.audio-visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 16px;
}

.bar {
    width: 3px;
    height: 4px;
    background-color: var(--accent-cyan);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.is-listening .bar:nth-child(1) { animation: bounce 0.6s infinite 0.1s; }
.is-listening .bar:nth-child(2) { animation: bounce 0.6s infinite 0.2s; }
.is-listening .bar:nth-child(3) { animation: bounce 0.6s infinite 0.3s; }
.is-listening .bar:nth-child(4) { animation: bounce 0.6s infinite 0.4s; }
.is-listening .bar:nth-child(5) { animation: bounce 0.6s infinite 0.2s; }

@keyframes bounce {
    0%, 100% { height: 4px; }
    50% { height: 16px; background-color: var(--primary-light); }
}

.text-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-input-row textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 0.92rem;
    font-family: inherit;
    resize: none;
    height: 44px;
    outline: none;
    transition: border-color 0.2s;
}

.text-input-row textarea:focus {
    border-color: var(--primary);
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-mic {
    background: linear-gradient(135deg, #374151, #1f2937);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-mic.recording {
    background: linear-gradient(135deg, var(--accent-rose), #e11d48);
    color: #fff;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.5);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.btn-send {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
}

.btn-send:hover {
    box-shadow: var(--shadow-glow);
}

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.btn-pill {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-finish {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--accent-emerald);
    font-weight: 600;
}

.btn-finish:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(6, 182, 212, 0.3));
    color: #fff;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

/* ===================================================
   Tab 2: Profiles & Core Memory
   =================================================== */
.section-header {
    margin-bottom: 16px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card .label {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.stat-card .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-light);
}

.profile-category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
    scrollbar-width: none;
}

.profile-category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab-btn {
    padding: 6px 14px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}

.category-tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.profile-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 24px;
}

.profile-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
}

.profile-item-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.profile-item-content {
    flex: 1;
}

.profile-item-text {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.tag-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.btn-delete-item {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    transition: color 0.2s;
}

.btn-delete-item:hover {
    color: var(--accent-rose);
}

/* ===================================================
   Tab 3: Ore AI Chat (Digital Twin Simulation)
   =================================================== */
.twin-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.twin-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.twin-avatar-lg {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.twin-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.twin-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ===================================================
   Tab 4: Archive & Export
   =================================================== */
.archive-log-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.archive-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-light);
}

.archive-date {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.archive-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.export-actions-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.btn-export {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-export:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary-light);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

/* ===================================================
   Tab 5: Settings Modal / Form
   =================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-input, .form-select, .form-textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

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

.form-help {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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