body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

/* Map Container */
#map {
    position: fixed;
    top: 60px; /* Account for topbar */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.2s, background 0.2s;
}

.fab:hover {
    background: #357ABD;
    transform: scale(1.1);
}

.fab:active {
    transform: scale(0.95);
}

.fab.satellite-toggle {
    bottom: 100px; /* Position above the add pin button */
    background: #FF9800;
    font-size: 24px;
}

.fab.satellite-toggle:hover {
    background: #F57C00;
}

/* Quick View Popup (first tap) */
.quick-view {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 16px;
    z-index: 1000;
    max-width: 90%;
    width: 400px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.quick-view.hidden {
    display: none;
}

.quick-view-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.quick-info {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.quick-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.quick-info p {
    font-size: 14px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.quick-thumbnail.hidden {
    display: none;
}

.quick-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.quick-close:hover {
    color: #333;
}

/* Modal (full details/edit) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUpModal 0.3s ease-out;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Desktop modal styling */
@media (min-width: 768px) {
    .modal {
        align-items: center;
        justify-content: center;
    }
    
    .modal-content {
        border-radius: 16px;
        max-width: 600px;
        max-height: 90vh;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Pin Details - View Mode */
.pin-image-container {
    margin-bottom: 20px;
}

.pin-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
}

.field-group {
    margin-bottom: 16px;
}

.field-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.field-group p {
    color: #666;
    line-height: 1.5;
}

.category-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-icon-small {
    width: 24px;
    height: 24px;
}

.attributes-list {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
}

.attribute-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
}

.attribute-item:last-child {
    border-bottom: none;
}

.attribute-key {
    font-weight: 600;
    color: #555;
}

.attribute-value {
    color: #666;
}

/* Edit Mode */
.edit-mode.hidden {
    display: none;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-group input[type="file"] {
    width: 100%;
}

/* Coordinates Input */
.coordinates-inputs {
    display: flex;
    gap: 12px;
}

.coordinates-inputs > div {
    flex: 1;
}

.coordinates-inputs label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #666;
}

.coordinates-inputs input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

.image-preview {
    margin-top: 12px;
    position: relative;
}

.image-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.image-preview.hidden {
    display: none;
}

.btn-remove-image {
    margin-top: 8px;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-remove-image:hover {
    background: #c0392b;
}

/* Attributes Container */
.attributes-container {
    margin-bottom: 12px;
}

.attribute-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.attribute-row input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.attribute-row button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.attribute-row button:hover {
    background: #c0392b;
}

.coordinates-display {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
}

.coordinates-display p {
    font-size: 14px;
    color: #666;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #4A90E2;
    color: white;
}

.btn-primary:hover {
    background: #357ABD;
}

.btn-secondary {
    background: #95A5A6;
    color: white;
}

.btn-secondary:hover {
    background: #7F8C8D;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Custom Leaflet Marker Icons */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-marker img {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .modal-body {
        padding: 16px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Hidden utility */
.hidden {
    display: none !important;
}
