/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-text {
    flex: 1;
    text-align: left;
}

.header-text h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header-text p {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin: 0;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Authentication Section */
.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-btn {
    white-space: nowrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-nickname {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.user-stats {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.referral-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.referral-link:hover {
    color: #2980b9;
    text-decoration: underline;
}


/* Main container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Action bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.location-count {
    color: #7f8c8d;
    font-weight: 600;
}

/* Content wrapper */
.content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    height: 70vh;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Map container */
.map-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

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

/* List container */
.list-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.list-container.full-height {
    height: 100%;
}

.list-header {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.list-container h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Leaderboard */
.leaderboard-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.leaderboard-container h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.leaderboard-list {
    overflow-y: auto;
    flex: 1;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.leaderboard-item.current-user {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.leaderboard-item .rank {
    font-weight: bold;
    font-size: 1.1rem;
    color: #667eea;
    min-width: 30px;
}

.leaderboard-item.current-user .rank {
    color: white;
}

.leaderboard-item .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.leaderboard-item .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.leaderboard-item .user-details {
    display: flex;
    flex-direction: column;
}

.leaderboard-item .nickname {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
}

.leaderboard-item.current-user .nickname {
    color: white;
}

.leaderboard-item .locations-count {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.leaderboard-item.current-user .locations-count {
    color: rgba(255, 255, 255, 0.9);
}

.current-user-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.no-data {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 2rem;
}

/* Search container */
.search-container {
    margin-bottom: 1rem;
}

.search-container input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

/* Locations list */
.locations-list {
    flex: 1;
    overflow-y: auto;
}

.locations-list.scrollable {
    height: 100%;
}

.location-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
}

.location-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.location-item.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-left-color: white;
}

.location-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: inherit;
}

.location-address {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.location-item.active .location-address {
    color: rgba(255, 255, 255, 0.8);
}

.location-description {
    font-size: 0.85rem;
    color: #95a5a6;
    line-height: 1.4;
}

.location-item.active .location-description {
    color: rgba(255, 255, 255, 0.9);
}

/* Voting section */
.voting-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e1e8ed;
}

.location-item.active .voting-section {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.vote-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.vote-btn:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
}

.location-item.active .vote-btn {
    color: rgba(255, 255, 255, 0.8);
}

.location-item.active .vote-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.vote-btn.voted {
    background: #e8f5e8;
    color: #27ae60;
    font-weight: 600;
}

.location-item.active .vote-btn.voted {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* User voted states */
.vote-btn.user-voted {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
    border: 2px solid #1976d2;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

.location-item.active .vote-btn.user-voted {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border-color: white;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.vote-btn.upvote.user-voted {
    background: #e8f5e8;
    color: #27ae60;
    border-color: #27ae60;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.vote-btn.downvote.user-voted {
    background: #ffebee;
    color: #e74c3c;
    border-color: #e74c3c;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.location-item.active .vote-btn.upvote.user-voted {
    background: rgba(39, 174, 96, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

.location-item.active .vote-btn.downvote.user-voted {
    background: rgba(231, 76, 60, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

.vote-btn.user-voted:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

.vote-btn.upvote.user-voted:hover {
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.vote-btn.downvote.user-voted:hover {
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* Location header and ownership */
.location-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.location-main {
    flex: 1;
    min-width: 0;
}

.location-creator {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
    font-style: italic;
}

.popup-creator {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin: 0.5rem 0;
    font-style: italic;
}

/* Delete button styles */
.delete-btn {
    background: #fff5f5;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.delete-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.delete-btn:active {
    transform: translateY(0);
}

.delete-icon {
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1;
}

/* Popup delete button */
.popup-delete {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e1e8ed;
}

.popup-delete-btn {
    background: #fff5f5;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.popup-delete-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Referral Section */
.referral-container {
    background: white;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.referral-container h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.referral-description {
    margin: 0 0 1rem 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    text-align: center;
}

.referral-code-section {
    text-align: center;
}

.referral-code-display {
    display: none;
}

.referral-code-display label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
    font-size: 0.9rem;
}

.referral-code-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.referral-code-container input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #3498db;
    border-radius: 6px;
    background: #f8f9fa;
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
    font-size: 1rem;
    color: #2c3e50;
}

.referral-code-container input:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.referral-stats {
    margin-bottom: 1rem;
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 500;
}

.referral-share .btn {
    min-width: 120px;
}

/* Leaderboard Tabs */
.leaderboard-tabs {
    display: flex;
    border-bottom: 1px solid #e1e8ed;
    margin-bottom: 1rem;
    background: white;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.leaderboard-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #7f8c8d;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.leaderboard-tab:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.leaderboard-tab.active {
    background: white;
    color: #3498db;
    border-bottom-color: #3498db;
}

.leaderboard-content {
    display: none;
}

.leaderboard-content.active {
    display: block;
}

.leaderboard-empty {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
}

.leaderboard-empty p:first-child {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.leaderboard-empty p:last-child {
    font-size: 0.9rem;
    margin: 0;
}

/* Referral leaderboard specific styles */
.referrals-count {
    font-size: 0.8rem;
    color: #9b59b6;
    font-weight: 500;
}

.leaderboard-item.current-user .referrals-count {
    color: rgba(255, 255, 255, 0.9);
}

/* Navigation Section */
.navigation-section {
    background: white;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.navigation-section h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.navigation-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.nav-icon {
    font-size: 1.5rem;
    min-width: 2rem;
    text-align: center;
}

.nav-content {
    flex: 1;
}

.nav-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: #2c3e50;
}

.nav-description {
    font-size: 0.85rem;
    color: #7f8c8d;
    line-height: 1.3;
}

/* Quick Stats Section */
.quick-stats-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.quick-stats-container h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Info cards for referrals page */
.info-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.info-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.info-card h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.info-card p {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-actions .btn {
    min-width: 140px;
}

/* Ensure location items have proper spacing */
.location-item {
    position: relative;
}

.location-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.location-address {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.location-description {
    color: #34495e;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.vote-btn.upvote:hover,
.vote-btn.upvote.voted {
    color: #27ae60;
}

.vote-btn.downvote:hover,
.vote-btn.downvote.voted {
    color: #e74c3c;
}

.vote-icon {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.vote-btn:hover .vote-icon {
    transform: scale(1.2);
}

.vote-count {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.accuracy-rating {
    font-size: 0.85rem;
    color: #95a5a6;
    font-weight: 600;
}

.location-item.active .accuracy-rating {
    color: rgba(255, 255, 255, 0.8);
}

.accuracy-high {
    color: #27ae60 !important;
}

.accuracy-medium {
    color: #f39c12 !important;
}

.accuracy-low {
    color: #e74c3c !important;
}

/* Location actions container */
.location-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Maps button */
.maps-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

.maps-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8, #6a42a0);
}

.maps-btn:active {
    transform: translateY(0);
}

.location-item.active .maps-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.location-item.active .maps-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e1e8ed;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-outline {
    background: transparent;
    color: #3498db;
    border: 2px solid #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.3);
}

.leaderboard-btn {
    white-space: nowrap;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    background: none;
    border: none;
    color: white;
    padding: 0;
    line-height: 1;
}

.close:hover {
    opacity: 0.8;
}

/* Form styles */
#addLocationForm,
#editLocationForm {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

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

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Loading spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e8ed;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #7f8c8d;
    font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
    .header-container h1 {
        font-size: 2rem;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .map-container {
        height: 50vh;
    }
    
    .list-container {
        height: 40vh;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Coordinates display */
.coordinates-display {
    padding: 0.75rem;
    background: #f8f9fa;
    border: 2px dashed #e1e8ed;
    border-radius: 8px;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.coordinates-display.has-location {
    background: #e8f5e8;
    border-color: #27ae60;
    color: #27ae60;
    font-weight: 600;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Address autocomplete */
.address-suggestions {
    position: relative;
    z-index: 1000;
}

.suggestion-item {
    padding: 0.75rem;
    background: white;
    border: 1px solid #e1e8ed;
    border-top: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.suggestion-item.no-results {
    cursor: default;
    color: #7f8c8d;
}

.suggestion-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.suggestion-icon {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.suggestion-text {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-subtitle {
    font-size: 0.8rem;
    color: #7f8c8d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-item:first-child {
    border-top: 1px solid #e1e8ed;
}

.suggestion-item:last-child {
    border-radius: 0 0 8px 8px;
}

.suggestion-item.highlighted {
    background: #e3f2fd;
}

/* Map click indicator */
.map-click-marker {
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

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

.leaflet-popup-content {
    font-family: inherit;
}

.popup-content {
    padding: 0.5rem;
}

.popup-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.popup-address {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.popup-description {
    font-size: 0.85rem;
    color: #95a5a6;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.popup-voting {
    padding-top: 0.5rem;
    border-top: 1px solid #e1e8ed;
    margin-top: 0.5rem;
}

.popup-voting .vote-buttons {
    justify-content: center;
    gap: 1rem;
}

.popup-voting .vote-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.popup-voting .accuracy-rating {
    text-align: center;
    margin-top: 0.25rem;
}

/* Popup actions container */
.popup-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.popup-maps-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.popup-maps-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8, #6a42a0);
}

/* Authentication Styles */
.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e1e8ed;
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #7f8c8d;
    transition: all 0.3s ease;
}

.auth-tab.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

.auth-form {
    padding: 0 2rem 2rem;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    color: #2c3e50;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.btn-google:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.google-icon {
    width: 20px;
    height: 20px;
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    text-align: center;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e1e8ed;
}

.divider span {
    padding: 0 1rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.btn-full {
    width: 100%;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .auth-form {
        padding: 0 1rem 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-text {
        text-align: center;
    }
    
    .header-text h1 {
        font-size: 2rem;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .leaderboard-btn {
        order: 1;
        align-self: center;
    }
    
    .auth-section {
        order: 2;
        justify-content: center;
    }
    
    
    .content-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 300px auto;
        height: auto;
        gap: 1rem;
    }
}

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

/* Photo Upload Styles */
.photo-upload-container {
    position: relative;
}

.photo-input {
    display: none;
}

.photo-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px dashed #667eea;
    border-radius: 8px;
    background: #f8f9fa;
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-upload-label:hover {
    background: #e8f0fe;
    border-color: #5a6fd8;
}

.photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.photo-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e8ed;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-photo-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-photo-btn:hover {
    background: #e74c3c;
    transform: scale(1.1);
}

/* Photos in Popup */
.popup-photos {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
    overflow-x: auto;
    padding: 0.25rem 0;
}

.popup-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #e1e8ed;
}

.popup-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

/* Photos in Location List */
.location-photos-thumb {
    position: relative;
    display: inline-block;
    margin: 0.5rem 0;
}

.location-photo-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e1e8ed;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.location-photo-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.location-photo-thumb:active {
    transform: scale(0.98);
}

.photo-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Photo Gallery in Location Items */
.location-item .location-photos-thumb {
    margin-top: 0.5rem;
}

/* Responsive Photo Gallery */
@media (max-width: 480px) {
    .photo-preview {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    
    .popup-photo {
        width: 60px;
        height: 60px;
    }
    
    .location-photo-thumb {
        width: 50px;
        height: 50px;
    }
}

/* Photo Viewer Modal */
.photo-viewer-modal {
    z-index: 2000;
    background-color: rgba(0, 0, 0, 0.95);
}

.photo-viewer-content {
    position: relative;
    margin: 2% auto;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-viewer-close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 40px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 2001;
    transition: all 0.3s ease;
    padding: 0;
    width: 50px;
    height: 50px;
    line-height: 1;
}

.photo-viewer-close:hover {
    transform: scale(1.2);
    color: #ff6b6b;
}

#photoViewerImage {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.photo-viewer-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
}

.photo-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-nav-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.photo-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.photo-nav-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: none;
}

.photo-counter {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

/* Make popup photos clickable */
.popup-photo {
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.popup-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.popup-photo:active {
    transform: scale(0.98);
}

/* Responsive Photo Viewer */
@media (max-width: 768px) {
    .photo-viewer-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    #photoViewerImage {
        max-height: 70vh;
    }
    
    .photo-viewer-nav {
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .photo-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .photo-counter {
        font-size: 0.9rem;
        min-width: 60px;
    }
}

/* Edit Button Styles */
.edit-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.edit-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* Owner action buttons container */
.popup-owner-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e1e8ed;
    flex-wrap: wrap;
}

.popup-owner-actions .edit-btn,
.popup-owner-actions .delete-btn {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-owner-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.location-owner-buttons .edit-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.location-owner-buttons .delete-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Edit Current Photos Grid */
.edit-current-photos {
    min-height: 60px;
}

.no-photos {
    color: #7f8c8d;
    font-style: italic;
    padding: 1rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 6px;
}

.current-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.current-photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e8ed;
    transition: all 0.3s ease;
}

.current-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.current-photo-item.photo-removed {
    border-color: #e74c3c;
}

.remove-current-photo-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-current-photo-btn:hover {
    background: #e74c3c;
    transform: scale(1.1);
}

.current-photo-item.photo-removed .remove-current-photo-btn {
    background: rgba(52, 152, 219, 0.9);
}

.current-photo-item.photo-removed .remove-current-photo-btn:hover {
    background: #3498db;
}

/* Responsive Edit Styles */
@media (max-width: 480px) {
    .popup-owner-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .popup-owner-actions .edit-btn,
    .popup-owner-actions .delete-btn {
        width: 100%;
        justify-content: center;
    }
    
    .current-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
}
