:root {
    --bg-color: #0f111a;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --error-color: #ef4444;
    --success-color: #10b981;
    --accent-blue: #6366f1;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Blobs for Visual Interest */
.background-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,1) 0%, rgba(15,17,26,0) 70%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16,185,129,0.8) 0%, rgba(15,17,26,0) 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

#main-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hidden {
    display: none !important;
    opacity: 0;
}

.model-selection {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.model-selection label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.premium-select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.premium-select:hover, .premium-select:focus {
    border-color: var(--accent-color);
    outline: none;
}

.premium-select option {
    background: var(--bg-color);
    color: var(--text-primary);
    padding: 0.5rem;
}

.tabs {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 0.3rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.8rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

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

/* Upload Area */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    margin-bottom: 1.5rem;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    color: var(--accent-color);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-5px);
}

/* Record Area */
.record-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}

.record-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: transparent;
    border: 3px solid var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.record-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--error-color);
    transition: all 0.3s ease;
}

.record-btn.recording .record-inner {
    border-radius: 15%;
    width: 40px;
    height: 40px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

audio {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: var(--accent-color);
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #334155;
}

.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Loader */
#loading-panel {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loader {
    display: flex;
    gap: 8px;
    height: 40px;
    align-items: flex-end;
}

.loader-bar {
    width: 6px;
    background: var(--accent-color);
    border-radius: 3px;
    animation: eq 1s ease-in-out infinite alternate;
}

.loader-bar:nth-child(1) { height: 20px; animation-delay: 0.1s; }
.loader-bar:nth-child(2) { height: 40px; animation-delay: 0.3s; }
.loader-bar:nth-child(3) { height: 30px; animation-delay: 0.5s; }
.loader-bar:nth-child(4) { height: 15px; animation-delay: 0.7s; }

@keyframes eq {
    0% { height: 10px; }
    100% { height: 40px; }
}

/* Result Panel */
.result-content {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
    font-size: 1.05rem;
    color: #f8fafc;
    border: 1px solid var(--glass-border);
}

/* Custom Scrollbar for Result */
.result-content::-webkit-scrollbar {
    width: 8px;
}
.result-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
.result-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
.result-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

.result-actions {
    display: flex;
    gap: 1rem;
}

/* ==========================================
   SPEAKER MANAGER
   ========================================== */

.speaker-manager {
    margin-bottom: 1.5rem;
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}

.speaker-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.speaker-manager-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.add-speaker-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-speaker-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-color);
}

.speaker-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.speaker-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

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

.speaker-item:hover {
    border-color: var(--glass-border);
}

.speaker-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.speaker-name-input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.2rem 0;
    outline: none;
    transition: border-color 0.2s ease;
}

.speaker-name-input:focus {
    border-bottom-color: var(--accent-color);
}

.speaker-name-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.speaker-remove-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.speaker-remove-btn:hover {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.speaker-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin: 0;
}

/* ==========================================
   DIALOG EDITOR
   ========================================== */

.dialog-editor {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
}

/* Custom Scrollbar for Dialog Editor */
.dialog-editor::-webkit-scrollbar {
    width: 8px;
}
.dialog-editor::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.dialog-editor::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.dialog-editor::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dialog-segment {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.5rem 0;
    transition: background 0.2s ease;
}

.segment-speaker-tag {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-width: fit-content;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin-top: 0.15rem;
}

.segment-speaker-tag:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.segment-speaker-tag .tag-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.segment-text {
    flex: 1;
    line-height: 1.65;
    font-size: 1rem;
    color: #f0f0f0;
    word-break: break-word;
}

/* Divider between segments (clickable to insert speaker change) */
.segment-divider {
    position: relative;
    height: 6px;
    margin: 0.1rem 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.25s ease;
}

.segment-divider::before {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    height: 1px;
    background: transparent;
    transition: background 0.2s ease;
}

.segment-divider:hover {
    height: 28px;
    background: rgba(99, 102, 241, 0.08);
}

.segment-divider:hover::before {
    background: rgba(99, 102, 241, 0.3);
}

.segment-divider:hover::after {
    content: '+ talbyte';
    font-size: 0.7rem;
    color: var(--accent-color);
    font-weight: 500;
    letter-spacing: 0.03em;
}

/* Speaker dropdown that appears when clicking a tag */
.speaker-picker {
    position: absolute;
    z-index: 100;
    background: #1a1d2e;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.4rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: popIn 0.15s ease;
    min-width: 140px;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.95) translateY(-5px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.speaker-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
}

.speaker-picker-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.speaker-picker-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===============================
   AI Summary Styles
   =============================== */
.summary-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.summary-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.sentiment-box {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border-color: rgba(168, 85, 247, 0.2);
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

.summary-header svg {
    color: var(--accent-color);
}

.summary-list {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.summary-list li {
    margin-bottom: 0.3rem;
}

.summary-text {
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Feedback Section */
.feedback-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(43, 110, 219, 0.05);
    border: 1px solid rgba(43, 110, 219, 0.2);
    border-radius: var(--radius);
}

.feedback-input {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem 1rem;
    background-color: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.feedback-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(43, 110, 219, 0.1);
}

/* Actions */

@media (max-width: 480px) {
    .container {
        padding: 1rem;
        padding-top: 5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .glass-panel {
        padding: 1.5rem;
    }
    
    .result-actions {
        flex-direction: column;
    }

    .dialog-segment {
        flex-direction: column;
        gap: 0.3rem;
    }

    .segment-speaker-tag {
        align-self: flex-start;
    }

    .speaker-manager-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Progress bar */
.progress-wrapper {
    margin-top: 1.5rem;
    width: 100%;
    max-width: 400px;
}
.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--success-color));
    width: 0%;
    border-radius: 4px;
    transition: width 0.3s ease-out;
}
.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ==========================================
   APP NAVBAR
   ========================================== */
.app-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.app-nav-logo {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.app-nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.nav-small-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-small-btn:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.15);
}

.nav-small-btn.accent {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.nav-small-btn.accent:hover {
    background: var(--accent-hover);
}

/* Push main content below navbar */
.container {
    padding-top: 5rem;
}

/* ==========================================
   AUTH MODAL
   ========================================== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-modal-overlay.hidden {
    display: none !important;
}

.auth-modal {
    background: #1a1d2e;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    animation: modalIn 0.3s ease;
}

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

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.auth-modal-close:hover { color: var(--text-primary); }

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-form.hidden { display: none; }

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-field label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.auth-field input {
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.auth-error {
    color: var(--error-color);
    font-size: 0.9rem;
    text-align: center;
}

.auth-submit {
    margin-top: 0.5rem;
}

/* ==========================================
   HISTORY PANEL
   ========================================== */
.history-item {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.05);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-item-filename {
    font-weight: 600;
    font-size: 0.95rem;
}

.history-item-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-item-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 0;
}

