/* === FARM PREMIUM LAYOUT (V8 - Optimized & User Sizes) === */

/* --- 1. MAIN LAYOUT --- */
#al-app-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    height: 85vh; 
    min-height: 600px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    z-index: 9999; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.15); 
    margin-bottom: 0;
}

/* Left Side: Map */
.al-split-left {
    flex: 65%;
    max-width: 65%;
    height: 100%;
    position: relative;
    background: #f1f5f9; 
    overflow: hidden;
    cursor: grab;
    border-right: 1px solid #cbd5e1;
}
.al-split-left:active { cursor: grabbing; }

/* Right Side: List */
.al-split-right {
    flex: 35%;
    max-width: 35%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    z-index: 20;
}

/* --- 2. MAP COMPONENTS --- */
#panContainer {
    width: 100%; height: 100%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

.al-map-wrapper-box {
    position: relative;
    display: inline-block; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    line-height: 0; 
}

.al-map-image {
    display: block;
    height: 85vh; 
    width: auto; 
    max-width: none; 
}

/* Map Controls */
.al-map-controls {
    position: absolute; top: 20px; left: 20px; z-index: 100;
    display: flex; flex-direction: column; gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 8px; border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #fff;
}

.al-ctrl-btn {
    width: 36px; height: 36px;
    border: 1px solid #e2e8f0; background: transparent;
    font-size: 1.4rem; cursor: pointer; color: #1a4d2e;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; transition: all 0.2s;
}
.al-ctrl-btn:hover { background: #1a4d2e; color: #fff; }
.al-ctrl-btn.active { background: #e2e8f0; color: #333; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }

/* --- 3. PINS (Specific User Sizes) --- */
.plot-pin {
    position: absolute;
    z-index: 10;
    cursor: pointer;
    
    /* Desktop: 12px */
    width: 12px;
    height: 12px;
    
    background: #27ae60; 
    border: 1px solid #fff; 
    border-radius: 50% 50% 50% 0; 
    transform: translate(-50%, -85%) rotate(-45deg);
    transform-origin: center center;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

/* THE CENTER DOT */
.plot-pin::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 4px; height: 4px; /* Proportional to 12px pin */
    background: #fff; 
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Status Colors */
.plot-pin.sold { background: #c0392b; z-index: 5; opacity: 0.9; }
.plot-pin.partial { background: #f39c12; z-index: 15; }
.plot-pin.partial::after { background: #f39c12; }

/* Hover Effect */
.plot-pin:hover {
    background: #f1c40f; 
    z-index: 100 !important; 
    transform: translate(-50%, -120%) rotate(-45deg) scale(1.5); /* Pop larger on hover */
    border-color: #1a4d2e;
}

/* Toggle Logic */
.al-hide-pins .plot-pin {
    opacity: 0;
    transform: translate(-50%, -85%) rotate(-45deg) scale(0);
    pointer-events: none;
}

/* --- 4. LIST & TYPOGRAPHY --- */
.al-list-header { flex: 0 0 auto; padding: 25px; background: #fff; border-bottom: 1px solid #f1f5f9; z-index: 30; }
.al-list-title { margin: 0 0 15px 0; font-size: 1.6rem; color: #0f172a; font-weight:700; }

.al-tools-row { display: flex; gap: 10px; flex-wrap: wrap; }
.al-input { flex: 2; padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.9rem; outline: none; }
.al-input:focus { border-color: #1a4d2e; }
.al-select { flex: 1; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; }

.al-list-scroll { flex: 1 1 auto; overflow-y: auto; padding: 0; background: #f8fafc; }
.al-list-scroll::-webkit-scrollbar { width: 8px; }
.al-list-scroll::-webkit-scrollbar-track { background: #f1f5f9; }
.al-list-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.al-list-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.al-list-row {
    background: #fff; padding: 20px 25px;
    border-bottom: 1px solid #f1f5f9;
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s;
    cursor: pointer;
    border-left: 4px solid transparent;
}
.al-list-row:hover { background: #fff; border-left-color: #1a4d2e; box-shadow: 0 4px 20px rgba(0,0,0,0.05); transform: translateX(2px); }
.al-list-row.is-sold { opacity: 0.6; background: #fef2f2; }

.al-plot-name { font-weight: 700; font-size: 1.05rem; color: #334155; display:block; margin-bottom: 4px; }
.al-plot-meta { font-size: 0.85rem; color: #64748b; font-weight: 500; }
.al-price-text { color: #15803d; font-weight: 700; margin-left: 6px; font-size: 0.95rem; }

/* --- 5. INTERACTIVE ELEMENTS --- */

/* Lease Button */
.al-action-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #1a4d2e 0%, #14532d 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(26, 77, 46, 0.2);
    letter-spacing: 0.5px;
}
.al-action-btn:hover {
    background: linear-gradient(135deg, #2e7d32 0%, #1a4d2e 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(26, 77, 46, 0.3);
}
.al-action-btn:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(26, 77, 46, 0.2); }
.al-action-btn:disabled { background: #cbd5e1; color: #94a3b8; cursor: not-allowed; box-shadow: none; transform: none; }

/* Modal Buy Button */
.al-btn-buy {
    background-color: #1a4d2e; color: white;
    padding: 12px 20px; border: none; border-radius: 6px;
    width: 100%; font-size: 1rem; font-weight: 600;
    cursor: pointer; margin-top: 15px; transition: background 0.2s;
}
.al-btn-buy:hover { background-color: #14532d; }
.al-btn-disabled { background-color: #ccc; color: #666; padding: 12px; width: 100%; border: none; border-radius: 6px; margin-top: 15px; cursor: not-allowed; }

/* Range Slider */
#al-share-slider { width: 100%; height: 8px; background: #d3d3d3; outline: none; opacity: 0.7; border-radius: 5px; margin: 10px 0; transition: opacity .2s; }
#al-share-slider:hover { opacity: 1; }

/* Duration Input */
#al-lease-months {
    width: 100%; padding: 10px; margin-top: 5px;
    border: 1px solid #ccc; border-radius: 6px;
    font-size: 1rem; color: #333; background: #fff;
    transition: border-color 0.2s;
}
#al-lease-months:focus { border-color: #1a4d2e; outline: none; }
#al-expiry-preview { font-weight: 600; color: #1a4d2e; }

/* --- 6. OVERLAYS (Modal, Legend, Tooltip, Drawer) --- */

/* Modal */
.al-modal { display: none; position: fixed; z-index: 100000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.al-modal-content { background-color: #fefefe; margin: 10% auto; padding: 30px; border: 1px solid #888; width: 90%; max-width: 450px; border-radius: 12px; box-shadow: 0 25px 50px rgba(0,0,0,0.5); position: relative; font-family: 'Poppins', sans-serif; animation: alFadeIn 0.3s; }
.al-close { color: #aaa; float: right; font-size: 28px; font-weight: bold; position: absolute; right: 20px; top: 10px; cursor: pointer; transition: color 0.2s; }
.al-close:hover { color: #000; }
#al-p-title { margin-top: 0; color: #1a4d2e; font-size: 1.5rem; font-weight: 700; text-align: center; }
#al-p-details p { font-size: 1rem; color: #555; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 10px; }

/* Legend */
.al-map-legend { position: absolute; bottom: 20px; left: 20px; z-index: 90; background: rgba(255, 255, 255, 0.95); padding: 10px 15px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); font-size: 0.8rem; color: #333; display: flex; gap: 15px; border: 1px solid #fff; pointer-events: none; }
.legend-item { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Tooltip */
.al-pin-tooltip { position: absolute; z-index: 200; background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(5px); padding: 12px 16px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); border: 1px solid #fff; pointer-events: none; opacity: 0; transition: opacity 0.2s, transform 0.2s; transform: translateY(10px); min-width: 160px; }
.al-pin-tooltip.visible { opacity: 1; transform: translateY(0); }
.al-tt-title { font-weight: 700; color: #1a4d2e; font-size: 0.95rem; margin-bottom: 6px; display: block; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.al-tt-row { font-size: 0.85rem; color: #666; display: flex; justify-content: space-between; margin-bottom: 3px; }
.al-tt-val { font-weight: 600; color: #333; }

/* Mobile Drawer Overrides */
#mobile-drawer, .mobile-drawer { z-index: 100002 !important; }
#mobile-backdrop, .mobile-backdrop { z-index: 100001 !important; }
.mobile-menu-list a { transition: all 0.2s ease-in-out; }
.mobile-menu-list a:hover { color: #1a4d2e; padding-left: 10px; background: rgba(26, 77, 46, 0.05); }

/* Animation */
@keyframes alFadeIn { from {opacity: 0; transform: translateY(-20px);} to {opacity: 1; transform: translateY(0);} }

/* --- 7. RESPONSIVE QUERY (Consolidated) --- */
@media (max-width: 1024px) {
    /* Tablet: 11px */
    .plot-pin { width: 11px; height: 11px; border-width: 1.5px; }
    .plot-pin::after { width: 3.5px; height: 3.5px; }
}

@media (max-width: 900px) {
    #al-app-container { flex-direction: column !important; height: auto !important; min-height: 100vh; }
    .al-split-left { width: 100% !important; height: 50vh; max-width: 100%; overflow: scroll; }
    .al-split-right { width: 100% !important; height: 600px; max-width: 100%; }
    .al-map-image { width: 100%; height: auto; max-width: 100%; }
    
    /* Mobile: 10px */
    .plot-pin { width: 10px; height: 10px; border-width: 1px; box-shadow: 1px 1px 3px rgba(0,0,0,0.3); }
    .plot-pin::after { width: 3px; height: 3px; }
    
    .al-map-legend { bottom: 10px; left: 10px; padding: 5px 10px; flex-direction: column; gap: 5px; align-items: flex-start; }
    .al-pin-tooltip { display: none; } 
}
/* === COMPASS / DIRECTION INDICATOR (Added to Premium CSS) === */

.al-map-compass {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 900; /* Higher than map, lower than modals */
    
    width: 60px;
    height: 60px;
    
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.al-map-compass svg {
    width: 100%;
    height: 100%;
    display: block;
}

.al-map-compass:hover {
    transform: scale(1.1);
    background: #ffffff;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Mobile Adjustment */
@media (max-width: 768px) {
    .al-map-compass {
        top: 15px !important;
        right: 15px !important;
        width: 45px;
        height: 45px;
    }
}