:root {
    --primary: #F3F4F6;
    --secondary: #9CA3AF;
    --gradient-1: #3B82F6;
    --gradient-2: #10B981;
    --card: #1A1A1E;
    --background: #0E0E10;
    --error: #EF4444;
}

main {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.upload-heading {
    padding-top: 7rem;
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--primary);
    font-weight: 700;
}

.upload-card {
    background: var(--card);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.upload-form-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 2rem;
}

/* Image Upload Section */
.image-upload-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.image-upload-area {
    width: 100%;
    aspect-ratio: 4/3;
    border: 2px dashed var(--secondary);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(26, 26, 30, 0.5);
    position: relative;
    overflow: hidden;
}

.image-upload-area:hover {
    border-color: var(--gradient-1);
    background: rgba(59, 130, 246, 0.1);
}

.image-upload-area.drag-over {
    border-color: var(--gradient-2);
    background: rgba(16, 185, 129, 0.15);
}

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--secondary);
    pointer-events: none;
}

.image-placeholder svg {
    width: 64px;
    height: 64px;
}

.image-placeholder p {
    font-size: 1.1rem;
    font-weight: 500;
}

#image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.75rem;
}

/* Form Fields Section */
.form-fields-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.form-field label {
    color: var(--primary);
    font-weight: 500;
    font-size: 1rem;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--secondary);
    border-radius: 0.5rem;
    background: var(--background);
    color: var(--primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-field input:hover,
.form-field textarea:hover {
    border-color: var(--gradient-1);
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--gradient-1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-field input.error,
.form-field textarea.error {
    border-color: var(--error);
}

.form-field input.error:focus,
.form-field textarea.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

#title-input {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.4;
    min-height: 3rem;
    max-height: 4.5rem;
}

#description-input {
    min-height: 6rem;
    max-height: 20rem;
    resize: vertical;
    line-height: 1.6;
}

.char-count {
    font-size: 0.85rem;
    color: var(--secondary);
    text-align: right;
    margin-top: -0.25rem;
}

/* Location Input with Map Button */
.form-field:has(#location-input) {
    position: relative;
}

#location-input {
    padding-right: 3rem;
}

.map-pin-btn {
    position: absolute;
    right: 0.5rem;
    top: 2.5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: transform 0.2s ease;
    pointer-events: auto;
    z-index: 10;
}

.map-pin-btn:hover {
    transform: scale(1.1);
}

.location-input-wrapper {
    position: relative;
    width: 100%;
}

.location-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--secondary);
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.location-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s ease;
}

.location-suggestion:hover {
    background: var(--background);
}

.location-suggestion:last-child {
    border-bottom: none;
}

.location-address-display {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--secondary);
}

.spot-field {
    margin-top: 1rem;
}

.spot-input-wrapper {
    position: relative;
    width: 100%;
}

#spot-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1.5px solid var(--secondary);
    background: var(--card);
    color: var(--primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

#spot-input:focus {
    border-color: var(--gradient-1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.spot-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--secondary);
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.spot-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(34, 197, 94, 0.1); /* green tint */
}

.spot-suggestion:last-child {
    border-bottom: none;
}

.spot-suggestion:hover {
    background: rgba(34, 197, 94, 0.2);
}

.spot-suggestion-pin {
    margin-left: 0.75rem;
}

.map-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.map-search-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    z-index: 1000;
}

.map-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--secondary);
    border-radius: 0.5rem;
    background: var(--card);
    color: var(--primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.map-search-input:focus {
    border-color: var(--gradient-1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.map-search-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    color: var(--primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.map-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.map {
    width: 100%;
    max-width: 800px;
    height: 500px;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* Darken map tiles in upload map picker */
.map .leaflet-tile-container img {
    filter: brightness(0.85) contrast(1.1);
}

/* Spot Preview Panel */
.spot-preview-panel {
    position: absolute;
    width: 20%;
    height: 25%;
    bottom: 27%;
    right: 5.5%;
    max-width: 200px;
    min-width: 150px;
    background: var(--card);
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.spot-preview-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    line-height: 1;
}

.spot-preview-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.spot-preview-image {
    width: 100%;
    height: 70%;
    flex: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 0;
}

.spot-preview-name {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}



.map-controls {
    display: flex;
    gap: 1rem;
}

.confirm-location-btn,
.cancel-map-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-location-btn {
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    color: var(--primary);
}

.confirm-location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.cancel-map-btn {
    background: var(--card);
    color: var(--primary);
    border: 1.5px solid var(--secondary);
}

.cancel-map-btn:hover {
    background: var(--background);
    border-color: var(--primary);
}

/* Upload Button */
.upload-button-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.upload-btn {
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    background-size: 300% 100%;
    color: var(--primary);
    text-transform: uppercase;
    transition: all 0.3s ease;
    min-width: 200px;
}

.upload-btn:not(:disabled):hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--card);
    color: var(--secondary);
}

/* Popups */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
}

.popup-content-box {
    background: var(--card);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.popup-content-box h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.popup-content-box p {
    color: var(--secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.popup-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.popup-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-btn {
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    color: var(--primary);
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.cancel-btn {
    background: var(--background);
    color: var(--primary);
    border: 1.5px solid var(--secondary);
}

.cancel-btn:hover {
    background: var(--card);
    border-color: var(--primary);
}

/* Success Popup */
.success-popup {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    color: var(--primary);
    padding: 1.25rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    z-index: 4000;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    animation: slideDown 0.3s ease;
}

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

.success-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.success-content p {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

/* ---- Upload Map Spot Marker Styles (copied from mapStyle, scoped) ---- */

.spot-marker-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.spot-marker {
    position: relative;
    width: 60px;
    height: 110px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spot-marker:hover {
    transform: scale(1.1);
}

.spot-marker-image-wrapper {
    position: relative;
    width: 60px;
    height: 90px;
    margin: 0 auto;
    overflow: hidden;
    background: rgba(14, 14, 16, 0.8);
    border: 3px solid;
    border-radius: 12px;
    border-color: #3B82F6;
}

.spot-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom:6px;
    transform: translateX(-50%) translateY(-72%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 14px solid #3B82F6;
    z-index: -1;
    pointer-events: none;
}

.spot-marker-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
}

.spot-marker-name {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    padding: 0 4px;
}

/* Simple dot markers for zoomed-out upload map */
.spot-dot-marker {
    background: transparent;
    border: none;
}

.spot-dot-marker-inner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22C55E; /* green fill */
    border: 2px solid #FFFFFF; /* white border */
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}

.view-feed-btn {
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-feed-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 968px) {
    .upload-form-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .image-upload-section {
        order: 1;
    }

    .form-fields-section {
        order: 2;
    }

    .upload-heading {
        font-size: 2rem;
    }

    .upload-card {
        padding: 1.5rem;
    }

    .map {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .upload-heading {
        font-size: 1.75rem;
    }

    .upload-card {
        padding: 1rem;
    }

    .popup-content-box {
        padding: 1.5rem;
    }

    .popup-buttons {
        flex-direction: column;
    }

    .popup-btn {
        width: 100%;
    }

    .success-popup {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.5rem;
        left: 1rem;
        right: 1rem;
        transform: none;
        width: auto;
    }

    .success-content {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .view-feed-btn {
        width: 100%;
    }
}

/* Create Spot Bubble */
.create-spot-bubble-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.create-spot-bubble {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.create-spot-bubble:hover {
    background: rgba(59, 130, 246, 1);
    transform: scale(1.05);
}
