/* Styling System for YT Projects Manager & Analytics */

:root {
    --bg-gradient-start: #0f0c20;
    --bg-gradient-end: #06020c;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.4);
    
    --primary-color: #ff2e54;
    --primary-hover: #e01b3e;
    --primary-gradient: linear-gradient(135deg, #ff2e54 0%, #ff5274 100%);
    --secondary-color: rgba(255, 255, 255, 0.07);
    --secondary-hover: rgba(255, 255, 255, 0.14);
    --success-color: #10b981;
    --success-hover: #059669;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-accent: #ff5274;
    
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-gradient-end);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    position: relative;
    line-height: 1.5;
}

/* Glass background overlay */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(255, 46, 84, 0.07) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.07) 0%, transparent 40%),
                linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    z-index: -1;
}

/* Layout split screen */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar panel */
.sidebar {
    width: 340px;
    background: rgba(10, 6, 21, 0.45);
    border-right: 1px solid var(--glass-border);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 1.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2.25rem;
    color: var(--primary-color);
    filter: drop-shadow(0 0 8px rgba(255, 46, 84, 0.4));
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.1;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Sidebar mini card form */
.sidebar-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
}

.sidebar-card h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-input-group input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.7rem 0.85rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    outline: none;
    width: 100%;
    transition: border-color var(--transition-fast);
}

.sidebar-input-group input:focus {
    border-color: var(--primary-color);
}

/* Saved projects listing */
.projects-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}

.projects-section h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.projects-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.no-projects {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem 1rem;
    line-height: 1.4;
}

.project-item {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 46, 84, 0.2);
    transform: translateX(2px);
}

.project-item.active {
    background: rgba(255, 46, 84, 0.06);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 46, 84, 0.15);
}

.project-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex-grow: 1;
}

.project-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-item-channel {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-item-count {
    display: inline-block;
    background: rgba(255, 255, 255, 0.07);
    padding: 0.2rem 0.5rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-main);
    align-self: flex-start;
}

.project-item.active .project-item-count {
    background: var(--primary-color);
}

.btn-delete-project {
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--border-radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}

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

/* Main workspace area */
.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
}

/* Empty state styling */
.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-grow: 1;
    gap: 1.25rem;
    max-width: 500px;
    margin: 0 auto;
}

.empty-icon {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 50%;
}

.empty-state h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.empty-state p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Workspace wrapper */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Workspace header block */
.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 32px var(--glass-shadow);
    gap: 1.5rem;
    flex-wrap: wrap;
}

.active-project-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.active-project-details h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.project-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.badge-title {
    background: rgba(255, 46, 84, 0.1);
    color: var(--text-accent);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-weight: 500;
    border: 1px solid rgba(255, 46, 84, 0.15);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Standard cards */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 12px 40px var(--glass-shadow);
    padding: 2rem;
}

/* Stats dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast);
}

.stat-box:hover {
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    display: block;
}

.stat-icon {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.03);
    pointer-events: none;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 600;
    border: none;
    outline: none;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary-sm {
    background: var(--primary-gradient);
    color: white;
    padding: 0.65rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.btn-primary-sm:hover {
    background: var(--primary-hover);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    padding: 0.85rem 1.5rem;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    box-shadow: 0 4px 15px rgba(255, 46, 84, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(255, 46, 84, 0.45);
    transform: translateY(-1px);
}

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

.btn-success {
    background: var(--success-gradient);
    color: white;
    padding: 0.85rem 1.5rem;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius-md);
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-close-sm {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0.25rem;
    cursor: pointer;
}

.btn-close-sm:hover {
    color: var(--text-main);
}

/* Config panel accordion */
.config-card {
    padding: 1.25rem 1.75rem;
}

.config-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.config-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-icon {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.toggle-icon.rotate {
    transform: rotate(180deg);
}

.config-body {
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group input[type="password"] {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-group input:focus {
    border-color: var(--primary-color);
}

.password-wrapper {
    position: relative;
    display: flex;
    width: 100%;
}

.password-wrapper input {
    padding-right: 2.75rem !important;
}

.btn-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

/* Progress panel */
.progress-card {
    padding: 1.5rem 2rem;
    position: relative;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.progress-title-block {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.progress-title-block h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    overflow: hidden;
    margin-bottom: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 50px;
    width: 0%;
    transition: width 0.35s ease;
    box-shadow: 0 0 8px rgba(255, 46, 84, 0.4);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

#progressPercent {
    color: var(--text-accent);
}

.log-container {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1rem;
}

.log-window {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    height: 130px;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.log-line {
    word-break: break-all;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
}

.log-line.text-muted {
    color: var(--text-muted);
}

.log-line.info {
    border-left-color: var(--text-accent);
}

.log-line.success {
    border-left-color: var(--success-color);
    color: #a7f3d0;
}

.log-line.error {
    border-left-color: #f87171;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.05);
}

/* Video table block */
.table-card {
    padding: 1.75rem;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 500px;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

#tableSearch {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    width: 100%;
    outline: none;
    transition: border-color var(--transition-fast);
}

#tableSearch:focus {
    border-color: var(--primary-color);
}

.filter-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.filter-wrapper select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.5rem 1.75rem 0.5rem 0.6rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

/* Data Table Grid */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.15);
    margin-bottom: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.data-table th.sortable:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-accent);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.thumbnail-wrapper {
    width: 72px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.table-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-title-cell {
    font-weight: 500;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-title-cell a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.video-title-cell a:hover {
    color: var(--text-accent);
}

.text-right {
    text-align: right;
}

.table-link-btn {
    color: var(--text-accent);
    font-size: 1.05rem;
    transition: transform var(--transition-fast);
    display: inline-block;
}

.table-link-btn:hover {
    transform: scale(1.15);
}

/* Pagination navigation bar */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

#pageIndicator {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.text-accent {
    color: var(--text-accent);
}

.hidden {
    display: none !important;
}

/* Responsive fixes */
@media (max-width: 900px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 350px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    .main-content {
        height: auto;
        overflow-y: visible;
    }
}

/* AI Assistant Drawer styles */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
}

.drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 2, 8, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.drawer-content {
    position: relative;
    width: 580px;
    max-width: 100%;
    height: 100%;
    background: rgba(10, 6, 21, 0.95);
    border-left: 1px solid var(--glass-border);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-title-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.drawer-title-block h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}

.drawer-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0 1.25rem;
}

.drawer-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    position: relative;
    transition: color var(--transition-fast);
}

.drawer-tab-btn:hover {
    color: var(--text-main);
}

.drawer-tab-btn.active {
    color: var(--primary-color);
}

.drawer-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    box-shadow: 0 -2px 10px rgba(255, 46, 84, 0.5);
}

.drawer-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.drawer-tab-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow: hidden;
}

/* Transcript loader and states */
.transcript-loader, .transcript-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-grow: 1;
    gap: 0.5rem;
    padding: 2rem;
}

.transcript-text-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.transcript-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.transcript-scroll-area {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #e5e7eb;
    white-space: pre-line;
}

/* Chat container and layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chat-message {
    padding: 0.75rem 1.1rem;
    border-radius: var(--border-radius-md);
    max-width: 82%;
    font-size: 0.88rem;
    line-height: 1.45;
}

.chat-message.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 2px;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(255, 46, 84, 0.15);
}

.chat-message.error {
    align-self: center;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    max-width: 95%;
    text-align: center;
}

.chat-input-bar {
    display: flex;
    gap: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1rem;
}

.chat-input-bar input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius-md);
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border-color var(--transition-fast);
}

.chat-input-bar input:focus {
    border-color: var(--primary-color);
}

.chat-input-bar input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send {
    background: var(--primary-gradient);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(255, 46, 84, 0.2);
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* AI Brain btn inside table */
.btn-cc {
    background: rgba(255, 46, 84, 0.1);
    color: var(--text-accent);
    border: 1px solid rgba(255, 46, 84, 0.15);
    padding: 0.35rem 0.6rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    cursor: pointer;
}

.btn-cc:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Typing bubble loader */
.typing-bubble {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.75rem 1rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Save response button inside Assistant message bubble */
.chat-message.assistant {
    position: relative;
    padding-right: 2.25rem !important; /* Make room for the save button */
}

.btn-save-message {
    position: absolute;
    right: 0.65rem;
    bottom: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.btn-save-message:hover {
    color: var(--text-accent);
    transform: scale(1.1);
}

.btn-save-message.saved {
    color: var(--primary-color);
    filter: drop-shadow(0 0 4px rgba(255, 46, 84, 0.4));
}

/* Saved Responses card styling */
.saved-response-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
}

.saved-response-card:hover {
    border-color: rgba(255, 46, 84, 0.15);
}

.saved-response-question {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-accent);
    border-left: 2px solid var(--primary-color);
    padding-left: 0.6rem;
    margin-bottom: 0.25rem;
}

.saved-response-text {
    font-size: 0.88rem;
    line-height: 1.45;
    color: #e5e7eb;
    white-space: pre-wrap;
}

.saved-response-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.6rem;
    margin-top: 0.25rem;
}

.saved-response-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-delete-saved {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    transition: color var(--transition-fast);
    padding: 0.25rem;
}

.btn-delete-saved:hover {
    color: var(--danger-color);
}

/* Modal project-wide saved responses */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 2, 8, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    width: 800px;
    max-width: 90%;
    height: 80vh;
    background: rgba(10, 6, 21, 0.95);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-title-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.modal-title-block h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
}

