/* TurfIntel - Modern Monochrome */

:root {
    --text-main: #0f172a;
    --text-muted: #64748b;
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-input: #f1f5f9;
    --border-light: #e2e8f0;
    --font-stack: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--bg-page);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Top Navigation --- */
.top-nav { background-color: var(--bg-surface); padding: 0 32px; height: 70px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-light); z-index: 20; }
.logo { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; }
.logo i { color: #1e293b; }
.nav-actions { display: flex; align-items: center; gap: 20px; }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: color 0.2s; display: flex; align-items: center; gap: 8px; border-bottom: 3px solid transparent; padding: 22px 0; }
.nav-links a:hover { color: var(--text-main); }
.nav-links a.active { color: var(--text-main); border-bottom: 3px solid #0ea5e9; font-weight: 700;}
.nav-links a.admin-link { font-size: 0.85rem; padding-left: 24px; border-left: 1px solid var(--border-light); padding-top: 0; padding-bottom: 0; border-bottom: none; }

/* --- Layout --- */
.app-container { display: flex; flex: 1; overflow: hidden; position: relative; }
.main-content { flex: 1; padding: 40px; overflow-y: auto; width: 100%; position: relative; padding-bottom: 100px; /* Space for dock */ }

/* --- Bulletproof Header --- */
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; gap: 20px; flex-wrap: wrap; }
.header-main { display: flex; align-items: center; gap: 20px; flex: 1; flex-wrap: wrap; }
.header-main h2 { font-size: 1.8rem; font-weight: 700; margin: 0; white-space: nowrap; }

.header-search { position: relative; flex: 1; min-width: 250px; max-width: 400px; }
.header-search input { width: 100%; padding: 12px 14px 12px 40px !important; background-color: var(--bg-surface); border: 1px solid var(--border-light); border-radius: 20px; font-size: 0.95rem; color: var(--text-main); transition: border-color 0.2s; }
.header-search input:focus { outline: none; border-color: #cbd5e1; box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.05); }
.header-search .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.95rem; }
.result-count { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }

/* Live Search Suggestions */
.search-suggestions { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 100; max-height: 300px; overflow-y: auto; display: none; overflow: hidden; }
.search-suggestion-item { padding: 12px 16px; font-size: 0.95rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f1f5f9; transition: background 0.1s; }
.search-suggestion-item:last-child { border-bottom: none; }
.search-suggestion-item:hover { background-color: var(--bg-input); }
.suggestion-category { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; background: var(--border-light); padding: 2px 8px; border-radius: 10px; }

/* --- Filter Panel & UI --- */
.btn-filter-toggle { background: var(--bg-surface); border: 1px solid var(--border-light); padding: 10px 18px; border-radius: 20px; font-size: 0.95rem; font-weight: 600; color: var(--text-main); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; }
.btn-filter-toggle:hover { background: var(--bg-input); border-color: #cbd5e1; }
.top-filter-panel { background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: 12px; padding: 24px; margin-bottom: 32px; box-shadow: 0 4px 6px rgba(0,0,0,0.02); display: none; }
.top-filter-panel.open { display: block; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.filter-section { display: flex; flex-direction: column; gap: 8px; }
.filter-label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.filter-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); text-align: right; }
.btn-text { background: none; border: none; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; cursor: pointer; padding: 8px; }
.btn-text:hover { color: var(--text-main); }
input[type="text"], input[type="number"], select { width: 100%; padding: 12px 14px; background-color: var(--bg-input); border: 1px solid transparent; border-radius: 8px; font-size: 0.95rem; color: var(--text-main); font-family: inherit; transition: all 0.2s; appearance: none; }
input[type="text"]:focus, input[type="number"]:focus, select:focus { outline: none; border-color: #cbd5e1; background-color: var(--bg-surface); box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.05); }

/* --- Buttons --- */
.btn-primary { background: var(--text-main); color: var(--bg-surface); border: none; padding: 10px 16px; font-size: 0.95rem; font-weight: 600; border-radius: 6px; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: #334155; }
.btn-secondary { background-color: transparent; color: var(--text-main); border: 1px solid var(--border-light); padding: 10px 16px; font-size: 0.95rem; font-weight: 600; border-radius: 6px; cursor: pointer; text-align: center; transition: all 0.2s; }
.btn-secondary:hover { background-color: var(--bg-input); border-color: var(--text-main); }

/* --- Main Grid & Cards --- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.product-card { background: var(--bg-surface); border-radius: 12px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.02); transition: transform 0.2s ease, box-shadow 0.2s ease; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; }

/* --- PestCalc Engine UI --- */
.pc-layout { display: flex; gap: 30px; align-items: flex-start; }
.pc-cards-area { flex: 1; overflow: hidden; }
.pc-summary-area { width: 320px; flex-shrink: 0; position: sticky; top: 0; }
.pc-summary-card { background: var(--bg-surface); border-radius: 12px; padding: 24px; border: 1px solid var(--border-light); box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.pc-summary-card h3 { font-size: 1.1rem; color: var(--text-main); margin-bottom: 16px; border-bottom: 2px solid var(--border-light); padding-bottom: 10px; }

/* NEW: Keeps the chart tightly constrained in the sidebar */
.chart-wrapper { position: relative; height: 180px; margin-bottom: 24px; }

.summary-sub { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.pc-totals-list { list-style: none; padding: 0; margin: 0; }
.pc-totals-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.95rem; }
.pc-totals-list li:last-child { border-bottom: none; }
.pc-totals-list .empty-list { color: var(--text-muted); font-style: italic; }

/* Floating Dock */
.pc-dock { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-surface); border-top: 1px solid var(--border-light); padding: 16px 40px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 -5px 20px rgba(0,0,0,0.05); transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 15; }
.pc-dock.show { transform: translateY(0); }
.dock-badge { background: #0ea5e9; color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; }
.dock-btn { background: #0ea5e9; font-size: 1rem; padding: 12px 24px; border-radius: 30px; box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3); transition: transform 0.2s; color: white; border: none; cursor: pointer; font-weight: 600;}
.dock-btn:hover { background: #0284c7; transform: translateY(-2px); }

/* --- Product Detail Drawer --- */
.mobile-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.4); z-index: 25; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.mobile-overlay.open { opacity: 1; pointer-events: auto; }
.detail-drawer { position: fixed; top: 0; right: 0; width: 100%; max-width: 450px; height: 100vh; background: var(--bg-surface); box-shadow: -5px 0 25px rgba(15, 23, 42, 0.1); z-index: 50; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.detail-drawer.open { transform: translateX(0); }
.drawer-header { padding: 24px 32px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: flex-start; background: #f8fafc; }
.drawer-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
.drawer-badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.close-drawer-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; transition: color 0.2s; }
.close-drawer-btn:hover { color: var(--text-main); }
.drawer-body { padding: 32px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 30px; }
.drawer-section h3 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border-light); padding-bottom: 8px; margin-bottom: 16px; }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.data-item { display: flex; flex-direction: column; gap: 4px; }
.full-width-item { grid-column: 1 / -1; margin-bottom: 12px; }
.data-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.data-value { font-size: 0.95rem; font-weight: 500; color: var(--text-main); }
.data-text { font-size: 0.9rem; color: var(--text-main); line-height: 1.5; }

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 900px) {
    .pc-layout { flex-direction: column; }
    .pc-summary-area { width: 100%; position: static; }
}

@media (max-width: 768px) {
    .top-nav { padding: 0 20px; height: 60px;}
    .hide-mobile { display: none; }
    .nav-links { gap: 20px; }
    .main-content { padding: 24px 20px; }
    
    .header-main { flex-direction: column; align-items: flex-start; width: 100%; gap: 12px; }
    .header-search { max-width: 100%; width: 100%; }
    .btn-filter-toggle { width: 100%; justify-content: center; }
    .pc-dock { padding: 16px 20px; flex-direction: column; gap: 12px; }
    .dock-btn { width: 100%; }
}

/* Tom Select Overrides */
.ts-wrapper { width: 100%; }
.ts-control { background-color: var(--bg-input) !important; border: 1px solid transparent !important; border-radius: 8px !important; padding: 12px 14px !important; font-size: 0.95rem; color: var(--text-main); box-shadow: none !important; }
.ts-control > input { font-size: 0.95rem; color: var(--text-main); }
.ts-control.focus { border-color: #cbd5e1 !important; background-color: var(--bg-surface) !important; box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.05) !important; }
.ts-dropdown { border-radius: 8px !important; border: 1px solid var(--border-light) !important; box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important; background-color: var(--bg-surface) !important; margin-top: 4px; }
.ts-dropdown .option { padding: 10px 14px; font-size: 0.95rem; }
.ts-dropdown .active { background-color: var(--bg-input) !important; color: var(--text-main) !important; }

/* --- Navigation Badge --- */
.nav-badge {
    background: #ef4444;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 6px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

/* --- Compact PestCalc UI --- */
.pc-compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.pc-compact-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.pc-compact-card .pc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
}

.pc-compact-card h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
}

.pc-remove-btn {
    background: var(--bg-input);
    border: none;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.pc-remove-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.pc-compact-card .pc-inputs {
    display: flex;
    flex-direction: column; 
    gap: 8px;
    margin-bottom: 20px;
}

.pc-compact-card .pc-inputs input {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-page);
    font-weight: 600;
}

.pc-compact-card .pc-inputs select {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-page);
}

.pc-ai-list {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: auto;
    border: 1px solid var(--border-light);
}

.pc-ai-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #e2e8f0;
    padding: 8px 0;
}

.pc-ai-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pc-ai-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.pc-ai-conc {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 4px;
}

.pc-ai-row strong {
    font-size: 1rem;
    color: #0ea5e9;
    font-family: monospace;
}

/* --- Drawer AI List Fix --- */
.ai-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-light);
}

.ai-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ai-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.ai-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Warning Banner --- */
.warning-banner {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.05);
}

.warning-banner i { color: #f59e0b; font-size: 1.2rem; }

/* --- Basic Feedback Modal --- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--bg-surface); width: 90%; max-width: 450px; border-radius: 12px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); display: flex; flex-direction: column; overflow: hidden; transform: translateY(20px); transition: transform 0.2s; }
.modal-overlay.open .modal-content { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
.modal-header h2 { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--text-main); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 15px; }
.modal-body textarea { width: 100%; padding: 12px; border: 1px solid var(--border-light); border-radius: 6px; font-family: inherit; font-size: 0.95rem; resize: vertical; }

/* --- Authentication UI --- */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: var(--bg-page);
    padding: 20px;
}

.auth-card {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-card h2 { color: var(--text-main); margin-bottom: 8px; font-size: 1.5rem; }
.auth-card p { color: var(--text-muted); margin-bottom: 24px; font-size: 0.95rem; }

.auth-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
}

.auth-btn {
    width: 100%;
    background: #0ea5e9;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 16px;
}
.auth-btn:hover { background: #0284c7; }
.auth-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.auth-link { color: #0ea5e9; cursor: pointer; font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.auth-error { color: #ef4444; font-size: 0.85rem; margin-bottom: 16px; display: none; font-weight: 600; }
.auth-success { color: #10b981; font-size: 0.85rem; margin-bottom: 16px; display: none; font-weight: 600; line-height: 1.4; }