* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2E4591 0%, #00ABED 100%);
    min-height: 100vh;
}

.header {
    background: #ffffff;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.header h1 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.header p {
    color: #666;
    font-size: 1rem;
}

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-label {
    color: white;
    font-weight: 600;
    margin-right: 0.5rem;
}

.btn-filter {
    padding: 0.5rem 1rem;
    border: 2px solid white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transition: all 0.3s;
}

.btn-filter:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-filter.active {
    background: white;
    color: #2E4591;
}

.admin-toggle {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.admin-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    transform: translateY(-1px);
}

.admin-mode .admin-toggle {
    background: #00ABED;
    border-color: #00ABED;
    color: white;
}

.admin-mode .admin-toggle:hover {
    background: #0096d1;
    border-color: #0096d1;
}

.admin-only {
    display: none;
}

.admin-mode .admin-only {
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.btn-primary {
    background: #2E4591;
    color: white;
}

.btn-primary:hover {
    background: #00ABED;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
    background: #00ABED;
    color: white;
}

.btn-secondary:hover {
    background: #2E4591;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

#map {
    height: 600px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border: 3px solid white;
}

.gallery {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    display: none; /* Hidden by default until postcode search */
}

.gallery.visible {
    display: block;
}

.gallery h2 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.8rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.installation-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.installation-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f7fafc;
}

.card-content {
    padding: 1rem;
}

.card-content h3 {
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.card-content p {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #00ABED;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.modal-close:hover {
    background: #2E4591;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2d3748;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2E4591;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.image-preview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
}

.preview-item button {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #00ABED;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
}

.preview-reorder {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.25rem;
}

.preview-reorder button {
    position: static;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
}

.preview-reorder button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.detail-modal .modal-content {
    max-width: 800px;
}

.detail-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.detail-images img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

.image-modal .image-modal-content {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 12px;
    padding: 2rem;
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal .modal-close {
    background: #00ABED;
    color: white;
}

.image-modal img {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
}

.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.8rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.image-nav-left {
    left: 1rem;
}

.image-nav-right {
    right: 1rem;
}

.detail-info {
    margin: 1rem 0;
}

.detail-info h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.detail-info p {
    color: #4a5568;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.detail-info strong {
    color: #2d3748;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #718096;
}

.empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.distance-calculator {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.distance-calculator h3 {
    color: #2E4591;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.distance-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.distance-input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
}

.distance-input-group button {
    padding: 0.75rem 1.5rem;
    background: #2E4591;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.distance-input-group button:hover {
    background: #00ABED;
}

.leaflet-popup-content {
    margin: 1rem;
    min-width: 200px;
}

.popup-content h3 {
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.popup-content p {
    margin: 0.25rem 0;
    color: #4a5568;
    font-size: 0.9rem;
}

.popup-content button {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #2E4591;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.popup-content button:hover {
    background: #00ABED;
}

.enquiry-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.enquiry-section h4 {
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.enquiry-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.enquiry-buttons button {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-phone {
    background: #48bb78;
    color: white;
}

.btn-phone:hover {
    background: #38a169;
}

.btn-visit {
    background: #2E4591;
    color: white;
}

.btn-visit:hover {
    background: #00ABED;
}

.distance-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #00ABED;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.btn-delete {
    background: #e53e3e;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 1rem;
    width: 100%;
}

.btn-delete:hover {
    background: #c53030;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.admin-actions button {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
        margin-bottom: 0.3rem;
    }
    
    .header p {
        font-size: 0.85rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        justify-content: center;
    }
    
    .filter-label {
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }

    #map {
        height: 500px;
        border-width: 2px;
        border-radius: 0;
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }
    
    .main-content {
        gap: 1rem;
    }
    
    /* Fix Leaflet popup on mobile */
    .leaflet-popup {
        margin-bottom: 40px !important;
    }
    
    .leaflet-popup-content-wrapper {
        max-height: 70vh !important;
        overflow-y: auto !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    }
    
    .leaflet-popup-content {
        margin: 0.75rem !important;
        min-width: 260px !important;
        max-width: 300px !important;
        font-size: 0.9rem !important;
    }
    
    .leaflet-popup-tip {
        display: none !important;
    }
    
    .popup-content h3 {
        font-size: 1.05rem !important;
        margin-bottom: 0.6rem !important;
        color: #2d3748 !important;
        font-weight: 600 !important;
    }
    
    .popup-content p {
        font-size: 0.85rem !important;
        margin: 0.4rem 0 !important;
        line-height: 1.4 !important;
    }
    
    .popup-content button {
        width: 100% !important;
        margin: 0.4rem 0 !important;
        padding: 0.7rem !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
    }
    
    .enquiry-section {
        margin-top: 0.75rem !important;
        padding-top: 0.75rem !important;
    }
    
    .enquiry-section h4 {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .enquiry-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        margin-top: 0.6rem !important;
    }
    
    .enquiry-buttons button {
        flex: none !important;
        width: 100% !important;
        padding: 0.7rem !important;
    }

    .gallery {
        padding: 1rem;
    }
    
    .gallery h2 {
        font-size: 1.4rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modal.active {
        padding: 1rem;
        align-items: center;
        justify-content: center;
    }

    .modal-content {
        padding: 1rem;
        padding-top: 2.5rem;
        max-height: 85vh;
        height: auto;
        width: calc(100% - 2rem);
        margin: auto;
        border-radius: 12px;
        overflow-y: auto;
        box-shadow: 0 8px 24px rgba(0,0,0,0.4);
        display: flex;
        flex-direction: column;
    }
    
    .detail-modal .modal-content {
        padding: 1rem;
        padding-top: 2.5rem;
    }
    
    .modal-close {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
        z-index: 10;
        background: #e53e3e;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    
    .modal-close:hover {
        background: #c53030;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.6rem;
    }
    
    .form-group textarea {
        min-height: 60px;
    }
    
    .modal h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        padding-right: 2rem;
    }
    
    .btn {
        width: 100%;
        padding: 0.7rem;
        font-size: 0.95rem;
    }
    
    .image-preview {
        gap: 0.5rem;
    }
    
    .preview-item {
        width: 80px;
        height: 80px;
    }
    
    .detail-images {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin: 0.5rem 0;
    }
    
    .detail-images img {
        height: 250px;
        border-radius: 8px;
    }
    
    .detail-info {
        margin: 0.5rem 0;
        text-align: left;
    }
    
    .detail-info h3 {
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
        text-align: left;
    }
    
    .detail-info p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 0.75rem;
        text-align: left;
    }
    
    .enquiry-section {
        background: #f7fafc;
        padding: 1rem;
        border-radius: 8px;
        margin-top: 1rem;
        text-align: center;
    }
    
    .enquiry-section h4 {
        font-size: 1.1rem;
        color: #2d3748;
        margin-bottom: 0.5rem;
    }
    
    .enquiry-section p {
        text-align: center;
    }
    
    .enquiry-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 0.75rem;
    }
    
    .enquiry-buttons button {
        padding: 1rem;
        font-size: 1rem;
        font-weight: 600;
        width: 100%;
    }
    
    .distance-calculator {
        padding: 1rem;
    }
    
    .distance-input-group {
        flex-direction: column;
    }
    
    .distance-input-group button {
        width: 100%;
    }
    
    .btn-filter {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .admin-toggle {
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        width: auto;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        background: rgba(46, 69, 145, 0.9);
        border: 2px solid rgba(255, 255, 255, 0.5);
        opacity: 0.85;
        z-index: 999;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4);
        border-radius: 8px;
    }
    
    .admin-toggle:hover {
        opacity: 1;
        transform: scale(1.05);
    }
    
    .admin-mode .admin-toggle {
        opacity: 1;
        background: #00ABED;
        border-color: white;
    }
    
    /* Mobile admin bar when in admin mode */
    @media (max-width: 768px) {
        .admin-mode .controls > div:last-child {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background: linear-gradient(135deg, #2E4591 0%, #00ABED 100%);
            padding: 0.75rem 1rem;
            box-shadow: 0 2px 10px rgba(0,0,0,0.3);
            z-index: 1000;
            display: flex !important;
            gap: 0.5rem;
            justify-content: space-between;
            align-items: center;
        }
        
        .admin-mode .controls > div:last-child .admin-toggle {
            position: static;
            opacity: 1;
            flex: 1;
            margin: 0;
        }
        
        .admin-mode body {
            padding-top: 60px;
        }
        
        .admin-mode .header {
            margin-top: 60px;
        }
    }
}

@media (max-width: 480px) {
    .header img {
        max-width: 140px !important;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .header p {
        font-size: 0.8rem;
    }
    
    .container {
        margin: 1rem auto;
    }

    #map {
        height: 350px;
    }
    
    .card-image {
        height: 180px;
    }
    
    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* MOBILE DESIGN FOR IMAGE MODAL */

/* Image Modal - Desktop */
.image-modal .modal-content {
    max-width: 900px;
    max-height: 90vh;
}

.image-nav-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.image-counter {
    color: white;
    font-size: 0.9rem;
}

.image-nav-bottom {
    display: none;
}

/* Mobile - Full Screen */
@media (max-width: 768px) {
    .image-modal .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .image-modal img {
        max-width: 100%;
        max-height: 85vh;
        width: 100%;
        height: auto;
        flex: 1;
        object-fit: contain;
    }

    .image-nav-top {
        display: none;
    }

    .image-nav-bottom {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        padding: 1rem;
        background: rgba(0, 0, 0, 0.8);
        width: 100%;
        box-sizing: border-box;
    }

    .image-nav-bottom button {
        flex: 1;
    }

    .modal-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        z-index: 10;
    }
}