/* Emotional Map Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.stat {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Control Panel */
.control-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}

.view-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary.active {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: white;
}

/* Emotion Legend */
.emotion-legend h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.emotion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.emotion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.emotion-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.emotion-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Map Container */
.map-container {
    position: relative;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

#map {
    height: 600px;
    width: 100%;
}

/* Location Search */
.location-search {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 15px;
    min-width: 300px;
    max-width: 400px;
}

.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.search-input-group input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input-group .btn {
    padding: 10px 15px;
    white-space: nowrap;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid #e9ecef;
    padding-top: 10px;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.search-result-address {
    font-size: 12px;
    color: #666;
}

.search-loading {
    text-align: center;
    padding: 10px;
    color: #666;
    font-style: italic;
}

.search-error {
    text-align: center;
    padding: 10px;
    color: #dc3545;
    font-size: 14px;
}

.search-suggestions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    text-align: center;
    color: #666;
}

.search-suggestions strong {
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
}

.search-suggestions strong:hover {
    color: #764ba2;
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

/* User Panel */
.user-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.user-info h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

.privacy-note {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #004085;
    font-size: 14px;
    line-height: 1.5;
}

.privacy-note i {
    color: #0066cc;
    margin-right: 8px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background-color: #fff;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked+.checkmark {
    background-color: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked+.checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label:hover .checkmark {
    border-color: #667eea;
}

.form-help {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 30px;
    border-radius: 15px;
    width: 95%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

/* New Emotion Selector */
.emotion-selector-new {
    margin-top: 15px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.emotion-selector-new::-webkit-scrollbar {
    width: 6px;
}

.emotion-selector-new::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.emotion-selector-new::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.emotion-selector-new::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.emotion-section {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.emotion-section:last-child {
    margin-bottom: 0;
}

.section-label {
    min-width: 80px;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 8px;
    flex-shrink: 0;
}

.emotion-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.emotion-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
}

.emotion-chip:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.emotion-chip.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
}

.emotion-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.emotion-chip.selected .emotion-dot {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Filter Styles */
.emotion-filter,
.intensity-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.emotion-filter label,
.intensity-filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.emotion-filter label:hover,
.intensity-filter label:hover {
    background: #e9ecef;
}

.emotion-filter input,
.intensity-filter input {
    width: auto;
    margin: 0;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .view-controls {
        justify-content: center;
    }

    .emotion-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    #map {
        height: 400px;
    }

    .location-search {
        position: static;
        margin: 15px;
        min-width: auto;
        max-width: none;
    }

    .map-controls {
        position: static;
        justify-content: center;
        margin: 15px;
    }

    /* New emotion selector mobile adjustments */
    .emotion-selector-new {
        padding: 15px;
        max-height: 300px;
    }

    .emotion-section {
        flex-direction: column;
        gap: 10px;
    }

    .section-label {
        min-width: auto;
        padding-top: 0;
        font-size: 11px;
    }

    .emotion-grid {
        gap: 4px;
    }

    .emotion-chip {
        padding: 3px 6px;
        font-size: 10px;
    }

    .emotion-dot {
        width: 10px;
        height: 10px;
    }

    .modal-content {
        margin: 5% auto;
        width: 98%;
        padding: 20px;
        max-width: none;
    }

    .emotion-selector {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 12px;
    }

    .emotion-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .emotion-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Mobile popup adjustments */
    .ol-popup {
        max-width: 320px;
        min-width: 280px;
        padding: 15px;
    }

    .emotion-popup h3 {
        font-size: 1.2rem;
    }

    .emotion-popup .emotion-color {
        width: 40px;
        height: 40px;
    }

    .emotion-popup .story {
        padding: 12px;
        font-size: 0.9rem;
    }
}

/* Custom OpenLayers Popup Styles */
.ol-popup {
    position: absolute;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    padding: 20px;
    line-height: 1.5;
    max-width: 450px;
    min-width: 350px;
    border: 1px solid #ccc;
    font-family: 'Raleway', sans-serif;
}

.ol-popup:after {
    content: "";
    position: absolute;
    bottom: 100%;
    right: 20px;
    margin-bottom: -10px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent transparent white transparent;
}

.ol-popup-closer {
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 18px;
    color: #666;
    text-decoration: none;
    cursor: pointer;
}

.ol-popup-closer:hover {
    color: #333;
}

.emotion-popup {
    text-align: left;
}

.emotion-popup h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
}

.emotion-popup .emotion-color {
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.emotion-popup .story {
    font-style: italic;
    color: #555;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-size: 1rem;
    line-height: 1.6;
}

.emotion-popup .user-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.emotion-popup .user-info h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}

.emotion-popup .user-info p {
    margin: 5px 0;
    color: #666;
    font-size: 0.9rem;
}

.emotion-popup .user-info strong {
    color: #333;
    font-weight: 600;
}

/* Cluster Popup Styles */
.cluster-popup-container {
    max-width: 400px;
    max-height: 300px;
    overflow-y: auto;
}

.cluster-popup h3 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    font-size: 1.2rem;
}

.cluster-markers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cluster-marker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid #e9ecef;
}

.cluster-marker-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.cluster-marker-item .emotion-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.cluster-marker-item .marker-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cluster-marker-item .marker-info strong {
    color: #333;
    font-size: 14px;
}

.cluster-marker-item .marker-info .intensity {
    color: #666;
    font-size: 12px;
    text-transform: capitalize;
}

.cluster-marker-item .marker-info .user {
    color: #888;
    font-size: 11px;
    font-style: italic;
}