/* Delivery Locations Page Styles */

/* Free Delivery Banner */
.free-delivery-banner {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 999;
    animation: slideDown 0.5s ease-out;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.1rem;
    font-weight: 500;
}

.banner-content i {
    font-size: 1.5rem;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Hero Section */
.delivery-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #5A5D71 100%);
    color: white;
    padding: 140px 0 80px;
    text-align: center;
}

.delivery-hero .section-header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.delivery-hero .section-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Instructions Section */
.instructions-section {
    padding: 80px 0;
    background-color: var(--surfaces);
}

.instructions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.instruction-card,
.listtile {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 16px;
}

.instruction-card:hover,
.listtile:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.instruction-icon,
.leading {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, #5A5D71 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 2rem;
    color: white;
}

.instruction-card h3,
.listtile .title {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-align: center;
}

.instruction-card p,
.listtile .subtitle {
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: center;
}

.instruction-list {
    list-style: none;
    padding: 0;
}

.instruction-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: var(--text-dark);
}

.instruction-list li i {
    color: #4CAF50;
    font-size: 1.1rem;
}

/* ListTile-style layout for the single instructions-list above the map */
.instructions-section .instructions-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 24px;
}

.instructions-section .instructions-list .instruction-card,
.instructions-section .instructions-list .listtile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
}

.instructions-section .instructions-list .instruction-icon,
.instructions-section .instructions-list .leading {
    width: 48px;
    height: 48px;
    margin: 0;
    font-size: 1.25rem;
    flex: 0 0 48px;
}

.instructions-section .instructions-list .instruction-content h3,
.instructions-section .instructions-list .content .title {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    text-align: right;
}

.instructions-section .instructions-list .instruction-content p,
.instructions-section .instructions-list .content .subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dark);
    text-align: right;
}

/* Map Section */
.map-section {
    padding: 80px 0;
    background-color: white;
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background-color: var(--surfaces);
    border-radius: 25px;
}

.legend-color {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.delivery-area-color {
    background-color: rgba(57, 107, 189, 0.5);
}

.distributor-color {
    background-color: #396bbd;
}

/* Toggle switches in legend */
.toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle input {
    display: none;
}

.toggle .toggle-ui {
    width: 42px;
    height: 24px;
    background: #d1d5db;
    border-radius: 999px;
    position: relative;
    transition: background .2s ease;
}

.toggle .toggle-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .2s ease;
}

.toggle input:checked+.toggle-ui {
    background: var(--primary);
}

.toggle input:checked+.toggle-ui::after {
    transform: translateX(18px);
}

.toggle .toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.map-container {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--surfaces);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 2;
}

.map-loading i {
    font-size: 3rem;
    color: var(--primary);
}

.map-loading p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Distributors Section */
.distributors-section {
    padding: 80px 0;
    background-color: var(--surfaces);
}

.distributors-grid {
    margin-top: 40px;
}

.distributor-group-section {
    margin-bottom: 40px;
}

.group-title {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

/* Distributors Table */
.distributors-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
}

.distributors-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, #5A5D71 100%);
    color: white;
}

.distributors-table th {
    padding: 15px 20px;
    text-align: right;
    font-weight: 600;
    font-size: 1rem;
}

.distributors-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: var(--transition);
}

.distributors-table tbody tr:last-child {
    border-bottom: none;
}

.distributors-table tbody tr:hover {
    background-color: var(--surfaces);
}

.distributors-table td {
    padding: 15px 20px;
    text-align: right;
    color: var(--text-dark);
}

.phone-link {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.phone-link:hover {
    color: #404878;
}

.phone-link i {
    font-size: 0.9rem;
}

.btn-icon {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: #404878;
    transform: scale(1.1);
}

.btn-icon i {
    font-size: 1rem;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
    padding: 5px;
    font-family: 'Tajawal', sans-serif;
}

.leaflet-popup-content {
    margin: 15px;
    font-size: 14px;
}

.popup-content h3 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.popup-content p {
    margin: 5px 0;
    color: var(--text-dark);
    line-height: 1.6;
}

.popup-content .popup-label {
    font-weight: 600;
    color: var(--text-dark);
}

.popup-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.popup-actions a {
    flex: 1;
    padding: 8px 12px;
    background-color: var(--primary);
    color: white;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    transition: var(--transition);
}

.popup-actions a:hover {
    background-color: #404878;
}

/* Message Popup */
.message-popup {
    padding: 15px;
    text-align: center;
}

.message-popup i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.message-popup.success i {
    color: #4CAF50;
}

.message-popup.error i {
    color: #f44336;
}

.message-popup p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .delivery-hero {
        padding: 120px 0 60px;
    }

    .delivery-hero .section-header h1 {
        font-size: 2rem;
    }

    .delivery-hero .section-header p {
        font-size: 1rem;
    }

    .instructions-section,
    .map-section,
    .distributors-section {
        padding: 60px 0;
    }

    .instructions-grid {
        grid-template-columns: 1fr;
    }

    .instruction-card,
    .listtile {
        padding: 30px 20px;
    }

    .map-container {
        height: 450px;
    }

    .map-legend {
        flex-direction: column;
        gap: 15px;
    }

    .legend-item {
        justify-content: center;
    }

    /* Make table responsive */
    .distributors-table {
        font-size: 0.9rem;
    }

    .distributors-table th,
    .distributors-table td {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .delivery-hero .section-header h1 {
        font-size: 1.6rem;
    }

    .map-container {
        height: 350px;
    }

    .instruction-icon,
    .leading {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .banner-content {
        font-size: 0.95rem;
    }

    /* Stack table on very small screens */
    .distributors-table {
        font-size: 0.85rem;
    }

    .distributors-table th,
    .distributors-table td {
        padding: 10px 8px;
    }

    .phone-link {
        font-size: 0.85rem;
    }

    .btn-icon {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}