* {
    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;
    padding: 20px;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

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.1rem;
    opacity: 0.9;
}

/* Explore Button */
.explore-btn {
    position: fixed;
    top: 140px;
    left: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(245, 87, 108, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.explore-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(245, 87, 108, 0.6);
}

.explore-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.explore-btn.active {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.explore-btn.active:hover {
    box-shadow: 0 8px 30px rgba(76, 175, 80, 0.6);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: 0 5px 30px rgba(76, 175, 80, 0.8);
    }
}

.explore-icon {
    font-size: 22px;
    animation: rotate 2s linear infinite;
}

.explore-btn:hover .explore-icon {
    animation: rotate 0.5s linear infinite;
}

.explore-btn.active .explore-icon {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#map {
    height: 600px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
    cursor: crosshair;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.3s ease-out;
    margin: auto;
}

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

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

.close:hover {
    color: #333;
}

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

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input[type="file"] {
    padding: 8px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.photo-preview {
    margin-top: 10px;
    max-width: 100%;
    border-radius: 5px;
    overflow: hidden;
}

.photo-preview img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
}

.photo-preview.hidden {
    display: none;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.color-picker input[type="radio"] {
    display: none;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.color-picker input[type="radio"]:checked + .color-option {
    border-color: #333;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px white, 0 0 0 4px #333;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

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

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

.btn-secondary:hover {
    background-color: #d0d0d0;
}

/* Info Panel Styles */
.info-panel {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    max-width: 350px;
    z-index: 999;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px) translateY(-50%);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(-50%);
        opacity: 1;
    }
}

.info-panel.hidden {
    display: none;
}

.close-panel {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.close-panel:hover {
    color: #333;
}

.pin-photo {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
}

.pin-photo img {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
}

.pin-photo.hidden {
    display: none;
}

.info-panel h3 {
    color: #667eea;
    margin-bottom: 15px;
    padding-right: 30px;
}

.info-panel p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.pin-date {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

/* Custom Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 15px;
    font-size: 14px;
}

.popup-name {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.popup-message {
    color: #555;
    margin-bottom: 10px;
    max-height: 100px;
    overflow-y: auto;
}

.popup-date {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

/* Pin Drop Animation */
@keyframes pinDrop {
    0% {
        transform: translateY(-200px) scale(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    70% {
        transform: translateY(10px) scale(1.1);
    }
    85% {
        transform: translateY(-5px) scale(0.95);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.marker-animated {
    animation: pinDrop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Posts Feed */
.posts-feed {
    margin-top: 30px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
}

.feed-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: white;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.posts-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0 20px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.posts-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.post-card {
    min-width: 300px;
    max-width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 20px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.post-card-photo {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
}

.post-card-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-card-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.post-card-message {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-date {
    color: #999;
    font-size: 0.85rem;
    margin-top: 10px;
}

.post-card-location {
    color: #667eea;
    font-size: 0.85rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

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

    header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 0.95rem;
    }

    #map {
        height: 400px;
    }

    .explore-btn {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 16px;
        padding: 12px 20px;
    }

    .explore-btn:hover {
        transform: translateX(-50%) translateY(-3px) scale(1.05);
    }

    /* Mobile-friendly modal */
    .modal {
        padding: 10px;
        align-items: flex-start;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        padding: 20px;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .modal-content h2 {
        font-size: 1.5rem;
        padding-right: 30px;
    }

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

    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }

    .info-panel {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        max-width: 90%;
        max-height: 80vh;
        overflow-y: auto;
    }

    .posts-feed {
        padding: 20px 15px;
    }

    .feed-title {
        font-size: 1.5rem;
    }

    .post-card {
        min-width: 280px;
        max-width: 280px;
    }

    .posts-container {
        gap: 15px;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .modal {
        /* Fix for iOS Safari address bar */
        height: -webkit-fill-available;
    }

    .modal-content {
        /* Ensure content is accessible when keyboard appears */
        position: relative;
    }

    /* Prevent body scroll when modal is open */
    body.modal-open {
        position: fixed;
        width: 100%;
        overflow: hidden;
    }
}
