body { background-color: #050505; margin: 0; padding: 0; display: flex; font-family: sans-serif; overflow: hidden; color: #e2e8f0; }

/* MAGIC SCALING */
html { font-size: 14px; }
@media (max-width: 1440px) { html { font-size: 12px; } }

/* BPG 3.0 IMMERSIVE LOGIN SCREEN STYLES */
#login-screen { 
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 99999; 
    display: flex; transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1); 
    overscroll-behavior: none; background-color: #050505;
}

@keyframes blob {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
    100% { transform: translate(0px, 0px) scale(1); }
}
.animate-blob { animation: blob 12s infinite alternate ease-in-out; }
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }

@keyframes shimmer { 100% { transform: translateX(100%); } }
.group-hover\:animate-shimmer:hover { animation: shimmer 1.5s infinite; }
#login-error, #loading-msg { transition: all 0.3s ease; }

/* SIDEBAR STYLES */
#sidebar { 
    width: 340px; height: 100vh; background: rgba(15, 23, 42, 0.4); 
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05); color: white; 
    position: fixed; left: 0; top: 0; overflow-y: auto; padding: 20px; 
    z-index: 50; box-shadow: 4px 0 30px rgba(0,0,0,0.5);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); /* BPG 3.2 Smooth Slide */
}
body.sidebar-closed #sidebar {
    transform: translateX(-100%);
}

/* MAIN CONTENT UNLOCKED */
#main-content { 
    margin-left: 340px; padding: 20px; width: calc(100% - 340px); 
    display: flex; flex-direction: column; align-items: center; 
    overflow-y: auto; height: 100vh; position: relative; z-index: 10;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1); /* BPG 3.2 Smooth Expansion */
}
body.sidebar-closed #main-content {
    margin-left: 0;
    width: 100%;
}

.slide { 
    width: 100%; max-width: 1200px; min-height: auto; margin-bottom: 40px; 
    position: relative; overflow: visible; background: transparent; 
    flex-shrink: 0; box-sizing: border-box;
}

/* Forms & UI */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 8px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px;}
.form-group input, .form-group select { 
    width: 100%; padding: 12px; border-radius: 8px; 
    border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.3); 
    color: white; font-size: 0.95rem; box-sizing: border-box; transition: all 0.3s ease;
}
.form-group input:focus, .form-group select:focus { border-color: #3b82f6; outline: none; background: rgba(0,0,0,0.5); box-shadow: 0 0 10px rgba(59,130,246,0.3); }

.client-row { display: flex; gap: 6px; margin-bottom: 16px; align-items: center; }
.client-row select, .client-row input[type="number"] { 
    padding: 8px 6px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(0,0,0,0.3); color: white; font-size: 0.85rem; 
    box-sizing: border-box; min-width: 0; transition: all 0.3s ease;
}
.client-row select:focus, .client-row input:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 10px rgba(59,130,246,0.3); }

.client-sel { flex: 2.5; }
.cat-sel { flex: 2; }
.profit-input { flex: 1.8; font-weight: bold; color: #4ade80 !important; text-align: right; }
.btn-remove { flex: 0 0 34px; height: 34px; background: #ef4444; color: white; border: none; padding: 0; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s ease; }
.btn-remove:hover { background: #dc2626; }

/* BPG Premium Custom Client Select Dropdown */
.custom-select-container { position: relative; flex: 2.5; min-width: 0; }
.custom-select-trigger { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(0,0,0,0.3); color: white; font-size: 0.85rem; 
    cursor: pointer; transition: all 0.3s ease; height: 34px; box-sizing: border-box;
    min-width: 0; width: 100%; overflow: hidden;
}
.custom-select-trigger:hover { border-color: #3b82f6; background: rgba(0,0,0,0.5); box-shadow: 0 0 10px rgba(59,130,246,0.3); }
.custom-select-dropdown { 
    position: fixed; /* BPG Fix: Breaks out of the overflow clipping trap */
    width: 260px; 
    background: #0f172a; border: 1px solid rgba(59,130,246,0.4); 
    border-radius: 12px; box-shadow: 0 15px 40px rgba(0,0,0,0.9); 
    z-index: 999999; /* Maximum z-index to overlay everything including buttons */
    opacity: 0; visibility: hidden; transform: translateY(-10px); 
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s; 
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
}
.custom-select-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.custom-select-search-wrapper { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); position: relative; }
.custom-select-search-wrapper i { position: absolute; left: 20px; top: 18px; color: #64748b; font-size: 12px; }
.custom-select-search { 
    width: 100%; padding: 8px 10px 8px 32px !important; border-radius: 8px; 
    background: rgba(0,0,0,0.4) !important; border: 1px solid rgba(255,255,255,0.1) !important; 
    color: white; font-size: 0.8rem;
}
.custom-select-search:focus { border-color: #3b82f6 !important; box-shadow: 0 0 10px rgba(59,130,246,0.3) !important; }
.custom-options-list { max-height: 220px; overflow-y: auto; padding: 6px; }
.custom-options-list::-webkit-scrollbar { width: 4px; }
.custom-options-list::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.5); border-radius: 4px; }
.custom-option { 
    padding: 10px 12px; border-radius: 8px; color: #cbd5e1; font-size: 0.85rem; 
    cursor: pointer; transition: all 0.2s ease; margin-bottom: 2px;
}
.custom-option:hover { background: rgba(59,130,246,0.2); color: white; padding-left: 18px; }
.custom-option.active { background: #3b82f6; color: white; font-weight: bold; }

/* Light Theme Integration for Custom Select */
body.light-theme .custom-select-trigger { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
body.light-theme .custom-select-dropdown { background: rgba(255,255,255,0.95); border-color: #cbd5e1; box-shadow: 0 15px 40px rgba(0,0,0,0.15); }
body.light-theme .custom-select-search { background: #f8fafc !important; color: #0f172a; border-color: #cbd5e1 !important; }
body.light-theme .custom-select-search-wrapper { border-color: rgba(0,0,0,0.05); }
body.light-theme .custom-option { color: #475569; }
body.light-theme .custom-option:hover { background: #eff6ff; color: #1e3a8a; }
body.light-theme .custom-option.active { background: #3b82f6; color: #ffffff; }

.btn-add { background: #3b82f6; color: white; border: none; padding: 12px; width: 100%; border-radius: 6px; cursor: pointer; margin-top: 10px; font-weight: bold;}
.btn-save { background: #8b5cf6; color: white; border: none; padding: 15px; width: 100%; border-radius: 6px; cursor: pointer; margin-top: 25px; font-weight: bold; font-size: 1.1rem;}
.btn-reset { background: transparent; color: #ef4444; border: 2px solid #ef4444; padding: 10px; width: 100%; border-radius: 6px; cursor: pointer; margin-top: 10px; font-weight: bold; transition: all 0.2s ease; }
.btn-reset:hover { background: #ef4444; color: white; }
.btn-print { background: #10b981; color: white; border: none; padding: 15px; width: 100%; border-radius: 6px; cursor: pointer; margin-top: 10px; font-weight: bold; font-size: 1.1rem;}

#admin-panel { display: none; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); padding: 15px; border-radius: 12px; margin-bottom: 20px; }
#user-filter { width: 100%; padding: 10px; border-radius: 8px; background: rgba(0,0,0,0.4); color: white; border: 1px solid rgba(255,255,255,0.1); cursor: pointer; transition: all 0.3s; }
#user-filter:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 10px rgba(59,130,246,0.3); }
#user-filter option { background-color: #0f172a; color: #e2e8f0; }

.title-bar-thin { height: 8px; }
.chart-container-std { height: 350px; width: 100%; }

/* MOBILE RESPONSIVENESS */
@media screen and (max-width: 1024px) {
    body { display: block; background-color: #f1f5f9; }
    #sidebar { position: fixed; top: 0; left: 0; width: 320px; height: 100vh; transform: translateX(-100%); transition: transform 0.3s ease-in-out; z-index: 100; box-shadow: 4px 0 15px rgba(0,0,0,0.5); border-bottom: none; }
    #sidebar.open { transform: translateX(0); }
    #main-content { margin-left: 0; width: 100%; padding: 15px; padding-top: 70px; height: auto; overflow: visible; }
    .slide { width: 100%; min-height: auto; height: auto; padding: 15px !important; margin-bottom: 20px; }
    .slide .flex { flex-direction: column !important; }
    .slide .flex-row { flex-direction: column !important; }
    .slide .w-1\/2, .slide .w-1\/3, .slide .w-2\/3 { width: 100% !important; padding-right: 0 !important; padding-left: 0 !important; margin-bottom: 20px; }
    .chart-container-std, #categoryChart, #client-chart-detailed, #mediaTypeChart, #comparison-chart { width: 100% !important; height: 300px !important; }
    #top-clients-boxes { grid-template-columns: 1fr !important; gap: 10px; }
    .slide h1 { font-size: 1.5rem !important; line-height: 1.2 !important; margin-bottom: 10px; }
    .slide .px-10 { padding-left: 15px !important; padding-right: 15px !important; }
    .title-bar-thin { display: none; }
}

/* ==========================================
   BPG 3.0 PREMIUM LIGHT THEME ENGINE
   ========================================== */
body.light-theme {
    background-color: #f8fafc !important; 
    color: #0f172a !important; 
}

/* Force dark backgrounds to become pristine white */
body.light-theme .bg-\[\#050505\] { background-color: #f8fafc !important; }
body.light-theme .bg-\[\#0f172a\] { background-color: #ffffff !important; border-color: #e2e8f0 !important; }

/* The Fix for the Awkward Sidebar */
body.light-theme #sidebar {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 4px 0 30px rgba(0,0,0,0.05) !important;
}

/* Transform the glass panels */
body.light-theme .bg-white\/5, 
body.light-theme .bg-white\/10 { 
    background-color: #ffffff !important; 
    border-color: #e2e8f0 !important; 
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.03), 0 8px 10px -6px rgba(0,0,0,0.01) !important; 
}

/* Flip text colors */
body.light-theme .text-white { color: #0f172a !important; }
body.light-theme .text-gray-400 { color: #64748b !important; }
body.light-theme .text-gray-300, body.light-theme .text-gray-200 { color: #475569 !important; }
body.light-theme .text-gray-500 { color: #94a3b8 !important; }

/* Flip borders */
body.light-theme .border-white\/5, 
body.light-theme .border-white\/10, 
body.light-theme .border-white\/20,
body.light-theme hr.border-gray-600 { border-color: #e2e8f0 !important; }

/* Style the inputs */
body.light-theme input, 
body.light-theme select, 
body.light-theme textarea { 
    background-color: #f1f5f9 !important; 
    color: #0f172a !important; 
    border-color: #cbd5e1 !important; 
}
body.light-theme input:focus, 
body.light-theme select:focus, 
body.light-theme textarea:focus { 
    background-color: #ffffff !important; 
    border-color: #3b82f6 !important; 
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1) !important;
}

/* Modals & Masks */
body.light-theme #pdf-jank-mask,
body.light-theme #client-modal,
body.light-theme #audit-modal,
body.light-theme #team-modal { background-color: rgba(255,255,255,0.9) !important; backdrop-filter: blur(10px); }
body.light-theme #client-modal .bg-\[\#0f172a\],
body.light-theme #audit-modal .bg-\[\#0f172a\],
body.light-theme #team-modal .bg-\[\#0f172a\] { background-color: #ffffff !important; box-shadow: 0 20px 50px rgba(0,0,0,0.1) !important; border-color: #e2e8f0 !important;}
body.light-theme #client-modal h2,
body.light-theme #audit-modal h2,
body.light-theme #team-modal h2,
body.light-theme #team-modal h3 { color: #0f172a !important; }

/* ========================================== */
/* BPG 3.2 ASK GEMINI AI - LIGHT THEME        */
/* ========================================== */
body.light-theme #gemini-chat-panel { background-color: rgba(255,255,255,0.95) !important; border-color: #d8b4fe !important; }
body.light-theme #gemini-chat-panel .bg-gradient-to-r { background: linear-gradient(to right, #f3e8ff, #e0e7ff) !important; border-bottom-color: #d8b4fe !important; }
body.light-theme #gemini-chat-panel h3 { color: #4c1d95 !important; }
body.light-theme #gemini-chat-panel p.text-purple-300 { color: #7e22ce !important; }
body.light-theme #gemini-chat-history .text-gray-200, 
body.light-theme #gemini-chat-history .text-white { color: #1e293b !important; }
body.light-theme #gemini-chat-history .bg-purple-900\/30 { background-color: #f3e8ff !important; border-color: #d8b4fe !important; color: #1e293b !important; }
body.light-theme #gemini-chat-history .bg-\[\#0f172a\] { background-color: #f1f5f9 !important; color: #1e293b !important; }
body.light-theme #gemini-input { background-color: #ffffff !important; color: #0f172a !important; border-color: #cbd5e1 !important; }
body.light-theme #gemini-input::placeholder { color: #94a3b8 !important; }
body.light-theme #gemini-chat-panel > div:last-child { background-color: #ffffff !important; border-top-color: #d8b4fe !important; }

/* ==========================================
   BPG FIX: RESPONSIVE FULL-SCREEN MODALS
   ========================================== */

/* 1. Remove the left sidebar offset when the sidebar is collapsed */
body.sidebar-closed #team-modal,
body.sidebar-closed #audit-modal,
body.sidebar-closed #client-modal,
body.sidebar-closed #timesheet-modal,
body.sidebar-closed #client-details-modal {
    padding-left: 16px !important;
}

/* 2. Expand the data-heavy modals to fill the new glorious screen space */
body.sidebar-closed #team-modal > div,
body.sidebar-closed #audit-modal > div,
body.sidebar-closed #client-modal > div {
    max-width: 95vw !important;
    width: 100% !important;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}