:root {
    --bg-body: #0B0C10;
    --bg-card: #141619;
    --text-main: #FFFFFF;
    --text-muted: #9CA3AF;
    --border-color: #23262e;
    --font-main: 'Inter', sans-serif;
    --content-width: 794px;

    --col-calls: #4ade80;
    --col-web: #60a5fa;
    --col-dir: #fbbf24;
    --col-accent: #00FF99;
    --col-arrow: #ef4444;
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-main);
    display: flex;
    min-height: 100vh;
    margin: 0;
}

/* Remove number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* SIDEBAR */
.sidebar {
    width: 220px; background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 20px 15px; display: flex; flex-direction: column; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}
.logo { font-size: 18px; font-weight: 800; margin-bottom: 20px; text-transform: uppercase; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.logo span { color: var(--col-accent); }

/* SIDEBAR SPACER & BOTTOM BUTTON */
.sidebar-spacer {
    flex: 1;
}

.btn-add-client-bottom {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--col-accent);
    border-radius: 6px;
    color: var(--col-accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 15px;
}

.btn-add-client-bottom:hover {
    background: rgba(0, 255, 153, 0.1);
    border-style: solid;
}

/* CURRENT CLIENT DISPLAY */
.current-client {
    margin-bottom: 15px;
    padding: 10px 12px;
    background: rgba(0, 255, 153, 0.15);
    border: 2px solid var(--col-accent);
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 255, 153, 0.3);
}

.current-client span {
    color: var(--col-accent);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    word-wrap: break-word;
    word-break: break-word;
    display: block;
}

/* CLIENT MODE - Full read-only */
body.client-mode .team-only {
    display: none !important;
}

body.client-mode [contenteditable] {
    pointer-events: none !important;
    cursor: default !important;
    -webkit-user-modify: read-only !important;
}

body.client-mode [contenteditable]:focus {
    background: transparent !important;
}

body.client-mode input,
body.client-mode select,
body.client-mode textarea {
    pointer-events: none !important;
    cursor: default !important;
    opacity: 0.8;
}

body.client-mode .hidden-input {
    display: none !important;
}

body.client-mode .map-controls {
    display: none !important;
}

body.client-mode .arrow-controls-container {
    display: none !important;
}

body.client-mode .controls-buttons {
    display: none !important;
}

body.client-mode .link-input-wrapper {
    display: none !important;
}

body.client-mode .floating-label {
    cursor: default !important;
    pointer-events: none !important;
}

body.client-mode .input-group-col {
    pointer-events: none !important;
}

body.client-mode .merged-inputs-container {
    pointer-events: none !important;
}

body.client-mode .saved-item-delete {
    display: none !important;
}

body.client-mode .stars-container {
    pointer-events: none !important;
}

body.client-mode #ratingValue {
    pointer-events: none !important;
    border: none !important;
}

body.client-mode .donut-container-wrapper input {
    display: none !important;
}

body.client-mode .btn-action.btn-secondary {
    display: none !important;
}

.submenu.collapsed {
    display: none;
}

.menu-item .folder-icon {
    float: right;
    font-size: 8px;
    opacity: 0.6;
}
.menu-item { padding: 8px 10px; margin-bottom: 4px; color: var(--text-muted); border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 13px; }
.menu-item:hover, .menu-item.active { background: rgba(0,255,153,0.1); color: var(--col-accent); }

/* Submenu */
.submenu {
    margin-left: 10px;
    margin-bottom: 6px;
    padding-left: 10px;
    border-left: 1px solid var(--border-color);
}
.submenu-item {
    padding: 6px 10px;
    margin-bottom: 2px;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 12px;
}
.submenu-item:hover {
    background: rgba(0,255,153,0.08);
    color: var(--col-accent);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-body);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 40px 40px 40px;
}

/* Team Toolbar */
.team-toolbar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: var(--content-width);
    box-sizing: border-box;
}

.team-toolbar .btn-action {
    flex: 1;
    text-align: center;
}

/* Client PDF button - hidden for team, shown for client */
.client-pdf-btn {
    display: none;
}

body.client-mode .client-pdf-btn {
    display: block;
}

body.client-mode .client-pdf-btn .btn-action {
    padding: 14px 28px;
    font-size: 15px;
}

#report-container {
    width: var(--content-width);
    min-height: 1123px; /* Height of A4 */
    background-color: var(--bg-body);
    padding: 30px;
    box-sizing: border-box;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* HEADER */
.report-header-section { margin-bottom: 30px; display: flex; justify-content: space-between; align-items: flex-start; }
.header-text-col { flex: 1; }
.report-title { font-size: 32px; font-weight: 800; margin-bottom: 5px; line-height: 1.1; }
.report-date { color: var(--text-muted); font-size: 14px; font-weight: 500; margin-bottom: 20px; display: inline-block; }

.btn-action {
    background: var(--col-accent); color: #000; border: none; padding: 10px 18px;
    border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.3s;
    font-size: 13px;
    box-shadow: 0 0 10px rgba(0, 255, 153, 0.2);
}
.btn-action:hover { background: #00cc7a; }
.btn-action.btn-secondary {
    background: transparent;
    color: var(--col-accent);
    border: 1px solid var(--col-accent);
    box-shadow: none;
}
.btn-action.btn-secondary:hover {
    background: rgba(0, 255, 153, 0.1);
}

/* GRID */
.top-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 30px; }

.card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 20px; display: flex; flex-direction: column;
    margin-bottom: 20px;
    break-inside: avoid;
    page-break-inside: avoid;
}

/* MAP */
.map-card {
    padding: 0 !important;
    position: relative;
    height: 320px;
    overflow: hidden;
    background-color: #1a1a1a;
}

#googleMapFrame { width: 100%; height: 100%; border: none; display: block; }

#staticMapImage {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    display: none;
    z-index: 50;
    background-color: #1a1a1a;
}

#staticMapPlaceholderText {
    display: none;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: #9CA3AF; text-align: center; font-size: 14px; width: 90%;
    z-index: 51;
    pointer-events: none;
}

.map-controls {
    position: absolute; bottom: 10px; left: 10px; right: 10px;
    background: rgba(20, 22, 25, 0.95); padding: 8px; border-radius: 8px;
    display: flex; gap: 8px; border: 1px solid var(--border-color);
    opacity: 0; transition: opacity 0.3s; z-index: 60;
}
.map-card:hover .map-controls { opacity: 1; }
.map-input { flex: 1; background: transparent; border: 1px solid var(--border-color); color: #fff; padding: 5px 10px; border-radius: 4px; font-size: 12px; }
.btn-small { background: var(--col-accent); color: #000; border: none; border-radius: 4px; padding: 8px 12px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; height: auto; }

.map-upload-zone {
    width: 100%; height: 200px; border: 2px dashed var(--border-color); border-radius: 8px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.3s; background-size: cover; background-position: center;
    text-align: center; color: var(--text-muted);
}
.map-upload-zone:hover { border-color: var(--col-accent); color: var(--col-accent); }

/* INFO & REVIEWS */
.client-info-block { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.rating-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#ratingValue { font-size: 24px; font-weight: 700; color: #fff; background: transparent; border: none; border-bottom: 1px dashed #444; width: 50px; text-align: center; cursor: text; }
#ratingValue:focus { outline: none; border-bottom-color: var(--col-accent); color: var(--col-accent); }
.stars-container { display: flex; gap: 4px; cursor: pointer; }
.star { font-size: 24px; color: #333; transition: 0.2s; }
.star.filled { color: #FFD700; text-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }

.reviews-section { margin-bottom: 15px; position: relative; }
.reviews-text { font-size: 16px; color: #fff; display: flex; align-items: baseline; gap: 6px; }
.reviews-count { font-weight: 700; font-size: 18px; }
.reviews-link { color: #fff; text-decoration: underline; text-decoration-color: #555; text-underline-offset: 4px; transition: all 0.3s ease; cursor: pointer; }
.reviews-link:hover { color: var(--col-accent); text-decoration-color: var(--col-accent); }

.link-input-wrapper { max-height: 0; opacity: 0; overflow: hidden; transition: all 0.3s ease; margin-top: 2px; }
.client-info-block:hover .link-input-wrapper { max-height: 30px; opacity: 1; margin-top: 8px; }
.clean-input { background: transparent; border: none; border-bottom: 1px solid var(--border-color); color: var(--text-muted); font-size: 12px; width: 100%; padding: 4px 0; font-family: var(--font-main); }
.clean-input:focus { border-bottom-color: var(--col-accent); color: #fff; outline: none; }

/* TEXT */
.section-heading { font-size: 20px; font-weight: 700; margin-bottom: 15px; color: var(--text-main); break-after: avoid; }
.text-paragraph { color: #ddd; line-height: 1.6; font-size: 14px; margin-bottom: 15px; white-space: pre-line; text-align: justify; }
.metrics-block { background: rgba(255,255,255,0.03); border-radius: 8px; padding: 15px; }
.metric-row { font-size: 14px; margin-bottom: 8px; color: #ddd; }
.styled-list { padding-left: 20px; color: #ddd; line-height: 1.6; list-style-type: disc; }
.styled-list li { margin-bottom: 5px; }
[contenteditable]:focus { background: rgba(255,255,255,0.05); border-radius: 4px; padding: 2px 5px; outline: none; }

/* CHARTS */
.chart-line-container { position: relative; height: 250px; width: 100%; margin-top: 10px; overflow: hidden; }
.donut-container-wrapper { position: relative; height: 350px; width: 100%; display: flex; justify-content: center; align-items: center; margin-top: 10px; overflow: hidden; }
.chart-canvas-area { position: relative; width: 220px; height: 220px; z-index: 2; pointer-events: none; overflow: hidden; }
.donut-inner-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; z-index: 3; }
.donut-number { font-size: 48px; font-weight: 700; color: #fff; line-height: 1.1; }
.donut-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.floating-label { position: absolute; font-size: 14px; color: var(--text-muted); white-space: nowrap; display: flex; align-items: center; gap: 5px; z-index: 100; cursor: move; user-select: none; padding: 5px; }
.label-top { top: 20px; left: 40%; transform: translateX(-50%); }
.label-left { top: 50%; left: 20px; transform: translateY(-50%); }
.label-right { top: 50%; right: 20px; transform: translateY(-50%); flex-direction: row-reverse; }

.chart-legend { display: flex; justify-content: center; gap: 24px; margin-top: 10px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.legend-color { width: 12px; height: 12px; border-radius: 2px; }

/* INPUTS */
.hidden-input { background: transparent; border: none; color: var(--text-muted); font-family: 'Inter'; font-size: 14px; width: 30px; text-align: center; border-bottom: 1px solid transparent; padding: 0; margin: 0 2px; font-weight: 500; cursor: text; }
.hidden-input:hover, .hidden-input:focus { color: #fff; border-bottom: 1px dashed var(--col-accent); }

.merged-inputs-container { display: flex; justify-content: space-between; width: 100%; padding: 0 10px; margin-top: 5px; }
.input-group-col { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px; min-width: 50px; }
.input-date { width: 100%; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); border: none; background: transparent; text-transform: uppercase; margin-bottom: 4px; }
.input-value { width: 100%; text-align: center; font-size: 13px; font-weight: 600; border: none; background: transparent; border-bottom: 1px solid transparent; }
.input-value:focus { border-bottom: 1px dashed #fff; color: #fff; }
.val-gold { color: var(--col-dir); } .val-green { color: var(--col-calls); } .val-blue { color: var(--col-web); }

.chart-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.chart-title { color: var(--text-muted); }
.controls-buttons { display: flex; gap: 15px; align-items: center; }
#startIndexInput:focus { border-bottom: 1px solid #fff !important; color: #fff; }

/* --- ARROW CONTROLS (INVISIBLE/SEPARATE) --- */
.arrow-controls-container {
    display: flex; align-items: center; gap: 15px;
    background: #141619; padding: 5px 10px; border-radius: 8px;
    border: 1px solid #23262e;
    opacity: 0.1; /* Almost invisible */
    transition: opacity 0.3s ease;
}
.arrow-controls-container:hover { opacity: 1; /* Appears on hover */ }

.arrow-group { display: flex; align-items: center; gap: 4px; }
.arrow-dot { width: 8px; height: 8px; border-radius: 50%; }
.arrow-check { margin: 0; cursor: pointer; accent-color: #ef4444; width: 14px; height: 14px; }

.arrow-btn {
    background: transparent; border: 1px solid #444; color: #888;
    width: 20px; height: 20px; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 10px; transition: 0.2s;
}
.arrow-btn:hover { background: #333; color: #fff; border-color: #666; }

.chart-wrapper { display: flex; flex-direction: column; }

/* PAGE CONTAINERS */
.page-container {
    width: var(--content-width);
    min-height: 500px;
    background-color: var(--bg-body);
    padding: 30px;
    box-sizing: border-box;
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* TEMPLATES GRID */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.template-card:hover {
    border-color: var(--col-accent);
    box-shadow: 0 0 15px rgba(0, 255, 153, 0.1);
}

.template-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.template-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.template-date {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
}

.template-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.template-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    border: none;
}

.template-btn.load {
    background: var(--col-accent);
    color: #000;
}

.template-btn.load:hover {
    background: #00cc7a;
}

.template-btn.delete {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
}

.template-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 18px;
    margin-bottom: 10px;
}

.empty-state span {
    font-size: 14px;
    opacity: 0.7;
}

/* FOLDER ITEMS */
.folder-item {
    padding: 6px 8px;
    margin-bottom: 2px;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.folder-item:hover {
    background: rgba(0,255,153,0.08);
    color: var(--col-accent);
}

.folder-item.open {
    color: var(--col-accent);
}

.folder-icon {
    font-size: 8px;
    transition: transform 0.2s;
    display: inline-block;
    opacity: 0.6;
}

.folder-item.open .folder-icon {
    transform: rotate(90deg);
}

.folder-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 12px;
}

.folder-content.open {
    max-height: 500px;
}

.saved-item {
    padding: 5px 8px;
    margin-bottom: 2px;
    color: var(--text-muted);
    border-radius: 3px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.saved-item:hover {
    background: rgba(0,255,153,0.08);
    color: var(--col-accent);
}

.saved-item.active {
    background: rgba(0,255,153,0.25);
    color: var(--col-accent);
    border-left: 3px solid var(--col-accent);
    font-weight: 600;
    box-shadow: 0 0 10px rgba(0,255,153,0.2);
}

.saved-item.active .saved-item-name {
    color: var(--col-accent);
    font-weight: 600;
}

.saved-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-item-delete {
    color: #ef4444;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0 3px;
}

.saved-item:hover .saved-item-delete {
    opacity: 1;
}

.folder-empty {
    padding: 5px 8px;
    color: var(--text-muted);
    font-size: 10px;
    opacity: 0.5;
    font-style: italic;
}

/* Sidebar Section Separator */
.sidebar-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.sidebar-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 10px;
    margin-bottom: 8px;
    opacity: 0.6;
}
