/* ==========================================================================
   PT. DUVRC WHATSAPP CHATBOT & CRM CUSTOM STYLING
   ========================================================================== */

:root {
    --primary-color: #075E54;
    --primary-dark: #054D44;
    --primary-light: #128C7E;
    --secondary-color: #25D366;
    --accent-color: #34B7F1;
    --bg-chat: #efeae2;
    --bg-chat-dark: #0b141a;
    --bg-light: #f0f2f5;
    --bg-white: #ffffff;
    --text-main: #111b21;
    --text-sub: #667781;
    --text-white: #ffffff;
    --border-color: #e9edef;
    
    /* CRM Colors */
    --crm-bg: #f8fafc;
    --crm-card-bg: #ffffff;
    --crm-border: #e2e8f0;
    --crm-primary: #0f172a;
    --crm-accent: #3b82f6;
    --crm-success: #10b981;
    --crm-warning: #f59e0b;
    --crm-danger: #ef4444;
    
    /* Zoom Theme */
    --zoom-bg: #111214;
    --zoom-card: #202124;
    --zoom-text: #e8eaed;
    --zoom-border: #3c4043;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body {
    background: linear-gradient(135deg, #12372a, #051911);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* ==========================================================================
   COW ANIMATED LOADER
   ========================================================================== */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0a3622 0%, #03140e 100%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.loader-container {
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.cow-svg {
    width: 150px;
    height: 150px;
    margin-bottom: 25px;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.4));
}

.cow-head {
    animation: headBob 2.5s ease-in-out infinite;
    transform-origin: 100px 110px;
}

.cow-ear-left {
    animation: wiggleEarLeft 3s ease-in-out infinite;
    transform-origin: 70px 75px;
}

.cow-ear-right {
    animation: wiggleEarRight 3.2s ease-in-out infinite;
    transform-origin: 130px 75px;
}

.cow-grass {
    animation: chewGrass 1s ease-in-out infinite;
    transform-origin: 90px 115px;
}

.cow-eye-left, .cow-eye-right {
    animation: cowBlink 4s infinite;
    transform-origin: center;
}

.loader-title {
    color: var(--text-white);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.loader-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    margin-bottom: 30px;
    font-weight: 300;
}

.progress-bar-wrapper {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-light));
    border-radius: 10px;
    transition: width 0.1s linear;
}

.progress-text {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    font-family: monospace;
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */
#app-container {
    opacity: 0;
    visibility: hidden;
    width: 95vw;
    max-width: 1550px;
    height: 92vh;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

.app-header {
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

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

.brand-logo {
    background: var(--bg-white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
}

.brand-text p {
    font-size: 0.72rem;
    color: #94a3b8;
}

.nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    gap: 4px;
}

.nav-tabs.hidden-nav {
    display: none !important;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: white;
}

.tab-btn.active {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background: var(--crm-bg);
}

.view-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view-panel.active {
    display: flex;
    opacity: 1;
    position: relative;
}

/* ==========================================================================
   VIEW A: WHATSAPP WEB UI
   ========================================================================== */
.whatsapp-layout {
    display: flex;
    width: 100%;
    height: 100%;
    background: #eae6df;
}

.wa-sidebar {
    width: 30%;
    min-width: 320px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.wa-sidebar-header {
    background: var(--bg-light);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.wa-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.wa-header-icons {
    display: flex;
    gap: 20px;
    color: #54656f;
    font-size: 1.2rem;
}

.wa-header-icons i {
    cursor: pointer;
    transition: var(--transition-fast);
}

.wa-header-icons i:hover {
    color: var(--primary-color);
}

.wa-search-container {
    padding: 8px 12px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
}

.wa-search-wrapper {
    background: var(--bg-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    gap: 12px;
}

.wa-search-wrapper i {
    color: var(--text-sub);
    font-size: 0.9rem;
}

.wa-search-wrapper input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}

.wa-chats-list {
    flex: 1;
    overflow-y: auto;
}

.wa-chat-item {
    display: flex;
    padding: 12px 16px;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.wa-chat-item:hover, .wa-chat-item.active {
    background: var(--bg-light);
}

.wa-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e1f5fe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    position: relative;
}

.wa-chat-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--secondary-color);
    border-radius: 50%;
    border: 2px solid white;
}

.wa-chat-details {
    flex: 1;
    overflow: hidden;
}

.wa-chat-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.wa-chat-meta h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.wa-chat-meta span {
    font-size: 0.75rem;
    color: var(--text-sub);
}

.wa-chat-preview {
    font-size: 0.85rem;
    color: var(--text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    position: relative;
}

.wa-chat-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
}

.wa-chat-header {
    background: var(--bg-light);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}

.wa-chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-chat-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.wa-chat-info p {
    font-size: 0.75rem;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 4px;
}

.wa-online-dot {
    width: 6px;
    height: 6px;
    background: var(--secondary-color);
    border-radius: 50%;
    display: inline-block;
}

.wa-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lang-switch {
    display: flex;
    background: #e2e8f0;
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    color: #475569;
    transition: var(--transition-fast);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
}

.wa-messages-container {
    flex: 1;
    padding: 20px 40px;
    overflow-y: auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wa-bubble-wrapper {
    display: flex;
    width: 100%;
}

.wa-bubble-wrapper.system {
    justify-content: center;
    margin: 10px 0;
}

.wa-system-message {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: #54656f;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.wa-bubble-wrapper.ai { justify-content: flex-start; }
.wa-bubble-wrapper.user { justify-content: flex-end; }

.wa-bubble {
    max-width: 70%;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
}

.wa-bubble-wrapper.ai .wa-bubble {
    background: var(--bg-white);
    color: var(--text-main);
    border-top-left-radius: 0;
}

.wa-bubble-wrapper.user .wa-bubble {
    background: #d9fdd3;
    color: var(--text-main);
    border-top-right-radius: 0;
}

.wa-time {
    align-self: flex-end;
    font-size: 0.68rem;
    color: var(--text-sub);
    margin-top: 4px;
}

/* Rich Message Cards */
.wa-card {
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-top: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left: 4px solid var(--primary-color);
}

.wa-card-header {
    background: #e2e8f0;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.wa-card-body {
    padding: 10px 12px;
    font-size: 0.85rem;
}

.wa-card-body p {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #334155;
}

.wa-card-footer {
    padding: 8px 12px;
    background: #f1f5f9;
    display: flex;
    gap: 8px;
}

.wa-card-btn {
    flex: 1;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.wa-card-btn.primary {
    background: var(--primary-color);
    color: white;
}

.wa-card-btn.primary:hover {
    background: var(--primary-dark);
}

.wa-card-btn.secondary {
    background: #e2e8f0;
    color: #334155;
}

.wa-card-btn.secondary:hover {
    background: #cbd5e1;
}

/* Document & Attachment Messages styling */
.doc-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f0f2f5;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    margin-top: 5px;
    min-width: 220px;
}

.doc-bubble-icon {
    font-size: 2rem;
    color: #ef4444;
}

.doc-bubble-details {
    flex: 1;
    overflow: hidden;
}

.doc-bubble-name {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.doc-bubble-meta {
    font-size: 0.7rem;
    color: var(--text-sub);
}

.doc-bubble-download {
    font-size: 1.1rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.doc-bubble-download:hover {
    color: var(--primary-dark);
}

/* File uploading indicator */
.upload-progress-wrapper {
    background: #e2e8f0;
    border-radius: 4px;
    height: 4px;
    width: 100%;
    margin-top: 5px;
    overflow: hidden;
}

.upload-progress-bar {
    background: var(--secondary-color);
    height: 100%;
    width: 0%;
    transition: width 0.1s linear;
}

/* Emoji Picker & Document Popover Panels */
.emoji-popover {
    position: absolute;
    bottom: 75px;
    left: 15px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    width: 290px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
    animation: slideUpFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.emoji-popover.active {
    display: flex;
}

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

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition-fast);
    padding: 4px;
}

.emoji-item:hover {
    background: var(--bg-light);
    transform: scale(1.15);
}

/* Inline form for registration */
.chat-form-container {
    background: #f8fafc;
    border: 1.5px dashed var(--primary-light);
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
}

.chat-form-container h4 {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.chat-form-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.8rem;
    outline: none;
}

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

.chat-form-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.chat-form-btn:hover {
    background: var(--primary-dark);
}

.wa-quick-replies {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    z-index: 1;
}

.wa-quick-btn {
    background: var(--bg-light);
    border: 1px solid #e9edef;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wa-quick-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Sidebar and Chat Dropdown Menus */
.wa-dropdown-menu {
    display: none;
    position: absolute;
    top: 50px;
    right: 15px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    width: 200px;
    padding: 6px 0;
    animation: dropdownFadeIn 0.2s ease;
}

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

.wa-dropdown-item {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-fast);
}

.wa-dropdown-item:hover {
    background: var(--bg-light);
}

.wa-dropdown-item i {
    font-size: 0.95rem;
    width: 16px;
    text-align: center;
    color: var(--text-sub);
}

.wa-chat-input-area {
    background: var(--bg-light);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 60px;
    z-index: 1;
    border-top: 1px solid var(--border-color);
}

.wa-input-icons {
    color: #54656f;
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.wa-input-icons:hover {
    color: var(--primary-color);
}

.wa-input-wrapper {
    flex: 1;
    background: var(--bg-white);
    border-radius: 8px;
    padding: 8px 12px;
}

.wa-input-wrapper input {
    border: none;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-main);
}

.wa-send-btn {
    border: none;
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.wa-send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ==========================================================================
   VIEW B: MAIN CRM PORTAL
   ========================================================================== */
.crm-layout {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    width: 100%;
    height: 100%;
    background: var(--crm-bg);
}

.crm-main-panel {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--crm-border);
    gap: 15px;
}

.crm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.crm-section-header h2 {
    font-size: 1.25rem;
    color: var(--crm-primary);
    font-weight: 700;
}

.crm-analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.crm-card {
    background: var(--crm-card-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.crm-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.crm-card-icon.blue { background: #eff6ff; color: #3b82f6; }
.crm-card-icon.green { background: #ecfdf5; color: #10b981; }
.crm-card-icon.yellow { background: #fffbeb; color: #f59e0b; }
.crm-card-icon.purple { background: #faf5ff; color: #a855f7; }

.crm-card-data h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--crm-primary);
}

.crm-card-data p {
    font-size: 0.7rem;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crm-table-container {
    background: var(--crm-card-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.crm-table-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--crm-primary);
}

.crm-table-wrapper {
    overflow-x: auto;
    flex: 1;
}

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

.crm-table th {
    background: #f8fafc;
    padding: 10px 18px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1.5px solid var(--crm-border);
}

.crm-table td {
    padding: 10px 18px;
    border-bottom: 1px solid var(--crm-border);
    color: #334155;
    vertical-align: middle;
}

.crm-table tbody tr {
    cursor: pointer;
}

.crm-table tbody tr:hover {
    background: #f8fafc;
}

/* CRM Badges */
.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.badge.pending { background: #fffbe6; color: #d46b08; border: 1px solid #ffe58f; }
.badge.approved-manual { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }
.badge.approved-auto { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.badge.rejected { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }

.timer-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-weight: 600;
}

.timer-indicator-bar {
    width: 40px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.timer-progress {
    height: 100%;
    background: var(--crm-warning);
    width: 100%;
}

.crm-row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.crm-btn {
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.crm-btn.approve { background: #e6f7ed; color: #1e7e34; }
.crm-btn.approve:hover { background: #1e7e34; color: white; }
.crm-btn.reject { background: #fdf2f2; color: #cf222e; }
.crm-btn.reject:hover { background: #cf222e; color: white; }
.crm-btn.wa-send { background: #e1f5fe; color: #0288d1; }
.crm-btn.wa-send:hover { background: #0288d1; color: white; }
.crm-btn.inspect { background: #f1f5f9; color: #475569; }
.crm-btn.inspect:hover { background: #475569; color: white; }
.crm-btn.meeting-schedule { background: #faf5ff; color: #8b5cf6; }
.crm-btn.meeting-schedule:hover { background: #8b5cf6; color: white; }

.crm-sidebar-panel {
    background: var(--crm-card-bg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.crm-panel-section {
    border-bottom: 1px solid var(--crm-border);
    padding-bottom: 15px;
}

.crm-panel-section:last-child {
    border-bottom: none;
}

.crm-panel-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--crm-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-setting-group {
    margin-bottom: 10px;
}

.crm-setting-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-sub);
    display: block;
    margin-bottom: 4px;
}

.crm-input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.crm-input-icon-wrapper i {
    position: absolute;
    left: 10px;
    color: var(--text-sub);
    font-size: 0.8rem;
}

.crm-input-icon-wrapper input, .crm-input-icon-wrapper textarea {
    width: 100%;
    padding: 6px 10px 6px 36px;
    border: 1px solid var(--crm-border);
    border-radius: 6px;
    font-size: 0.78rem;
    outline: none;
}

.crm-input-icon-wrapper input:focus, .crm-input-icon-wrapper textarea:focus {
    border-color: var(--crm-accent);
}

.crm-toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.crm-toggle-switch span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--crm-primary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--secondary-color); }
input:checked + .slider:before { transform: translateX(20px); }

/* Simulated Consoles next to each other */
.crm-consoles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.crm-console {
    background: #0f172a;
    border-radius: 8px;
    padding: 10px;
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: #e2e8f0;
    height: 140px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry { line-height: 1.35; word-break: break-all; }
.log-time { color: #64748b; margin-right: 6px; }
.log-type-system { color: #3b82f6; }
.log-type-success { color: #10b981; }
.log-type-error { color: #ef4444; }
.log-type-outgoing { color: #a855f7; }
.log-type-email { color: #06b6d4; }

.empty-table-state {
    text-align: center;
    padding: 30px !important;
    color: var(--text-sub);
}

.empty-table-state i {
    font-size: 2.2rem;
    margin-bottom: 8px;
    color: #cbd5e1;
    display: block;
}

/* CRM Sub-navigation (Broadcasting & Meeting Managers) */
.crm-submenu {
    display: flex;
    border-bottom: 1px solid var(--crm-border);
    margin-bottom: 12px;
    gap: 15px;
}

.crm-sub-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-sub);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.crm-sub-tab.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.crm-content-section {
    display: none;
    flex-direction: column;
    height: 100%;
}

.crm-content-section.active {
    display: flex;
}

/* Group Broadcast view layout */
.broadcast-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 15px;
    height: 100%;
}

.broadcast-col {
    background: white;
    border: 1px solid var(--crm-border);
    border-radius: var(--border-radius);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.group-badge {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 15px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: var(--transition-fast);
}

.group-badge.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==========================================================================
   VIEW C: USER CRM (PORTAL VIEW)
   ========================================================================== */
.user-crm-layout {
    width: 100%;
    height: 100%;
    background: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.user-portal-login {
    background: white;
    border: 1px solid var(--crm-border);
    border-radius: 20px;
    padding: 35px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
}

.user-portal-logo {
    font-size: 3rem;
    margin-bottom: 15px;
}

.user-portal-login h2 {
    font-weight: 700;
    color: var(--crm-primary);
    margin-bottom: 8px;
    font-size: 1.4rem;
}

.user-portal-login p {
    font-size: 0.82rem;
    color: var(--text-sub);
    margin-bottom: 25px;
}

.user-portal-dashboard {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-top: auto;
    margin-bottom: auto;
}

.user-dashboard-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    padding: 20px 25px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-dashboard-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1.3fr;
    padding: 25px;
    gap: 25px;
    flex: 1;
    overflow-y: auto;
}

.user-dashboard-col {
    background: #f8fafc;
    border: 1px solid var(--crm-border);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-status-card {
    background: white;
    border-radius: 8px;
    border-left: 5px solid #cbd5e1;
    padding: 12px 15px;
    box-shadow: var(--shadow-sm);
}

.user-status-card.approved { border-left-color: var(--crm-success); }
.user-status-card.pending { border-left-color: var(--crm-warning); }
.user-status-card.rejected { border-left-color: var(--crm-danger); }

.user-meeting-box {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    color: #0369a1;
}

.user-meeting-box h4 {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.user-meeting-box code {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0c4a6e;
    background: white;
    padding: 4px 12px;
    border-radius: 4px;
    display: inline-block;
    margin: 8px 0;
    letter-spacing: 1px;
}

/* ==========================================================================
   VIEW D: ZOOM-STYLE VIRTUAL MEETING ROOM
   ========================================================================== */
.zoom-layout {
    width: 100%;
    height: 100%;
    background: var(--zoom-bg);
    color: var(--zoom-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Waiting Room Lobby overlay */
.zoom-lobby-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(17, 18, 20, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.lobby-box {
    background: var(--zoom-card);
    border: 1px solid var(--zoom-border);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.lobby-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--crm-accent);
    border-radius: 50%;
    margin: 0 auto 20px auto;
    animation: spinner 1s linear infinite;
}

@keyframes spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.zoom-room-header {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--zoom-border);
}

.zoom-room-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-room-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Virtual video feed layouts */
.zoom-video-stage {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    align-content: center;
    justify-content: center;
    max-height: calc(100% - 60px);
    overflow-y: auto;
}

.zoom-video-stage.presenter-mode {
    grid-template-columns: 2.8fr 1fr;
    grid-template-rows: 1fr;
}

.presentation-screen {
    background: #000;
    border: 1px solid var(--zoom-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.presentation-slide-content {
    text-align: center;
    padding: 30px;
    max-width: 80%;
}

.presentation-slide-content h2 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 1.6rem;
}

.presentation-slide-content p {
    font-size: 0.95rem;
    line-height: 1.5;
}

.zoom-sidebar-feed-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

/* Individual Video Grid Boxes */
.video-box {
    background: var(--zoom-card);
    border: 1.5px solid var(--zoom-border);
    border-radius: 8px;
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
}

.video-box.speaking {
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px rgba(37, 211, 102, 0.4);
}

.video-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #3c4043;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.video-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sound volume pulsing indicator */
.audio-meter-bar {
    display: flex;
    gap: 2px;
    height: 10px;
    align-items: flex-end;
}

.audio-meter-bar span {
    width: 2.5px;
    background: var(--secondary-color);
    border-radius: 2px;
    height: 2px;
}

.video-box.speaking .audio-meter-bar span {
    animation: speakPulse 0.5s ease infinite alternate;
}
.video-box.speaking .audio-meter-bar span:nth-child(2) { animation-delay: 0.1s; }
.video-box.speaking .audio-meter-bar span:nth-child(3) { animation-delay: 0.25s; }

@keyframes speakPulse {
    0% { height: 2px; }
    100% { height: 10px; }
}

.zoom-room-sidebar {
    width: 280px;
    background: var(--zoom-card);
    border-left: 1px solid var(--zoom-border);
    display: none;
    flex-direction: column;
}

.zoom-room-sidebar.active {
    display: flex;
}

.zoom-sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--zoom-border);
    font-weight: 600;
    font-size: 0.85rem;
}

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

.zoom-chat-bubble {
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.75rem;
}

.zoom-chat-bubble strong {
    color: var(--secondary-color);
    display: block;
    margin-bottom: 2px;
}

.zoom-chat-input-area {
    padding: 10px;
    border-top: 1px solid var(--zoom-border);
    display: flex;
    gap: 6px;
}

.zoom-chat-input-area input {
    flex: 1;
    background: #2f3033;
    border: none;
    outline: none;
    border-radius: 4px;
    padding: 6px 10px;
    color: white;
    font-size: 0.78rem;
}

.zoom-chat-input-area button {
    background: var(--crm-accent);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* Control buttons bar zoom */
.zoom-controls {
    background: #1c1e21;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--zoom-border);
    z-index: 10;
}

.zoom-controls-left { font-size: 0.8rem; color: var(--text-sub); }
.zoom-controls-center { display: flex; gap: 12px; }
.zoom-controls-right { display: flex; gap: 12px; }

.zoom-ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3c4043;
    border: none;
    color: white;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.zoom-ctrl-btn:hover { background: #4f5357; }
.zoom-ctrl-btn.active { background: #ea4335; }
.zoom-ctrl-btn.active:hover { background: #d93025; }

.zoom-ctrl-btn.leave {
    background: #ea4335;
    width: 80px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.zoom-ctrl-btn.leave:hover { background: #d93025; }

/* ==========================================================================
   VIEW E: CRM MODAL - CHAT INSPECTOR
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-backdrop.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 85%;
    max-width: 700px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-body-chat {
    flex: 1;
    overflow-y: auto;
    background: #efeae2;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.modal-body-chat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    opacity: 0.05;
    pointer-events: none;
}

.modal-chat-input-area {
    padding: 12px 20px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    font-size: 0.85rem;
}

/* Toast Messages */
.toast-msg {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* General Layout helpers */
.meeting-code-input-wrapper {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.meeting-code-input-wrapper input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--crm-border);
    border-radius: 6px;
    font-size: 0.82rem;
    outline: none;
}

.lobby-users-list {
    background: #fff8f8;
    border: 1px solid #ffe3e3;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}

.lobby-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #ffe3e3;
}

.lobby-user-row:last-child {
    border-bottom: none;
}

/* Responsive adjustment */
@media (max-width: 1200px) {
    #app-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    .crm-layout {
        grid-template-columns: 1.8fr 1.2fr;
    }
}

.wa-mobile-back-btn {
    display: none;
}
.tab-label-short {
    display: none;
}
.tab-label-full {
    display: inline;
}

@media (max-width: 900px) {
    .crm-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    .crm-sidebar-panel {
        border-top: 1px solid var(--crm-border);
        max-height: 400px;
    }
    .wa-sidebar {
        display: none !important;
    }
    .wa-chat-main {
        width: 100% !important;
        display: flex !important;
    }
    .whatsapp-layout.mobile-show-chat .wa-sidebar {
        display: none !important;
    }
    .whatsapp-layout.mobile-show-chat .wa-chat-main {
        display: flex !important;
    }
    .wa-mobile-back-btn {
        display: none !important;
    }
}

/* ==========================================================================
   ADDED: CATEGORIZED EMOJI PICKER
   ========================================================================== */
.emoji-picker-tabs {
    display: flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
    gap: 3px;
    width: 100%;
    margin-bottom: 6px;
}
.emoji-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 6px 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.emoji-tab-btn:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.4);
}
.emoji-tab-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.emoji-grid {
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    width: 100%;
    max-height: 180px;
    overflow-y: auto;
    padding: 2px;
}
.emoji-grid.active {
    display: grid;
}

/* ==========================================================================
   ADDED: WEBSITE EVENT REGISTRATION PORTAL
   ========================================================================== */
.web-register-layout {
    width: 100%;
    height: 100%;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--crm-bg);
}
.web-register-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}
.web-register-header h2 {
    color: var(--primary-color);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.web-register-header p {
    color: var(--text-sub);
    font-size: 0.88rem;
    line-height: 1.5;
}
.web-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 10px;
}
.web-event-card {
    background: white;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}
.web-event-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}
.web-event-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}
.web-event-badge.badge-offline {
    background: #fee2e2;
    color: #ef4444;
}
.web-event-badge.badge-online {
    background: #dbeafe;
    color: #2563eb;
}
.web-event-image-sim {
    height: 120px;
    background: linear-gradient(135deg, var(--bg-light), #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
}
.web-event-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.web-event-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}
.web-event-desc {
    font-size: 0.8rem;
    color: var(--text-sub);
    line-height: 1.45;
    margin-bottom: 12px;
    flex: 1;
}
.web-event-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: #475569;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}
.web-event-details span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.web-event-details span i {
    color: var(--primary-color);
    width: 14px;
}

/* ==========================================================================
   ADDED: SPEAKING AUDIO LEVEL meters
   ========================================================================== */
.video-box.speaking {
    box-shadow: 0 0 0 3px #10b981 !important;
}
.audio-meter-bar {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 10px;
    margin-left: 6px;
}
.audio-meter-bar span {
    display: inline-block;
    width: 3px;
    height: 3px;
    background: #10b981;
    border-radius: 1px;
    transition: height 0.05s ease;
}
.video-box.speaking .audio-meter-bar span {
    animation: bounceAudio 0.8s ease-in-out infinite alternate;
}
.video-box.speaking .audio-meter-bar span:nth-child(2) {
    animation-delay: 0.15s;
}
.video-box.speaking .audio-meter-bar span:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes bounceAudio {
    0% { height: 3px; }
    100% { height: 10px; }
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==========================================================================
   ADDED: CRM LEDGER DASHBOARD INTERACTION & RESPONSIVENESS
   ========================================================================== */

/* Cursor pointer & hover transitions for KPI stats cards */
.crm-card {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

.crm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.crm-card:active {
    transform: translateY(0) scale(0.98);
}

/* Selected active visual feedback */
.crm-card.active {
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 4px 12px rgba(7, 94, 84, 0.15);
    background: #f0fdf4 !important; /* Soft green tint on select */
}

/* Make grid columns wrap on smaller monitors */
@media (max-width: 1024px) {
    .crm-analytics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
}
@media (max-width: 540px) {
    .crm-analytics-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
}

/* Fix desktop widths to maintain clean single-line proportions */
@media (min-width: 993px) {
    .registrants-table {
        table-layout: fixed;
    }
    .registrants-table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 10px 8px !important;
        text-align: center !important;
    }
    .registrants-table th {
        padding: 10px 8px !important;
        text-align: center !important;
        white-space: nowrap !important;
        font-size: 0.76rem !important;
    }
    /* Left-align Personal Info column header and data cells */
    .registrants-table th:nth-child(2), .registrants-table td:nth-child(2) {
        text-align: left !important;
        padding-left: 12px !important;
    }
    .crm-row-actions {
        flex-wrap: nowrap !important;
        justify-content: center !important;
    }
    .timer-cell {
        justify-content: center !important;
    }
    .crm-table td .crm-btn {
        font-size: 0.66rem !important;
        padding: 4px 6px !important;
        flex-shrink: 0 !important;
    }
    .registrants-table th:nth-child(1), .registrants-table td:nth-child(1) { width: 8%; min-width: 85px; } /* Registrant ID */
    .registrants-table th:nth-child(2), .registrants-table td:nth-child(2) { width: 22%; min-width: 180px; } /* Personal Info */
    .registrants-table th:nth-child(3), .registrants-table td:nth-child(3) { width: 18%; min-width: 160px; } /* Event Selected */
    .registrants-table th:nth-child(4), .registrants-table td:nth-child(4) { width: 12%; min-width: 110px; } /* Status */
    .registrants-table th:nth-child(5), .registrants-table td:nth-child(5) { width: 8%; min-width: 80px; }  /* Auto-Approve In */
    .registrants-table th:nth-child(6), .registrants-table td:nth-child(6) { width: 32%; min-width: 350px; } /* Actions */

    /* Donations Table Specific Layout */
    .donations-table {
        table-layout: auto !important;
    }
    .donations-table th,
    .donations-table td {
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        text-align: left !important;
        padding: 6px 6px !important;
        font-size: 0.68rem !important;
        vertical-align: middle !important;
    }
    .donations-table th:nth-child(1), .donations-table td:nth-child(1) { min-width: 110px; } /* Timestamp */
    .donations-table th:nth-child(2), .donations-table td:nth-child(2) { min-width: 120px; } /* Donor Info */
    .donations-table th:nth-child(3), .donations-table td:nth-child(3) { min-width: 50px; }  /* Amount */
    .donations-table th:nth-child(4), .donations-table td:nth-child(4) { min-width: 90px; }  /* UPI Txn ID */
    .donations-table th:nth-child(5), .donations-table td:nth-child(5) { min-width: 70px; }  /* Status */
    .donations-table th:nth-child(6), .donations-table td:nth-child(6) { min-width: 135px; } /* Actions */
}

/* Transform table to card list layout on tablets and mobile screens */
@media (max-width: 992px) {
    .broadcast-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .crm-table-container {
        border-radius: 8px;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .crm-table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 4px;
        border-bottom: none;
    }

    .crm-table-wrapper {
        overflow-x: visible;
    }

    .crm-table, 
    .crm-table thead, 
    .crm-table tbody, 
    .crm-table tr, 
    .crm-table td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Hide standard headers */
    .crm-table thead {
        display: none;
    }

    /* Standard row transforms into a beautiful clean card */
    .crm-table tbody tr {
        background: var(--crm-card-bg);
        border: 1px solid var(--crm-border);
        border-radius: 10px;
        margin-bottom: 16px;
        padding: 14px 16px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
        display: flex;
        flex-direction: column;
        gap: 10px;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .crm-table tbody tr:hover {
        background: var(--crm-card-bg);
        transform: translateY(-2px);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    }

    /* Card rows style: label on left, value on right */
    .crm-table td {
        padding: 8px 0;
        border-bottom: 1px dashed #f1f5f9;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        font-size: 0.8rem;
    }

    /* Actions block formatting */
    .crm-table td:last-child {
        border-bottom: none;
        padding-top: 12px;
        display: block;
        text-align: left;
    }

    /* Mobile labels from data-label */
    .crm-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-sub);
        text-transform: uppercase;
        font-size: 0.65rem;
        letter-spacing: 0.5px;
        float: left;
        text-align: left;
    }

    /* Remove labels where visual container serves the purpose */
    .crm-table td[data-label="ID"]::before,
    .crm-table td[data-label="Actions"]::before {
        display: none;
    }

    /* Custom layout for Registrant ID card header */
    .crm-table td[data-label="ID"] {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #f8fafc;
        margin: -14px -16px 6px -16px;
        padding: 8px 16px;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
        border-bottom: 1px solid var(--crm-border);
    }

    .crm-table td[data-label="ID"] strong {
        font-size: 0.8rem;
    }

    .crm-table td[data-label="ID"] span {
        font-size: 0.7rem;
    }

    .crm-table .crm-row-actions {
        display: flex;
        gap: 8px;
        width: 100%;
        flex-wrap: wrap;
    }

    .crm-table .crm-row-actions button,
    .crm-table .crm-row-actions a {
        flex: 1;
        min-width: 100px;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.75rem;
        border-radius: 6px;
    }

    .user-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* User Portal Live Chat Styling */
.user-portal-chat-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    max-width: 80%;
    line-height: 1.4;
    word-break: break-word;
    display: inline-block;
}
.user-portal-chat-bubble.outgoing {
    background: #e1f5fe;
    color: #0288d1;
    align-self: flex-end;
    border-bottom-right-radius: 0;
}
.user-portal-chat-bubble.incoming {
    background: #f1f5f9;
    color: #1e293b;
    align-self: flex-start;
    border-top-left-radius: 0;
}

/* ==========================================================================
   MOBILE & RESPONSIVE PORTAL IMPROVEMENTS
   ========================================================================== */
.user-crm-layout {
    overflow-y: auto;
}

@media (max-width: 768px) {
    /* Responsive Header & Navigation Switcher */
    .app-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 10px 15px !important;
    }
    
    .brand {
        justify-content: center !important;
    }
    
    .nav-tabs {
        width: 100% !important;
        overflow-x: auto !important;
        padding-bottom: 6px !important;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
    
    .tab-btn {
        flex: 0 0 auto !important;
        padding: 6px 12px !important;
        font-size: 0.76rem !important;
    }

    /* User Dashboard Header responsiveness */
    .user-dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 15px 20px !important;
    }
    
    .user-dashboard-header div {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .user-dashboard-header button.crm-btn {
        margin-left: 0 !important;
    }

    /* Grid columns stack and spacing */
    .user-dashboard-grid {
        grid-template-columns: 1fr !important;
        padding: 15px !important;
        gap: 15px !important;
    }

    .user-docs-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .user-crm-layout {
        display: block !important;
        padding: 10px !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh;
    }
    .user-portal-login {
        padding: 20px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Sticky Bottom Nav Bar for User CRM Portal */
    .user-submenu {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: white !important;
        border-top: 1px solid var(--crm-border) !important;
        border-bottom: none !important;
        margin-bottom: 0 !important;
        display: flex !important;
        justify-content: space-around !important;
        padding: 8px 0 !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
        z-index: 9999 !important;
        gap: 0 !important;
    }
    
    .user-submenu .crm-sub-tab {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0.68rem !important;
        gap: 4px !important;
        padding: 6px 0 !important;
        border-bottom: none !important;
        color: var(--text-sub) !important;
        background: transparent !important;
    }
    
    .user-submenu .crm-sub-tab.active {
        color: var(--crm-primary) !important;
        font-weight: 700 !important;
    }
    
    .user-portal-section {
        padding-bottom: 80px !important;
    }
    .tab-label-short {
        display: inline !important;
    }
    .tab-label-full {
        display: none !important;
    }
    .user-submenu .crm-sub-tab i {
        font-size: 1.2rem !important;
    }
}

@media (max-width: 540px) {
    .modal-content {
        width: 95% !important;
        height: auto !important;
        max-height: 90vh !important;
    }
}

/* Complete compact font overrides for Donations panel elements to guarantee viewport fit */
#crm-sec-donations {
    font-size: 0.7rem !important;
}

#crm-sec-donations h2 {
    font-size: 0.9rem !important;
    margin-bottom: 8px !important;
    font-weight: 700 !important;
}

#crm-sec-donations h3 {
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    margin-bottom: 5px !important;
    color: var(--crm-primary);
}

#crm-sec-donations label {
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    color: var(--text-sub) !important;
    margin-bottom: 3px !important;
}

#crm-sec-donations input {
    font-size: 0.72rem !important;
    padding: 5px 8px !important;
    border-radius: 5px !important;
}

#crm-sec-donations .crm-input-icon-wrapper input {
    padding-left: 36px !important;
}

#crm-sec-donations .crm-input-icon-wrapper i {
    font-size: 0.7rem !important;
    left: 8px !important;
}

#crm-sec-donations small {
    font-size: 0.62rem !important;
    color: var(--text-sub) !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
}

#crm-sec-donations .crm-card {
    padding: 8px 12px !important;
    gap: 8px !important;
    border-radius: 6px !important;
}

#crm-sec-donations .crm-card-data h3 {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
}

#crm-sec-donations .crm-card-data p {
    font-size: 0.62rem !important;
    margin-top: 1px !important;
}

.donations-table td code {
    font-size: 0.65rem !important;
}

.donations-table td .crm-btn {
    font-size: 0.65rem !important;
    padding: 2px 4px !important;
    gap: 2px !important;
}

.donations-table td span {
    font-size: 0.65rem !important;
}


