/* CSS Styling system for EchoScribe - Glassmorphic Theme */
:root {
    --bg-dark: #09090e;
    --bg-card: rgba(18, 18, 29, 0.55);
    --bg-card-hover: rgba(25, 25, 40, 0.65);
    --bg-card-nested: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.25);
    --accent-teal: #14b8a6; /* Teal */
    --accent-teal-glow: rgba(20, 184, 166, 0.25);
    --danger: #ef4444; /* Red */
    --danger-glow: rgba(239, 68, 68, 0.25);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #6b7280;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Blur Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
    animation: float 25s ease-in-out infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, var(--accent-teal), #3b82f6);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #ec4899, rgba(0,0,0,0));
    top: 50%;
    left: 60%;
    animation-delay: -10s;
}

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

/* Container Structure */
.app-container {
    width: 92%;
    max-width: 1280px;
    margin: 30px auto;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

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

.logo-icon {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo h1 span {
    background: linear-gradient(135deg, var(--primary), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.04);
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 500;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pulse-dot.idle {
    background-color: var(--text-dark);
    box-shadow: 0 0 8px var(--text-dark);
}

.pulse-dot.listening {
    background-color: var(--danger);
    box-shadow: 0 0 12px var(--danger);
    animation: pulse 1.2s infinite;
}

.pulse-dot.processing {
    background-color: var(--accent-teal);
    box-shadow: 0 0 12px var(--accent-teal);
    animation: pulse-processing 1.2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-processing {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(20, 184, 166, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}

.status-text {
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Layout Panels */
.main-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

/* Glass Card Common */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:focus-within {
    border-color: var(--border-color-active);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary);
}

/* Settings Inputs */
.input-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 576px) {
    .input-settings {
        grid-template-columns: 1fr;
    }
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-group label i {
    font-size: 13px;
}

.styled-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.styled-select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.styled-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.styled-select option {
    background-color: #12121d;
    color: var(--text-main);
}

/* Visualizer Style */
.visualizer-container {
    height: 100px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

#audioVisualizer {
    width: 100%;
    height: 100%;
    display: block;
}

.visualizer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: rgba(18, 18, 29, 0.8);
    color: var(--text-dark);
    font-size: 12px;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.visualizer-overlay i {
    font-size: 20px;
}

.visualizer-container.active .visualizer-overlay {
    opacity: 0;
}

/* Record Button Controls */
.record-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 0;
}

.record-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.record-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

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

.btn-idle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px var(--primary-glow);
}

.btn-idle:hover::after {
    transform: rotate(45deg);
    border-color: var(--primary);
}

.btn-recording {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: var(--text-main);
    animation: recordPulse 1.5s infinite;
}

.btn-recording::after {
    border: 2px solid var(--danger);
    animation: spinRotate 10s linear infinite;
}

@keyframes recordPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(0.96); box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

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

.record-hint {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 500;
}

.recording-stats {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Transcript Output display */
.transcript-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.display-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-area-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    min-height: 140px;
    max-height: 240px;
    overflow-y: auto;
    position: relative;
    transition: border-color 0.2s ease;
}

.text-area-wrapper:focus-within {
    border-color: var(--primary);
}

.live-output-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-word;
    outline: none;
    min-height: 100px;
}

.live-output-text:empty::before {
    content: attr(placeholder);
    color: var(--text-dark);
}

/* Action Button Panel */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 14px;
    border: none;
    outline: none;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-teal), #0d9488);
    color: var(--bg-dark);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px var(--accent-teal-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

/* History panel styles */
.history-panel {
    max-height: 680px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.history-count {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary-glow);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    font-family: var(--font-heading);
}

.history-list-wrapper {
    overflow-y: auto;
    flex-grow: 1;
    margin-right: -10px;
    padding-right: 10px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* History Card Item */
.glass-card-nested {
    background: var(--bg-card-nested);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
}

.glass-card-nested:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.01);
}

.glass-card-nested.pinned {
    border-color: var(--border-color-active);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
    background: rgba(99, 102, 241, 0.02);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.meta-lang {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.meta-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.pin-btn.active {
    color: #facc15 !important; /* Gold */
}

.delete-btn:hover {
    color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.item-content {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-main);
    word-break: break-word;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-dark);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--text-dark);
    opacity: 0.5;
}

.empty-state p {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.empty-state span {
    font-size: 12px;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Audio Player Container styles */
.audio-player-container {
    margin-top: 12px;
    width: 100%;
}

.audio-player {
    width: 100%;
    height: 38px;
    border-radius: 10px;
    outline: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

/* Custom Webkit Audio Player overrides to match Dark Glassmorphism */
.audio-player::-webkit-media-controls-enclosure {
    background-color: rgba(18, 18, 29, 0.85);
    border-radius: 10px;
}

/* Styled Input for Document Title */
.styled-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    width: 100%;
    transition: all 0.2s ease;
}

.styled-input:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.styled-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* History Item Title Styling */
.history-item-title {
    font-family: var(--font-heading);
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    word-break: break-all;
}

.title-text {
    word-break: break-word;
    display: inline-block;
    max-width: 90%;
}

/* Badge Draft Styling */
.badge-draft {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Click-to-Edit Title styling */
.history-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-title-icon {
    font-size: 12px;
    color: var(--text-dark);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.history-item:hover .edit-title-icon {
    opacity: 1;
}

.edit-title-icon:hover {
    color: var(--primary);
}

.title-text {
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
}

.title-text[contenteditable="true"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--primary);
    padding: 2px 6px;
    outline: none;
    cursor: text;
}

/* Search Box Container */
.search-box {
    position: relative;
    width: 100%;
    margin-bottom: 6px;
    margin-top: 4px;
}

/* Premium glassmorphic search input styling */
.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px 16px 12px 42px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 13.5px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Hover state */
.search-box input:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Focus state with glowing animation */
.search-box input:focus {
    background: rgba(18, 18, 29, 0.85);
    border-color: var(--primary);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Search Icon positioning and transition */
.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dark);
    font-size: 14px;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scale and illuminate the search icon when focused */
.search-box input:focus + .search-icon {
    color: var(--primary);
    transform: translateY(-50%) scale(1.15);
}

/* History Group Header Styling */
.history-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.group-title {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-title::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin-left: 10px;
}

/* Category / Folder Badge Styling */
.badge-category {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-category:hover {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
    transform: translateY(-0.5px);
}

.badge-category i {
    font-size: 11px;
}

/* Category Folder Word Export Button */
.category-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    font-size: 12px;
    margin-left: 2px;
    margin-right: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-export-btn:hover {
    color: var(--accent-teal);
    transform: scale(1.2) rotate(-10deg);
}

/* Recording Real-time Stats Badge */
.recording-stats {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--text-muted);
    font-family: var(--font-body);
    transition: all 0.3s ease;
}

.recording-stats i {
    margin-right: 4px;
    color: var(--accent-teal);
}

/* ============================================
   AI ENGINE SELECTOR
   ============================================ */
.engine-selector-wrapper {
    margin-top: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.engine-selector-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.engine-selector-label i {
    margin-right: 6px;
    color: var(--primary);
}

.engine-chips {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.engine-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-dark);
}

.engine-chip i {
    font-size: 16px;
    margin-bottom: 2px;
}

.engine-chip span {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--text-muted);
    line-height: 1;
}

.engine-chip small {
    font-size: 9px;
    font-family: var(--font-body);
    color: var(--text-dark);
    letter-spacing: 0.3px;
}

.engine-chip:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

/* Active state per-engine with unique accent colors */
.engine-chip.active[data-engine="local"],
.engine-chip.active[data-engine="local_server"] {
    background: rgba(20, 184, 166, 0.12);
    border-color: var(--accent-teal);
    color: var(--accent-teal);
    box-shadow: 0 0 14px rgba(20, 184, 166, 0.2);
}
.engine-chip.active[data-engine="local"] span,
.engine-chip.active[data-engine="local"] i,
.engine-chip.active[data-engine="local_server"] span,
.engine-chip.active[data-engine="local_server"] i { color: var(--accent-teal); }

.engine-chip.active[data-engine="local_pc"] {
    background: rgba(168, 85, 247, 0.15);
    border-color: #a855f7;
    color: #c084fc;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}
.engine-chip.active[data-engine="local_pc"] span,
.engine-chip.active[data-engine="local_pc"] i { color: #c084fc; }

.engine-chip.active[data-engine="groq"] {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.2);
}
.engine-chip.active[data-engine="groq"] span,
.engine-chip.active[data-engine="groq"] i { color: var(--primary); }

.engine-chip.active[data-engine="openai"] {
    background: rgba(16, 185, 129, 0.12);
    border-color: #10b981;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.2);
}
.engine-chip.active[data-engine="openai"] span,
.engine-chip.active[data-engine="openai"] i { color: #10b981; }

.engine-chip.active[data-engine="none"] {
    background: rgba(107, 114, 128, 0.12);
    border-color: #6b7280;
    box-shadow: 0 0 8px rgba(107, 114, 128, 0.15);
}
.engine-chip.active[data-engine="none"] span,
.engine-chip.active[data-engine="none"] i { color: #9ca3af; }

/* Engine status message */
.engine-status-msg {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dark);
    min-height: 14px;
    transition: all 0.2s ease;
    padding-left: 2px;
}

/* ============================================
   WHISPER.CPP STATUS PANEL
   ============================================ */
.whisper-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    font-family: var(--font-body);
    padding: 8px 10px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* Idle state */
.whisper-status.idle {
    color: var(--text-dark);
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.07);
}

/* Checking (spinner) state */
.whisper-status.checking {
    color: #f59e0b;
    background: rgba(245,158,11,0.05);
    border: 1px solid rgba(245,158,11,0.15);
    gap: 8px;
}
.whisper-status.checking i {
    color: #f59e0b;
}

/* Running (success) state */
.whisper-status.running {
    color: #10b981;
    background: rgba(16,185,129,0.07);
    border: 1px solid rgba(16,185,129,0.2);
}
.whisper-status.running i {
    color: #10b981;
    margin-right: 4px;
}
.whisper-status.running code {
    background: rgba(16,185,129,0.12);
    color: #34d399;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* Stopped (error) state */
.whisper-status.stopped {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    background: rgba(239,68,68,0.05);
    border: 1px solid rgba(239,68,68,0.2);
}

.whisper-stopped-msg {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #f87171;
    font-size: 12px;
}
.whisper-stopped-msg i { color: #ef4444; }
.whisper-stopped-msg code {
    background: rgba(239,68,68,0.12);
    color: #fca5a5;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.whisper-action-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.whisper-quick-cmd {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-dark);
    padding: 5px 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    border: 1px dashed rgba(255,255,255,0.06);
}
.whisper-quick-cmd code {
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
}

/* Whisper action buttons */
.whisper-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: none;
}

.whisper-action-btn.btn-check,
.whisper-action-btn.btn-recheck {
    background: rgba(99,102,241,0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.25);
}
.whisper-action-btn.btn-check:hover,
.whisper-action-btn.btn-recheck:hover {
    background: rgba(99,102,241,0.22);
    transform: translateY(-1px);
}

.whisper-action-btn.btn-download {
    background: linear-gradient(135deg, rgba(20,184,166,0.15), rgba(99,102,241,0.15));
    color: #5eead4;
    border: 1px solid rgba(20,184,166,0.3);
}
.whisper-action-btn.btn-download:hover {
    background: linear-gradient(135deg, rgba(20,184,166,0.25), rgba(99,102,241,0.25));
    transform: translateY(-1px);
}

.whisper-action-btn.btn-guide {
    background: rgba(245,158,11,0.1);
    color: #fcd34d;
    border: 1px solid rgba(245,158,11,0.2);
}
.whisper-action-btn.btn-guide:hover {
    background: rgba(245,158,11,0.18);
    transform: translateY(-1px);
}

.engine-msg-text {
    font-size: 11px;
    color: var(--text-dark);
}

/* ============================================
   RISALAH RAPAT (MEETING MINUTES) STYLES
   ============================================ */

/* Risalah Action Control Button */
.btn-risalah {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-risalah:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
    transform: translateY(-2px);
}

/* Badge Minutes in History List */
.badge-minutes {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #c084fc;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.badge-minutes:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #e9d5ff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

/* Risalah Icon Button in Item Actions */
.icon-btn.risalah-btn {
    color: #c084fc;
}
.icon-btn.risalah-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #e9d5ff;
    transform: scale(1.1);
}

/* Modal Overlay & Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 9, 16, 0.82);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInModal 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.glass-card-modal {
    background: rgba(22, 23, 38, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.15);
    border-radius: 24px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-icon {
    font-size: 24px;
    color: #c084fc;
    background: rgba(139, 92, 246, 0.15);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--text-dark);
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* AI Risalah Banner */
.ai-risalah-banner {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ai-banner-info {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ai-banner-info i {
    font-size: 22px;
    color: #c084fc;
}
.ai-banner-info strong {
    display: block;
    font-size: 14px;
    color: #f3e8ff;
}
.ai-banner-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

.btn-ai-sparkle {
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
    transition: all 0.2s ease;
}
.btn-ai-sparkle:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}

.risalah-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding-bottom: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}
.risalah-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-dark);
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}
.tab-btn.active {
    color: #f3e8ff;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(99, 102, 241, 0.25) 100%);
    border: 1px solid rgba(168, 85, 247, 0.45);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
    font-weight: 600;
}

/* Form Layout inside Modal */
.tab-content {
    position: relative;
    z-index: 1;
    padding-top: 4px;
    padding-bottom: 16px;
    animation: fadeInTab 0.2s ease;
}

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

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

@media (max-width: 768px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-group label i {
    color: #c084fc;
}

.styled-textarea {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 13.5px;
    outline: none;
    width: 100%;
    resize: vertical;
    line-height: 1.5;
    transition: all 0.2s ease;
}
.styled-textarea:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25);
}

/* Action Items Table & Section */
.action-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.action-items-header label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-table-wrapper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.risalah-action-table {
    width: 100%;
    border-collapse: collapse;
}
.risalah-action-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.risalah-action-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.risalah-action-table input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text-main);
    font-size: 13px;
    width: 100%;
    outline: none;
}
.risalah-action-table input:focus {
    border-color: #a855f7;
}

.btn-remove-row {
    background: transparent;
    border: none;
    color: #f87171;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.btn-remove-row:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Modal Footer */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
}
.btn-info:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
}

/* Mode Switcher Tabs */
.panel-mode-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 18px;
}

.mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.mode-tab.active {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Audio File Dropzone */
.dropzone-container {
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.dropzone-container:hover, .dropzone-container.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-icon {
    font-size: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.dropzone-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.dropzone-content p {
    font-size: 12px;
    color: var(--text-muted);
}

/* File Selected Preview Card */
.file-preview-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px 16px;
    width: 100%;
}

.file-preview-info {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.file-preview-info .file-icon {
    font-size: 24px;
    color: var(--accent-teal);
}

.file-preview-info strong {
    display: block;
    font-size: 14px;
    color: var(--text-main);
    word-break: break-all;
}

.file-preview-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
}

.upload-progress-container {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    padding: 14px 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-teal));
    border-radius: 10px;
    transition: width 0.25s ease;
}

.progress-fill.processing {
    background: linear-gradient(90deg, #a855f7, #6366f1, #14b8a6);
    background-size: 200% 100%;
    animation: gradientMove 1.5s infinite linear;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Whisper Model Group Fade & Slide Animation */
#whisperModelGroup {
    animation: slideFadeDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Collapsible Transcription Text (Read More) */
.transcription-text {
    position: relative;
    margin-bottom: 8px;
    text-align: left;
}

.transcription-text.collapsed .text-content {
    max-height: 72px; /* Roughly 3 lines of text */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.read-more-btn {
    background: transparent;
    border: none;
    color: var(--accent-teal);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 0 2px 0;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-heading);
    transition: color 0.2s ease;
    outline: none;
}

.read-more-btn:hover {
    color: #2dd4bf;
    text-decoration: underline;
}

.read-more-btn i {
    font-size: 10px;
    transition: transform 0.2s ease;
}

/* ==========================================================================
   RESPONSIVE LAYOUT ADJUSTMENTS (DESKTOP, TABLET, MOBILE)
   ========================================================================== */

/* Tablet & Smaller Screens (max-width: 1024px) */
@media (max-width: 1024px) {
    .app-container {
        width: 95%;
        margin: 20px auto;
        gap: 16px;
    }
    .main-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .engine-chips {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile Screens (max-width: 768px) */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 14px;
        padding: 16px;
        text-align: center;
    }
    .header-right {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
        gap: 8px;
    }
    .app-header .logo {
        flex-direction: column;
        gap: 6px;
    }
    .app-header .logo h1 {
        font-size: 20px;
    }
    .app-header .logo-icon {
        font-size: 24px;
    }
    .user-profile, .status-indicator, .btn-logout {
        width: auto !important;
        justify-content: center;
        text-align: center;
        font-size: 12px;
        padding: 6px 12px;
    }
    .glass-card {
        padding: 20px;
        border-radius: 20px;
    }
    .input-settings {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .btn {
        width: 100%;
        padding: 12px 16px;
    }
}

/* Narrow Mobile Screens (max-width: 480px) */
@media (max-width: 480px) {
    .app-container {
        width: 98%;
        margin: 10px auto;
        padding: 0 4px;
    }
    .header-right {
        justify-content: space-between;
    }
    .logout-text {
        display: none;
    }
    .btn-logout {
        padding: 6px 10px !important;
        border-radius: 50px !important;
        width: 34px;
        height: 34px;
        justify-content: center;
    }
    .user-profile {
        padding: 6px 10px !important;
    }
    .user-profile span {
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }
    .engine-chips {
        grid-template-columns: repeat(2, 1fr);
    }
    .engine-chip[data-engine="none"] {
        grid-column: span 2;
    }
    .glass-card-nested {
        padding: 12px;
    }
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .item-actions {
        width: 100%;
        justify-content: space-between;
    }
    .audio-player-container {
        padding: 8px 10px;
    }
    .recording-stats {
        flex-direction: column;
        gap: 4px;
    }
    .recording-stats .stats-sep {
        display: none;
    }
}



