/* ==========================================================================
   VIBEOFFICE AI DESIGN SYSTEM & CORE CSS
   ========================================================================== */

:root {
    /* Fonts */
    --font-primary: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Theme-specific variables (default Beach Day) */
    --bg-gradient: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    --panel-bg: rgba(255, 255, 255, 0.35);
    --panel-border: rgba(255, 255, 255, 0.4);
    --panel-shadow: rgba(31, 38, 135, 0.1);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-light: #64748b;
    
    /* Neon Glow Accents */
    --color-accent: #0284c7;
    --color-accent-glow: rgba(2, 132, 199, 0.35);
    
    /* Agent Accent Colors */
    --color-cyan: #06b6d4;
    --color-gold: #f59e0b;
    --color-purple: #8b5cf6;
    --color-emerald: #10b981;
    --color-rose: #f43f5e;
    
    /* Layout Sizes */
    --header-height: 80px;
    --footer-height: 180px;
    --border-radius-lg: 20px;
    --border-radius-md: 12px;
}

/* Theme 2: Cozy Sunset / Night */
body.theme-night {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
    --panel-bg: rgba(15, 23, 42, 0.6);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-shadow: rgba(0, 0, 0, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;
    --color-accent: #d946ef;
    --color-accent-glow: rgba(217, 70, 239, 0.4);
}

/* Theme 3: Cyberpunk / Neon Office */
body.theme-cyber {
    --bg-gradient: linear-gradient(135deg, #050508 0%, #0d0b21 100%);
    --panel-bg: rgba(6, 6, 15, 0.75);
    --panel-border: rgba(100, 255, 218, 0.15);
    --panel-shadow: rgba(0, 255, 218, 0.05);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --color-accent: #64ffda;
    --color-accent-glow: rgba(100, 255, 218, 0.3);
}

/* ==========================================================================
   BASE & RESET STYLES
   ========================================================================== */

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

body, html {
    font-family: var(--font-primary);
    background: var(--bg-gradient);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: background 1s ease;
}

canvas#beach-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* ==========================================================================
   GLASSMORPHISM UTILITIES
   ========================================================================== */

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 32px 0 var(--panel-shadow);
    border-radius: var(--border-radius-lg);
    transition: background 0.5s ease, border 0.5s ease, box-shadow 0.5s ease;
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 4px 14px var(--color-accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--color-accent-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
}

.btn-clear {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
    padding: 6px;
    border-radius: 50%;
}

.btn-clear:hover {
    color: var(--color-rose);
    background: rgba(244, 63, 94, 0.1);
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */

.main-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

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

.brand-icon {
    font-size: 2rem;
    color: var(--color-accent);
    filter: drop-shadow(0 2px 8px var(--color-accent-glow));
    animation: rotate-slow 20s linear infinite;
}

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

.brand-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

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

.brand-text .subtitle {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-night .stat-badge {
    background: rgba(255, 255, 255, 0.05);
}

.stat-badge i {
    color: var(--color-accent);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.time-widget {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.08);
    padding: 8px 14px;
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
}

body.theme-night .time-widget {
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   WORKSPACE GRID (LOBBY + CONTROL)
   ========================================================================== */

.workspace-main {
    flex: 1;
    display: grid;
    grid-template-columns: 80px 1fr 400px;
    gap: 16px;
    height: calc(100vh - var(--header-height) - var(--footer-height) - 48px);
}

/* ==========================================================================
   LOBBY SECTION (LEFT)
   ========================================================================== */

.lobby-section {
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    position: relative;
    border-radius: var(--border-radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-night .lobby-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.lobby-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
}

.theme-selector {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-night .theme-selector {
    background: rgba(0, 0, 0, 0.3);
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-btn:hover {
    color: var(--text-primary);
}

.theme-btn.active {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 2px 8px var(--color-accent-glow);
}

/* Desks Grid */
.desks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    align-content: start;
    flex: 1;
}

/* ==========================================================================
   AGENT CARDS (THE DESKS)
   ========================================================================== */

.desk-card {
    position: relative;
    border-radius: var(--border-radius-lg);
    padding: 20px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.4s ease, 
                border-color 0.4s ease;
    animation: float 6s ease-in-out infinite alternate;
}

.desk-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--agent-glow);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15), 0 0 15px var(--agent-glow-alpha);
}

.desk-card.active {
    border-color: var(--agent-glow);
    box-shadow: 0 0 20px var(--agent-glow-alpha);
    background: rgba(255, 255, 255, 0.5);
}

body.theme-night .desk-card.active {
    background: rgba(255, 255, 255, 0.08);
}

/* Custom Floating animation offset per card */
.desk-card:nth-child(2n) { animation-delay: -1.5s; }
.desk-card:nth-child(3n) { animation-delay: -3s; }
.desk-card:nth-child(4n) { animation-delay: -4.5s; }

@keyframes float {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-10px); }
}

/* Card Glow Elements based on Agent colors */
.desk-card[data-color="cyan"] { --agent-glow: var(--color-cyan); --agent-glow-alpha: rgba(6, 182, 212, 0.4); }
.desk-card[data-color="gold"] { --agent-glow: var(--color-gold); --agent-glow-alpha: rgba(245, 158, 11, 0.4); }
.desk-card[data-color="purple"] { --agent-glow: var(--color-purple); --agent-glow-alpha: rgba(139, 92, 246, 0.4); }
.desk-card[data-color="emerald"] { --agent-glow: var(--color-emerald); --agent-glow-alpha: rgba(16, 185, 129, 0.4); }
.desk-card[data-color="rose"] { --agent-glow: var(--color-rose); --agent-glow-alpha: rgba(244, 63, 94, 0.4); }

/* Avatar Section */
.avatar-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 12px;
}

.agent-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 100%);
    border: 3px solid var(--agent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.desk-card:hover .agent-avatar {
    transform: rotate(10deg) scale(1.05);
}

.status-ring {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--agent-glow);
    animation: spin 3s linear infinite;
}

.status-ring.active {
    animation-duration: 1s;
}

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

.pulse-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--panel-bg);
    background-color: var(--text-light);
}

.pulse-status-dot.active-working {
    background-color: var(--color-emerald);
    box-shadow: 0 0 10px var(--color-emerald);
    animation: status-pulse 1.2s infinite alternate;
}

.pulse-status-dot.active-thinking {
    background-color: var(--color-gold);
    box-shadow: 0 0 10px var(--color-gold);
    animation: status-pulse 1.2s infinite alternate;
}

.pulse-status-dot.active-resting {
    background-color: var(--color-cyan);
    box-shadow: 0 0 10px var(--color-cyan);
}

@keyframes status-pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.agent-name-label {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 2px;
}

.agent-role-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.agent-status-bubble {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.theme-night .agent-status-bubble {
    background: rgba(255, 255, 255, 0.06);
}

/* Desk Illustration Element */
.desk-illustration {
    margin-top: 16px;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--panel-border) 50%, transparent 100%);
    position: relative;
}

.desk-illustration::after {
    content: "💻";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.desk-card:hover .desk-illustration::after {
    opacity: 0.9;
}

/* Floating status item icon (like coconut drink or book) */
.floating-accessory {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.1rem;
    opacity: 0.3;
    transition: opacity 0.3s, transform 0.3s;
}

.desk-card:hover .floating-accessory {
    opacity: 0.8;
    transform: rotate(-15deg) scale(1.1);
}

/* ==========================================================================
   CONTROL PANEL (RIGHT SIDEBAR)
   ========================================================================== */

.control-panel {
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow: hidden;
}

.panel-header {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 14px;
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.status-indicator-text {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Card details shown when no agent or an agent selected */
.agent-details-card {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.no-selection-placeholder {
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--text-light);
    gap: 16px;
    max-width: 80%;
}

.placeholder-icon {
    font-size: 3.5rem;
    color: var(--text-light);
    opacity: 0.3;
}

.agent-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.agent-large-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    background: var(--agent-color-val, var(--color-accent));
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.agent-info-meta h3 {
    font-size: 1.15rem;
    font-weight: 800;
}

.agent-info-meta p {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
}

.agent-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.agent-stat-box {
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--border-radius-md);
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-night .agent-stat-box {
    background: rgba(255, 255, 255, 0.03);
}

.agent-stat-value {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.agent-stat-label {
    font-size: 0.65rem;
    color: var(--text-light);
    text-transform: uppercase;
    margin-top: 2px;
}

.agent-bio-section {
    background: rgba(255, 255, 255, 0.15);
    padding: 14px;
    border-radius: var(--border-radius-md);
    font-size: 0.85rem;
    line-height: 1.5;
    border: 1px solid rgba(255,255,255,0.08);
}

body.theme-night .agent-bio-section {
    background: rgba(0, 0, 0, 0.15);
}

.agent-bio-section strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
}

/* ==========================================================================
   CHAT SYSTEM
   ========================================================================== */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 6px;
    margin-bottom: 12px;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--color-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px var(--color-accent-glow);
}

.chat-message.agent {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.45);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
}

body.theme-night .chat-message.agent {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-message-time {
    display: block;
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.25);
    padding: 6px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-night .chat-input-wrapper {
    background: rgba(0, 0, 0, 0.25);
}

.chat-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding-left: 14px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
}

.chat-input-wrapper input::placeholder {
    color: var(--text-light);
}

.btn-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--color-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-send:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* ==========================================================================
   CONSOLE LOG TERMINAL (FOOTER)
   ========================================================================== */

.console-footer {
    height: var(--footer-height);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.console-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-title i {
    color: var(--color-accent);
}

.console-title h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.console-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.console-status {
    font-size: 0.75rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-emerald);
    animation: status-pulse 0.8s infinite alternate;
}

.console-terminal {
    flex: 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.45);
    border-radius: var(--border-radius-md);
    padding: 12px;
    line-height: 1.5;
    color: #f8fafc;
    border: 1px solid rgba(255,255,255,0.05);
}

body.theme-night .console-terminal {
    background: rgba(0, 0, 0, 0.6);
}

.log-line {
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line .log-time {
    color: #64748b;
    margin-right: 8px;
}

.log-line.info { color: #94a3b8; }
.log-line.tool { color: #22d3ee; }
.log-line.thought { color: #facc15; }
.log-line.success { color: #4ade80; }
.log-line.error { color: #f87171; }
.log-line.agent-label {
    color: var(--color-accent);
    font-weight: 700;
}

/* ==========================================================================
   MODAL DIALOG (HIRE AGENT)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-box {
    width: 100%;
    max-width: 460px;
    padding: 24px;
    animation: modal-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modal-enter {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
}

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

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

body.theme-night .form-group input,
body.theme-night .form-group select {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.form-group input:focus, 
.form-group select:focus {
    border-color: var(--color-accent);
}

.form-group select option {
    background: var(--bg-gradient);
    color: #000;
}

body.theme-night .form-group select option {
    color: #fff;
    background: #1e1b4b;
}

/* Color Picker in Modal */
.color-picker-grid {
    display: flex;
    gap: 12px;
}

.color-option-container {
    cursor: pointer;
    position: relative;
}

.color-option-container input {
    display: none;
}

.color-circle {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-option-container input:checked + .color-circle {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.bg-cyan { background-color: var(--color-cyan); }
.bg-gold { background-color: var(--color-gold); }
.bg-purple { background-color: var(--color-purple); }
.bg-emerald { background-color: var(--color-emerald); }
.bg-rose { background-color: var(--color-rose); }

/* Helper classes */
.hidden {
    display: none !important;
}

/* ==========================================================================
   RESPONSIVENESS AND TWEAKS
   ========================================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

body.theme-night ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

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

/* ==========================================================================
   STATE-SPECIFIC AGENT WORKER & AVATAR ANIMATIONS
   ========================================================================== */

/* 1. Working Agent Animation: Rapid typing shake and laptop indicator */
.desk-card.status-working .agent-avatar {
    animation: avatar-working-shake 0.35s infinite alternate ease-in-out;
    box-shadow: 0 0 15px var(--agent-glow-alpha);
}
@keyframes avatar-working-shake {
    0% { transform: translate(1.5px, 1.5px) rotate(0deg); }
    100% { transform: translate(-1.5px, -1.5px) rotate(3deg); }
}

.desk-card.status-working .floating-accessory {
    animation: accessory-work-bounce 0.4s infinite alternate ease-in-out;
    opacity: 0.95;
    font-size: 1.3rem;
}
@keyframes accessory-work-bounce {
    0% { transform: scale(1) rotate(-10deg); }
    100% { transform: scale(1.25) rotate(15deg); }
}

/* 2. Thinking Agent Animation: Slow breathing pulse and neon brain glow */
.desk-card.status-thinking .agent-avatar {
    animation: avatar-thinking-pulse 1.8s infinite ease-in-out;
    box-shadow: 0 0 20px var(--agent-glow);
}
@keyframes avatar-thinking-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); box-shadow: 0 0 35px var(--agent-glow); }
    100% { transform: scale(1); }
}

.desk-card.status-thinking .floating-accessory {
    animation: accessory-think-float 1.8s infinite ease-in-out alternate;
    opacity: 0.95;
}
@keyframes accessory-think-float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-8px) scale(1.15); }
}

/* 3. Resting Agent Animation: Swaying hammock rotation */
.desk-card.status-resting .agent-avatar {
    animation: avatar-resting-sway 3s infinite ease-in-out alternate;
}
@keyframes avatar-resting-sway {
    0% { transform: rotate(-8deg) translateY(0); }
    100% { transform: rotate(8deg) translateY(-5px); }
}

.desk-card.status-resting .floating-accessory {
    animation: accessory-resting-bounce 2.2s infinite ease-in-out alternate;
    opacity: 0.95;
}
@keyframes accessory-resting-bounce {
    0% { transform: translateY(0) rotate(-15deg); }
    100% { transform: translateY(-8px) rotate(20deg); }
}

/* 4. Idle Agent Animation: Slow ambient float */
.desk-card.status-idle .agent-avatar {
    animation: avatar-idle-float 4s infinite ease-in-out alternate;
}
@keyframes avatar-idle-float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-3px); }
}

/* ==========================================================================
   FLOATING STATUS PARTICLES (CODE, BUBBLES, ZZZs)
   ========================================================================== */

.particle {
    position: absolute;
    font-weight: 800;
    font-family: var(--font-mono);
    pointer-events: none;
    opacity: 0;
    z-index: 10;
    color: var(--agent-glow, var(--text-primary));
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

body.theme-night .particle {
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
}

.particle.p1 { left: 22%; animation: particle-float 3.5s infinite 0.2s; }
.particle.p2 { left: 48%; animation: particle-float 4.2s infinite 1.2s; }
.particle.p3 { left: 74%; animation: particle-float 3s infinite 2.2s; }

/* Different symbol formatting based on role style */
.status-working .particle {
    color: var(--agent-glow);
}
.status-resting .particle {
    color: #38bdf8; /* light blue for sleep/fresh */
    font-family: var(--font-primary);
    font-size: 1.1rem;
}
.status-thinking .particle {
    color: #f59e0b; /* warm yellow lightbulb vibe */
    font-size: 1.1rem;
}

@keyframes particle-float {
    0% { transform: translateY(50px) scale(0.6) rotate(0deg); opacity: 0; }
    20% { opacity: 0.9; }
    80% { opacity: 0.9; }
    100% { transform: translateY(-90px) scale(1.3) rotate(360deg); opacity: 0; }
}

/* ==========================================================================
   SIDEBAR NAVIGATION SYSTEM
   ========================================================================== */

.sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 8px;
    gap: 16px;
    height: 100%;
}

.nav-item {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

body.theme-night .nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 4px 12px var(--color-accent-glow);
}

.nav-item.active span {
    opacity: 1;
}

/* ==========================================================================
   VIEWPORT & DASHBOARD VIEWS
   ========================================================================== */

.viewport-section {
    flex: 1;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.dashboard-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: view-fade-in 0.4s ease-out forwards;
}

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

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

.view-header h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* ==========================================================================
   CAMPAIGNS MANAGER VIEW
   ========================================================================== */

.campaigns-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.campaign-detail-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.campaign-empty-state {
    margin: auto;
    text-align: center;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 60%;
}

.campaign-empty-state i {
    font-size: 3.5rem;
    opacity: 0.3;
}

.campaign-active-brief {
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: view-fade-in 0.4s ease-out;
}

.campaign-brief-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.brief-meta-item {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--border-radius-md);
    padding: 12px;
    text-align: center;
}

body.theme-night .brief-meta-item {
    background: rgba(255, 255, 255, 0.03);
}

.brief-meta-val {
    display: block;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.brief-meta-lbl {
    font-size: 0.68rem;
    color: var(--text-light);
    text-transform: uppercase;
    margin-top: 2px;
}

.campaign-brief-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.brief-box {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.theme-night .brief-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.04);
}

.brief-box h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--color-accent);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 6px;
}

.brief-box-body {
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-line;
    max-height: 220px;
    overflow-y: auto;
}

.brief-box-body.mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.campaign-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
}

/* ==========================================================================
   CRM TABLE VIEW
   ========================================================================== */

.table-container {
    flex: 1;
    overflow-y: auto;
    border-radius: var(--border-radius-lg);
}

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

.crm-table th {
    background: rgba(0, 0, 0, 0.05);
    padding: 14px 18px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 5;
}

body.theme-night .crm-table th {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.crm-table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.crm-table tbody tr {
    transition: background-color 0.2s;
}

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

body.theme-night .crm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* CRM Filters */
.crm-filters {
    display: flex;
    gap: 8px;
}

.crm-filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 30px;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.crm-filter-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.3);
}

.crm-filter-btn.active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px var(--color-accent-glow);
}

/* Badge System */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-hot {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-followup {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-gold);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-closing {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-cold {
    background: rgba(71, 85, 105, 0.15);
    color: var(--text-light);
    border: 1px solid rgba(71, 85, 105, 0.2);
}

/* Action button inside table */
.btn-table-action {
    background: transparent;
    border: none;
    color: var(--color-accent);
    cursor: pointer;
    font-size: 1rem;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
}

.btn-table-action:hover {
    background: rgba(2, 132, 199, 0.1);
    transform: scale(1.1);
}

/* ==========================================================================
   ANALYTICS VIEW
   ========================================================================== */

.analytics-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.metric-card {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 16px;
}

.metric-icon {
    font-size: 2rem;
    color: var(--color-accent);
    background: rgba(2, 132, 199, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.78rem;
    color: var(--text-light);
    font-weight: 600;
}

.metric-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 2px;
}

.analytics-charts-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.chart-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.chart-panel h3 {
    font-size: 0.98rem;
    font-weight: 800;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 8px;
}

/* Bar Chart Container */
.bar-chart-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 40px;
    align-items: center;
    gap: 12px;
}

.bar-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.bar-wrapper {
    height: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

body.theme-night .bar-wrapper {
    background: rgba(255, 255, 255, 0.05);
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    animation: bar-expand-anim 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes bar-expand-anim {
    from { width: 0% !important; }
}

.bar-percentage {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: right;
    color: var(--text-primary);
}

/* Pie Chart Mock */
.pie-chart-mock {
    margin: auto;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-cyan) 0% 40%,
        var(--color-purple) 40% 65%,
        var(--color-gold) 65% 80%,
        var(--color-rose) 80% 100%
    );
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pie-chart-mock::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    background: var(--panel-bg);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
}

.pie-slice {
    display: none; /* hidden visual fallback, the conic gradient handles drawing */
}

/* ==========================================================================
   SETTINGS VIEW
   ========================================================================== */

.settings-container {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.settings-section-title {
    font-size: 0.98rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-accent);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 8px;
    margin-bottom: 16px;
    margin-top: 10px;
}

.settings-section-title:first-of-type {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-light);
}

.form-group input[readonly] {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(255,255,255,0.05);
    color: var(--text-light);
    cursor: not-allowed;
}

body.theme-night .form-group input[readonly] {
    background: rgba(255, 255, 255, 0.02);
}

/* Domain Monitor System styles */
.domain-monitor-groups {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 8px;
}

@media (max-width: 900px) {
    .domain-monitor-groups {
        grid-template-columns: 1fr;
    }
}

.domain-group-col {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-md);
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-night .domain-group-col {
    background: rgba(255, 255, 255, 0.02);
}

.domain-group-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--color-accent);
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}

.domain-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.domain-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.78rem;
}

.domain-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.domain-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.domain-status-dot.online {
    background-color: var(--color-emerald);
    box-shadow: 0 0 8px var(--color-emerald);
}

.domain-status-dot.offline {
    background-color: var(--color-rose);
    box-shadow: 0 0 8px var(--color-rose);
}

.domain-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.domain-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.domain-latency {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-light);
}

.ssl-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.ssl-active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.ssl-inactive {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.ssl-expired {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-gold);
    border: 1px solid rgba(245, 158, 11, 0.2);
}



