/* Global styling */
:root {
    --primary-color: #2E8B57; /* SeaGreen */
    --bg-color: #121212;
    --card-bg: rgba(30, 30, 30, 0.85);
    --text-color: #f5f5f5;
    --accent-color: #00ff88;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* App Header */
.app-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.floating-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(20, 30, 40, 0.35); /* Liquid glass dark */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.connected {
    background-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
    animation: pulse 2s infinite;
}

.status-dot.disconnected {
    background-color: #ff4757;
    box-shadow: 0 0 8px #ff4757;
}

@keyframes pulse {
    0% { opacity: 1; box-shadow: 0 0 8px var(--accent-color); }
    50% { opacity: 0.5; box-shadow: 0 0 2px var(--accent-color); }
    100% { opacity: 1; box-shadow: 0 0 8px var(--accent-color); }
}

/* Map Container */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1a1a1a; 
    z-index: 1; /* Below header */
}

/* Search Container */
.floating-search {
    position: absolute;
    top: 76px; /* 60px header + 16px gap */
    right: 24px;
    z-index: 1000;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#cart-search-input {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(20, 30, 40, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    outline: none;
    font-size: 14px;
    width: 200px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#cart-search-input:focus {
    border-color: var(--accent-color);
}

#cart-search-btn {
    background: rgba(0, 255, 136, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 255, 136, 0.4);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

#cart-search-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 255, 136, 0.4);
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.4);
}

/* Custom Cart Marker */
.cart-marker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.cart-icon {
     width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3), inset 0 2px 6px rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.cart-icon img {
    width: 18px;
    height: 18px;
    object-fit: cover;
    mix-blend-mode: multiply; /* Removes white background from generated images */
}



.cart-label {
    margin-top: 6px;
    background: rgba(20, 30, 40, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 8px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.25);
}

/* Smooth Movement Transition */
.leaflet-marker-icon.smooth-move {
    /* linear transition feels more natural for cart movement */
    transition: transform 1.5s linear !important; 
}

.leaflet-marker-icon.no-transition {
    /* Disable transition during map events to prevent floating marker effect */
    transition: none !important;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(25, 35, 45, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 24px;
    width: 300px;
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .modal-content {
    transform: translateY(-20px);
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: white;
}

.modal-header h2 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
    color: var(--accent-color);
}

.modal-body p {
    margin: 8px 0;
    font-size: 1rem;
}

.hole-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 6px solid 	#00FF00;
    border-radius: 50%;
    width: 42px !important;
    height: 52px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    color: #333;
    font-family: 'Arial', sans-serif;
    position: relative;
    z-index: 500;
}



/* 🟡 >10 */
.hole-badge.warning {
    border-color: yellow;
}

/* 🔴 >20 */
.hole-badge.danger {
    border-color: red;
}

.hole-badge::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #00FF00;
}

.hole-badge .label {
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    color: #0074D9;
    line-height: 1;
    margin-bottom: 1px;
}

.hole-badge .count {
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    color: #000;
}

.hole-badge .hole-num {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #FF4500; /* Contrast orange for hole number */
    color: white;
    font-size: 8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Updated cart icon for better centering with new size */
.cart-icon {
    width: 22px;
    height: 22px;
    background: white;
    border: 1.5px solid #2E8B57;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    position: relative;
    transition: all 0.3s ease;
}

.cart-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Hole Detail Modal ===== */
.hole-modal-content {
    width: 320px;
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
}

.hole-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 22px 16px;
    background: linear-gradient(135deg, rgba(0,180,80,0.25), rgba(0,120,200,0.2));
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.hole-modal-icon {
    font-size: 2rem;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #1db954, #0074D9);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,180,100,0.4);
    flex-shrink: 0;
}

.hole-modal-header h2 {
    margin: 0 0 2px;
    font-size: 1.25rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.hole-modal-subtitle {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.hole-modal-stats {
    display: flex;
    gap: 12px;
    padding: 16px 20px 12px;
}

.hole-stat-card {
    flex: 1;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hole-stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: #00e676;
    line-height: 1;
}

.hole-stat-label {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.55);
    text-align: center;
    letter-spacing: 0.3px;
}

/* Progress bar */
.hole-modal-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 16px;
}

.hole-modal-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.12);
    border-radius: 6px;
    overflow: hidden;
}

.hole-modal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1db954, #00e676);
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    width: 0%;
}

.hole-modal-progress-fill.warn {
    background: linear-gradient(90deg, #f39c12, #f1c40f);
}

.hole-modal-progress-fill.danger {
    background: linear-gradient(90deg, #e74c3c, #ff6b6b);
}

.hole-modal-progress-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: #aaa;
    min-width: 36px;
    text-align: right;
}

/* Cart list inside hole modal */
.hole-modal-cart-list {
    padding: 4px 20px 18px;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hole-modal-cart-list::-webkit-scrollbar {
    width: 4px;
}
.hole-modal-cart-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.hole-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 10px 14px;
    transition: background 0.2s;
    cursor: default;
}

.hole-cart-item:hover {
    background: rgba(0,230,118,0.1);
    border-color: rgba(0,230,118,0.3);
}

.hole-cart-item-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #2E8B57, #1db954);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.hole-cart-item-info {
    display: flex;
    flex-direction: column;
}

.hole-cart-item-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f0f0f0;
    letter-spacing: 0.3px;
}

.hole-cart-item-status {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    margin-top: 1px;
}

.hole-no-carts {
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
    padding: 16px 0;
    margin: 0;
}

/* Make hole badge clickable */
.hole-label {
    cursor: pointer;
}