:root {
    --primary-color: #4C8BF5;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --sidebar-width: 350px;
}

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

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.header h1 {
    font-size: 20px;
    margin-bottom: 5px;
}

.header p {
    font-size: 14px;
    color: #888;
}

.filters {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

#search-input,
#stage-filter,
#user-filter,
#region-filter {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

#user-filter {
    margin-bottom: 0;
}

.leads-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.drop-zone:hover,
.drop-zone.active {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.stage-checkbox-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 13px;
    color: #333;
}

.stage-checkbox-item:last-child {
    margin-bottom: 0;
}

.stage-checkbox-item input {
    margin-right: 8px;
    cursor: pointer;
    transform: none;
}

.stage-checkbox-item label {
    cursor: pointer;
    flex: 1;
}

.drop-text h3 {
    font-size: 16px;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.drop-text p {
    font-size: 13px;
    color: #888;
}

.lead-item {
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.lead-item:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.lead-item h3 {
    font-size: 16px;
    margin-bottom: 5px;
    font-weight: 600;
}

.lead-item .price {
    font-weight: 500;
    color: #2e7d32;
    font-size: 14px;
}

.lead-item .status {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    background: #eee;
    border-radius: 12px;
    margin-top: 8px;
    color: #666;
}

#map {
    flex: 1;
    height: 100%;
}

/* InfoWindow Styles */
.gm-style .gm-style-iw-c {
    padding: 0;
    border-radius: 8px;
}

.info-window {
    width: 300px;
    padding: 10px;
}

/* Info Window Layout */
.info-window.has-sidebar {
    width: 550px;
    display: flex;
    gap: 20px;
}

.main-info {
    flex: 1;
}

.side-column {
    flex: 1;
    border-left: 1px solid #ddd;
    padding-left: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-card {
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
}

.info-card h4 {
    margin-top: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 5px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.info-card.competitor {
    background: #fff9c4;
    /* Yellow */
}

.info-card.element.competitor h4 {
    color: #f57c00;
}

.info-card.traffic {
    background: #e3f2fd;
    /* Light Blue */
}

.info-card.traffic h4 {
    color: #1565c0;
}

.info-window h3 {
    margin-bottom: 5px !important;
    font-size: 16px;
    margin-top: 0 !important;
}

.info-window p {
    margin: 0 !important;
    margin-bottom: 2px !important;
    font-size: 14px;
    line-height: 1.15 !important;
}

.comments-section {
    margin: 10px 0;
    padding: 8px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 12px;
    color: #555;
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.3;
    word-wrap: break-word;
    /* Fix overflow */
    overflow-wrap: break-word;
    /* Standard */
}

.tag-online {
    display: inline-block;
    background: #4caf50;
    /* Green to signify online/active */
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
}

.tag-competitor {
    display: inline-block;
    background: #ff9800;
    /* Orange for competitor */
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
}

.info-window .links {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.btn-link {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
}

.btn-link.secondary {
    background: #eee;
    color: #333;
}

/* Custom Map Markers (Hue Rotation) */
.marker-color {
    /* Base is Blue */
    transition: filter 0.2s;
}

.hue-dark-green {
    /* Blue(~210) to Green(~120) requires ~ -90deg rotation. 
       Dark green needs less brightness. */
    filter: hue-rotate(-90deg) brightness(0.7) saturate(1.5);
}

.hue-yellow {
    /* Blue(~210) to Yellow(~50) requires ~ -160deg rotation. Brightness boost helps. */
    filter: hue-rotate(-160deg) brightness(1.5) saturate(2);
}

.hue-red {
    /* Blue(~210) to Red(~0) requires ~ +150deg or -210deg */
    filter: hue-rotate(150deg) saturate(1.5);
}

.hue-blue {
    /* Default */
    filter: none;
}

/* Data Controls */
.data-controls {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 10px;
}

.control-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.control-btn.primary {
    background: #e3f2fd;
    color: #1976d2;
}

.control-btn.primary:hover {
    background: #bbdefb;
}

.control-btn.danger {
    background: #ffebee;
    color: #d32f2f;
}

.control-btn.danger:hover {
    background: #ffcdd2;
}

/* Data Controls */
.data-controls {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 10px;
}

.control-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.control-btn.primary {
    background: #e3f2fd;
    color: #1976d2;
}

.control-btn.primary:hover {
    background: #bbdefb;
}

.control-btn.danger {
    background: #ffebee;
    color: #d32f2f;
}

.control-btn.danger:hover {
    background: #ffcdd2;
}

.date-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

/* --- Responsive Adjustments --- */
@media (max-height: 900px) {
    .sidebar {
        overflow-y: auto;
        /* Enable scroll on the main container */
    }

    .leads-list {
        /* Disable internal scrolling and allow list to expand */
        overflow-y: visible;
        flex: none;
        height: auto;
    }
}