/* ----------------------------------------------------
   WhatsApp Chat Archive Viewer - Style Guide & CSS
   ---------------------------------------------------- */

:root {
    /* Fonts */
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    /* Transition speeds */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    /* Light Theme Variables (Default WhatsApp Web Light) */
    --wa-green: #00a884;
    --wa-green-hover: #008f72;
    --wa-green-rgb: 0, 168, 132;
    --wa-teal: #53bdeb;
    
    --bg-main: #f0f2f5;
    --bg-sidebar: #ffffff;
    --bg-chat-pane: #efeae2;
    --bg-chat-header: #f0f2f5;
    --bg-chat-footer: #f0f2f5;
    
    --bubble-in: #ffffff;
    --bubble-out: #d9fdd3;
    --bubble-in-border: transparent;
    --bubble-out-border: transparent;
    
    --text-primary: #111b21;
    --text-secondary: #667781;
    --text-bubble-time: #667781;
    
    --border-color: #e9edef;
    --shadow-color: rgba(11, 20, 26, 0.08);
    --doodle-opacity: 0.4;
    
    /* UI Dashboard specific */
    --ui-bg: #f8fafc;
    --ui-card-bg: #ffffff;
    --ui-text: #1e293b;
    --ui-text-muted: #64748b;
    --ui-accent: #00a884;
    --ui-accent-hover: #008f72;
    --ui-input-bg: #f1f5f9;
}

.theme-dark {
    /* Dark Theme Variables (Default WhatsApp Web Dark) */
    --bg-main: #111b21;
    --bg-sidebar: #111b21;
    --bg-chat-pane: #0b141a;
    --bg-chat-header: #202c33;
    --bg-chat-footer: #202c33;
    
    --bubble-in: #202c33;
    --bubble-out: #005c4b;
    
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-bubble-time: #8696a0;
    
    --border-color: #222e35;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --doodle-opacity: 0.06;

    /* UI Dashboard specific */
    --ui-bg: #0b1318;
    --ui-card-bg: #111b21;
    --ui-text: #f1f5f9;
    --ui-text-muted: #94a3b8;
    --ui-accent: #00a884;
    --ui-accent-hover: #00c298;
    --ui-input-bg: #202c33;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: var(--font-primary);
    background-color: var(--ui-bg);
    color: var(--ui-text);
    height: 100%;
    overflow: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

input, button, select, textarea {
    font-family: inherit;
}

/* Typography Utilities */
.gradient-text {
    background: linear-gradient(135deg, #00c298 0%, #00a884 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-muted {
    color: var(--ui-text-muted) !important;
}

.text-center {
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--ui-accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--ui-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--wa-green-rgb), 0.3);
}

.btn-success {
    background-color: #25d366;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #20ba5a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--ui-text);
}

.btn-outline:hover {
    background-color: var(--ui-input-bg);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background-color: transparent;
    color: var(--ui-text);
    border: 1px solid var(--border-color);
}

.btn-icon:hover {
    background-color: var(--ui-input-bg);
    color: var(--ui-accent);
}

.btn-full-width {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ----------------------------------------------------
   LANDING / UPLOAD SCREEN
   ---------------------------------------------------- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#landing-screen {
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 40px 20px;
}

.landing-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(var(--wa-green-rgb), 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(83, 189, 235, 0.08) 0%, transparent 40%);
    z-index: -1;
}

.landing-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.landing-header {
    text-align: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-icon {
    position: relative;
    width: 48px;
    height: 48px;
    background-color: rgba(var(--wa-green-rgb), 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--wa-green-rgb), 0.25);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    color: var(--wa-green);
}

.logo-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.landing-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
}

.landing-header .subtitle {
    font-size: 1.1rem;
    color: var(--ui-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.drop-zone {
    background: var(--ui-card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-normal);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--wa-green);
    background-color: rgba(var(--wa-green-rgb), 0.02);
    box-shadow: 0 12px 40px rgba(var(--wa-green-rgb), 0.08);
}

.file-input-hidden {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.upload-icon-pulse {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(var(--wa-green-rgb), 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--wa-green);
    transition: transform var(--transition-fast);
}

.drop-zone:hover .upload-icon-pulse {
    transform: scale(1.08);
}

.upload-icon-pulse svg {
    width: 36px;
    height: 36px;
}

.drop-zone h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.upload-help {
    color: var(--ui-text-muted);
    margin-bottom: 24px;
    font-size: 1rem;
}

.upload-help span {
    color: var(--ui-text);
    font-weight: 600;
}

.upload-formats {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.format-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--ui-input-bg);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ui-text-muted);
    border: 1px solid var(--border-color);
}

.format-badge svg {
    width: 14px;
    height: 14px;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature-card {
    background-color: var(--ui-card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px var(--shadow-color);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: rgba(var(--wa-green-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wa-green);
    margin-bottom: 16px;
}

.feature-icon svg {
    width: 22px;
    height: 22px;
}

.feature-card h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.88rem;
    color: var(--ui-text-muted);
    line-height: 1.5;
}

.landing-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--ui-text-muted);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-content {
    background-color: var(--ui-card-bg);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--wa-green);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

.loader-content h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.loader-content p {
    color: var(--ui-text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--ui-input-bg);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--wa-green), #25d366);
    border-radius: 10px;
    transition: width 0.1s ease;
}

/* ----------------------------------------------------
   WORKSPACE SCREEN
   ---------------------------------------------------- */
#workspace-screen {
    background-color: var(--bg-main);
}

.workspace-header {
    height: 60px;
    background-color: var(--bg-chat-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.workspace-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.back-icon {
    font-size: 1.2rem;
    margin-right: 8px;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.back-icon:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.logo-icon-small {
    color: var(--wa-green);
    width: 24px;
    height: 24px;
}

.workspace-logo h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

#btn-theme-toggle {
    border: none;
}

.theme-dark .sun-icon { display: block; }
.theme-dark .moon-icon { display: none; }
body:not(.theme-dark) .sun-icon { display: none; }
body:not(.theme-dark) .moon-icon { display: block; }

.workspace-container {
    display: flex;
    height: calc(100% - 60px);
    width: 100%;
    overflow: hidden;
}

/* Workspace Sidebar */
.workspace-sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-chat-header);
}

.tab-btn {
    flex: 1;
    padding: 14px 10px;
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--wa-green);
    border-bottom-color: var(--wa-green);
}

.tab-btn svg {
    width: 16px;
    height: 16px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tab-pane {
    display: none;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.tab-pane.active {
    display: flex;
}

.sidebar-card {
    background-color: var(--bg-chat-header);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

.sidebar-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-card h3 svg {
    width: 16px;
    height: 16px;
    color: var(--wa-green);
}

.card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Stats UI */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.stat-item {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chat-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 8px;
}

.chat-date-range svg {
    width: 14px;
    height: 14px;
}

/* Form Controls */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--wa-green);
}

/* Checkbox Lists */
.checkbox-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    border-radius: 8px;
    padding: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.checkbox-item:hover {
    background-color: var(--bg-chat-pane);
}

.checkbox-item input {
    cursor: pointer;
    accent-color: var(--wa-green);
}

.checkbox-sender-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Media Gallery Sidebar */
.media-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 4px;
}

.media-gallery-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-color);
    background-color: var(--bg-chat-pane);
}

.media-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.media-gallery-item:hover img {
    transform: scale(1.08);
}

.media-gallery-icon {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

.media-gallery-icon svg {
    width: 12px;
    height: 12px;
}

.empty-media-msg {
    grid-column: span 3;
    padding: 40px 10px;
    font-size: 0.85rem;
}

/* ----------------------------------------------------
   WHATSAPP SIMULATOR WORKSPACE
   ---------------------------------------------------- */
.chat-simulator-container {
    flex: 1;
    height: 100%;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-mockup {
    width: 100%;
    max-width: 800px;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px var(--shadow-color);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-chat-pane);
    border: 1px solid var(--border-color);
    position: relative;
}

/* Header Mockup */
.wa-header {
    height: 60px;
    background-color: var(--bg-chat-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    z-index: 10;
}

.wa-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--wa-green);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wa-chat-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.wa-chat-info p {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.wa-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-header-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast);
}

.wa-header-btn:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.wa-header-btn svg {
    width: 20px;
    height: 20px;
}

/* Search Bar Mockup */
.wa-search-bar {
    background-color: var(--bg-chat-header);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.wa-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    width: 16px;
    height: 16px;
}

#wa-search-input {
    width: 100%;
    padding: 8px 36px 8px 36px;
    border-radius: 8px;
    border: none;
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 0.85rem;
}

#wa-search-input:focus {
    outline: none;
}

.wa-search-close-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.wa-search-results-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.btn-search-nav {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.btn-search-nav:hover:not(:disabled) {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-search-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Chat Wallpaper & Body */
.wa-chat-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wa-chat-doodle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23000000' fill-opacity='0.15'%3E%3Cpath d='M50 50c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10zM10 10c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10S0 25.523 0 20s4.477-10 10-10zm10 8c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm40 40c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8z'/%3E%3C/g%3E%3C/svg%3E");
    opacity: var(--doodle-opacity);
    z-index: 1;
    pointer-events: none;
}

.theme-dark .wa-chat-doodle {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M50 50c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10zM10 10c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10S0 25.523 0 20s4.477-10 10-10zm10 8c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm40 40c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8z'/%3E%3C/g%3E%3C/svg%3E");
}

.wa-chat-messages-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    z-index: 2;
    scroll-behavior: auto;
}

.wa-chat-messages-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100%;
    justify-content: flex-end;
}

/* Load more indicators */
.load-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 10px 0;
}

.small-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--wa-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Chat Message Bubbles */
.wa-bubble-wrapper {
    display: flex;
    width: 100%;
    margin-bottom: 2px;
}

.wa-bubble-wrapper.align-right {
    justify-content: flex-end;
}

.wa-bubble-wrapper.align-left {
    justify-content: flex-start;
}

.wa-bubble-wrapper.align-center {
    justify-content: center;
    margin: 8px 0;
}

/* Main bubble frame */
.wa-bubble {
    position: relative;
    max-width: 65%;
    padding: 6px 10px 8px 10px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
}

.wa-bubble-text {
    white-space: pre-wrap;
}

.wa-bubble-wrapper.align-left .wa-bubble {
    background-color: var(--bubble-in);
    color: var(--text-primary);
    border-top-left-radius: 0;
}

.wa-bubble-wrapper.align-right .wa-bubble {
    background-color: var(--bubble-out);
    color: var(--text-primary);
    border-top-right-radius: 0;
}

/* System Messages */
.wa-bubble-system {
    background-color: var(--bg-chat-header);
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 5px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    text-align: center;
    max-width: 85%;
    font-weight: 500;
}

/* Sender Labels */
.wa-bubble-sender {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: #e53e3e; /* dynamic styling later */
}

/* Text Highlight for Search */
.highlight {
    background-color: rgba(255, 235, 59, 0.4);
    color: inherit;
    border-radius: 2px;
}

.highlight.current {
    background-color: #f57f17;
    color: #000000;
}

/* Message Meta (Time & Status) */
.wa-bubble-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    float: right;
    margin-top: 4px;
    margin-left: 12px;
    font-size: 0.68rem;
    color: var(--text-bubble-time);
    user-select: none;
}

.wa-bubble-wrapper.align-right .wa-bubble-meta {
    margin-right: -4px;
}

.wa-bubble-meta svg {
    width: 13px;
    height: 13px;
}

.read-tick {
    color: var(--wa-teal);
}

.sent-tick {
    color: var(--text-bubble-time);
}

/* Media in Bubbles */
.wa-media-container {
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
    background-color: rgba(0,0,0,0.05);
    max-width: 100%;
}

.wa-bubble-image {
    display: block;
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.wa-bubble-image:hover {
    opacity: 0.95;
}

.wa-bubble-video {
    display: block;
    width: 100%;
    max-height: 250px;
    outline: none;
    pointer-events: none;
}

/* Custom Voice Note Card */
.wa-audio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px;
    width: 260px;
}

.wa-audio-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.wa-audio-play-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.wa-audio-play-btn svg {
    width: 20px;
    height: 20px;
}

.wa-audio-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-audio-waveform-bar {
    width: 100%;
    height: 16px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.wa-audio-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.wa-audio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--wa-green);
    cursor: pointer;
}

.wa-audio-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.wa-audio-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wa-audio-speed-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background-color: rgba(0,0,0,0.08);
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
}

.wa-audio-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #8696a0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
}

.wa-audio-avatar svg {
    width: 18px;
    height: 18px;
}

.wa-audio-mic-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--wa-teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-audio-mic-badge svg {
    width: 8px;
    height: 8px;
}

/* Video Bubble Overlay & Play Button */
.wa-video-wrapper {
    position: relative;
    cursor: pointer;
    display: block;
    width: 100%;
    max-height: 300px;
    overflow: hidden;
    border-radius: 6px;
}

.wa-video-wrapper .wa-bubble-video {
    object-fit: cover;
    pointer-events: none;
}

.wa-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), opacity 0.2s ease;
    z-index: 3;
}

.wa-video-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.wa-video-wrapper:hover .wa-video-overlay:not(.hidden) {
    background-color: rgba(0, 0, 0, 0.25);
}

.wa-video-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(11, 20, 26, 0.8);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.wa-video-play-btn svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
    margin-left: 2px;
}

/* Video expand/fullscreen button */
.wa-video-expand-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(11, 20, 26, 0.7);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.wa-video-wrapper:hover .wa-video-expand-btn {
    opacity: 1;
}

.wa-video-expand-btn:hover {
    background-color: rgba(11, 20, 26, 0.9);
}

.wa-video-expand-btn svg {
    width: 16px;
    height: 16px;
}

/* Link Previews */
.wa-link-preview {
    display: flex;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 6px;
    border-left: 4px solid var(--wa-green);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.theme-dark .wa-link-preview {
    background-color: rgba(255, 255, 255, 0.05);
}

.wa-link-preview:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.theme-dark .wa-link-preview:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.wa-link-preview-content {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wa-link-preview-domain {
    font-size: 0.7rem;
    color: var(--wa-green);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.wa-link-preview-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-link-preview-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.wa-link-preview-thumb {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background-color: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.theme-dark .wa-link-preview-thumb {
    background-color: rgba(255, 255, 255, 0.1);
}

.wa-link-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wa-link-preview-thumb svg {
    width: 24px;
    height: 24px;
}

/* Also style links inside bubble text */
.wa-bubble-text a {
    color: #53bdeb;
    text-decoration: none;
}

.wa-bubble-text a:hover {
    text-decoration: underline;
}

/* Document Attachment Bubble */
.wa-doc-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(0,0,0,0.05);
    border-radius: 6px;
    padding: 10px;
    width: 270px; /* Slightly wider to accommodate two buttons nicely */
    margin-bottom: 4px;
}

.wa-doc-card.disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.wa-doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background-color: #ff5b5b; /* Default PDF color */
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-doc-icon svg {
    width: 18px;
    height: 18px;
}

.wa-doc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wa-doc-name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.wa-doc-size {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.wa-doc-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.wa-doc-action-btn:hover {
    background-color: rgba(0,0,0,0.08);
    color: var(--text-primary);
}

.theme-dark .wa-doc-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Scroll Bottom Floating Button */
.btn-scroll-bottom {
    position: absolute;
    bottom: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-chat-header);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.btn-scroll-bottom:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.btn-scroll-bottom svg {
    width: 20px;
    height: 20px;
}

.btn-scroll-bottom .badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background-color: var(--wa-teal);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Mock Footer Design */
.wa-footer {
    height: 52px;
    background-color: var(--bg-chat-footer);
    display: flex;
    align-items: center;
    padding: 5px 16px;
    gap: 12px;
    z-index: 10;
    border-top: 1px solid var(--border-color);
}

.wa-footer-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.wa-footer-btn:hover {
    color: var(--text-primary);
}

.wa-footer-btn svg {
    width: 22px;
    height: 22px;
}

.wa-input-mock {
    flex: 1;
    background-color: var(--bg-sidebar);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: not-allowed;
    user-select: none;
}

/* ----------------------------------------------------
   LIGHTBOX MODAL
   ---------------------------------------------------- */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: rgba(20, 20, 20, 0.85);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10001;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.lightbox-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lightbox-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--wa-green);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.lightbox-sender-info h4 {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.lightbox-sender-info p {
    color: #a0aec0;
    font-size: 0.72rem;
}

.lightbox-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lightbox-header-btn {
    background: transparent;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background-color var(--transition-fast);
    text-decoration: none;
}

.lightbox-header-btn:hover {
    color: #ffffff;
    background-color: rgba(255,255,255,0.1);
}

.lightbox-header-btn svg {
    width: 20px;
    height: 20px;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 60px;
}

.lightbox-content img, .lightbox-content video {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

#lightbox-caption {
    color: #ffffff;
    font-size: 0.95rem;
    text-align: center;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    z-index: 10002;
}

.lightbox-nav:hover {
    background-color: rgba(255,255,255,0.25);
}

.lightbox-nav svg {
    width: 24px;
    height: 24px;
}

.nav-left { left: 30px; }
.nav-right { right: 30px; }

/* ----------------------------------------------------
   ANIMATIONS & RESPONSIVE DESIGN
   ---------------------------------------------------- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hover Scale Utility */
.hover-scale:hover {
    transform: scale(1.05);
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(120, 120, 120, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 120, 120, 0.5);
}

/* Tablet & Mobile responsive Adjustments */
@media (max-width: 900px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
    .workspace-container {
        flex-direction: column;
    }
    .workspace-sidebar {
        width: 100%;
        height: 250px;
    }
}
