/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: #f5f5f5;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    gap: 15px;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4285f4;
}

.back-btn:hover {
    background-color: rgba(66, 133, 244, 0.1);
    transform: scale(1.1);
}

.back-btn:active {
    transform: scale(0.95);
}

.header h1 {
    font-size: 24px;
    color: #333;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.toggle-btn:hover {
    background-color: #f0f0f0;
}

/* Container Layout */
.container {
    display: flex;
    height: 100vh;
    padding-top: 60px;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: #fff;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    overflow-y: auto;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    z-index: 999;
    flex-shrink: 0;
}

.sidebar.hidden {
    transform: translateX(-100%);
    margin-left: -350px;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    transition: margin-left 0.3s ease;
}

/* When sidebar is hidden, expand map container */
.sidebar.hidden ~ .map-container {
    margin-left: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 18px;
    color: #333;
}

.clear-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.clear-btn:hover {
    background: #cc0000;
}

/* Pins List */
.pins-list {
    padding: 10px;
}

.pin-item {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.pin-item:hover {
    background: #f0f0f0;
    border-color: #4285f4;
    transform: translateX(5px);
}

.pin-item h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.pin-item p {
    font-size: 14px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pin-item .pin-meta {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s;
}

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

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.form-group input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

/* No Pins State */
.no-pins {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.no-pins-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Image Preview */
.image-preview {
    margin-top: 10px;
    max-height: 200px;
    overflow: hidden;
    border-radius: 6px;
    display: none;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel {
    background: #f0f0f0;
    color: #333;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-submit {
    background: #4285f4;
    color: white;
}

.btn-submit:hover {
    background: #3367d6;
}

/* Custom Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.leaflet-popup-content {
    margin: 15px;
    min-width: 200px;
    max-width: 300px;
}

.popup-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.popup-content p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 14px;
}

.popup-content img {
    width: 100%;
    border-radius: 4px;
    margin-top: 10px;
}

.popup-content .delete-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.popup-content .delete-btn:hover {
    background: #cc0000;
}

/* Custom Marker Icon */
.custom-marker {
    background: #4285f4;
    border: 3px solid #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        width: 280px;
        z-index: 998;
        transform: translateX(-100%);
        margin-left: 0;
    }
    
    .sidebar.hidden {
        transform: translateX(0);
    }
    
    .map-container {
        margin-left: 0 !important;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .header h1 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .btn-cancel,
    .btn-submit {
        width: 100%;
    }
}
