/**
 * Taste of Universe - Map Styles
 * BEM Methodology with tou- prefix
 *
 * @package TOU
 * @version 1.0.0
 */

/* =====================================
   Map Container
   ===================================== */
.tou-map-wrapper {
    width: 100%;
    padding: 16px;
    margin: 20px 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e5e5;
}

.tou-map-container {
    width: 100%;
    height: 550px;
    max-height: 550px;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Leaflet Zoom Controls Z-index Optimization */
.leaflet-control-zoom {
    z-index: 600 !important;
}

.leaflet-control-zoom a {
    z-index: 600 !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    z-index: 600 !important;
}

/* Leaflet Attribution Link - optimize positioning */
.leaflet-control-attribution {
    z-index: 400 !important;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.9);
}

/* Ensure map markers stay on top but below menus */
.leaflet-marker-pane,
.leaflet-shadow-pane,
.leaflet-overlay-pane,
.leaflet-popup-pane {
    z-index: 100 !important;
}

.leaflet-tile-pane {
    z-index: 100 !important;
}

/* =====================================
   Map Filters
   ===================================== */
.tou-map-filters {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #c3c4c7;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.tou-map-filters__item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tou-map-filters__item label {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.tou-map-filters__select {
    min-width: 200px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tou-map-filters__select:hover {
    border-color: #E81E63;
}

.tou-map-filters__select:focus {
    outline: none;
    border-color: #E81E63;
    box-shadow: 0 0 0 1px #E81E63;
}

.tou-map-filters__select:disabled {
    background: #f6f7f7;
    cursor: not-allowed;
    opacity: 0.6;
}

.tou-map-filters__reset {
    margin-top: 24px;
    min-width: 100px;
}

.tou-map-filters__chef-name-container {
    margin-top: 8px;
}

.tou-map-filters__input {
    min-width: 200px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    transition: all 0.3s ease;
}

.tou-map-filters__input:hover {
    border-color: #E81E63;
}

.tou-map-filters__input:focus {
    outline: none;
    border-color: #E81E63;
    box-shadow: 0 0 0 1px #E81E63;
}

/* =====================================
   Marker Cluster Icons - Enhanced Visibility
   ===================================== */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(34, 113, 177, 0.7) !important;
    color: #fff !important;
    font-weight: 700 !important;
    border: 3px solid #fff !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

.marker-cluster-small {
    background-color: rgba(220, 53, 69, 0.9) !important;
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    font-size: 13px !important;
    line-height: 37px !important;
}

.marker-cluster-medium {
    background-color: rgba(220, 53, 69, 0.95) !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    font-size: 14px !important;
    line-height: 42px !important;
}

.marker-cluster-medium-large {
    background-color: rgba(220, 53, 69, 0.95) !important;
    width: 55px !important;
    height: 55px !important;
    border-radius: 50% !important;
    font-size: 15px !important;
    line-height: 47px !important;
}

.marker-cluster-large {
    background-color: rgba(220, 53, 69, 1) !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    font-size: 16px !important;
    line-height: 52px !important;
}

.marker-cluster div {
    background-color: transparent !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    text-align: center !important;
}

.marker-cluster span {
    color: #FFFFFF !important;
    font-weight: 700 !important;
}

/* Hover effect for cluster */
.marker-cluster {
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.marker-cluster:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    z-index: 1000 !important;
}

/* Custom Recipe Marker Badge */
.custom-recipe-marker {
    position: relative;
}

.custom-recipe-marker img {
    display: block;
}

/* =====================================
   Map Popup
   ===================================== */
.tou-map-popup {
    min-width: 300px;
    max-width: 400px;
    max-height: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Ensure Leaflet popup close button is always accessible */
.leaflet-popup-content-wrapper {
    position: relative;
}

.leaflet-popup-close-button {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: bold !important;
    color: #333 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border-radius: 0 0 0 4px !important;
    z-index: 1000 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.leaflet-popup-close-button:hover {
    background: rgba(255, 255, 255, 1) !important;
    color: #000 !important;
}

.leaflet-popup-close-button:active {
    background: rgba(240, 240, 240, 1) !important;
}

.tou-map-popup__recipes {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 250px;
    scrollbar-width: thin;
    scrollbar-color: #c3c4c7 #f0f0f0;
}

.tou-map-popup__recipes::-webkit-scrollbar {
    width: 8px;
}

.tou-map-popup__recipes::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.tou-map-popup__recipes::-webkit-scrollbar-thumb {
    background: #c3c4c7;
    border-radius: 4px;
}

.tou-map-popup__recipes::-webkit-scrollbar-thumb:hover {
    background: #8c8f94;
}

/* =====================================
   Recipe Detail Modal
   ===================================== */
.tou-recipe-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.tou-recipe-detail-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.tou-recipe-detail-modal__content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tou-recipe-detail-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: #fff;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.tou-recipe-detail-modal__close:hover {
    background: #f0f0f0;
    color: #000;
}

.tou-recipe-detail-modal__body {
    padding: 0;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #c3c4c7 #f0f0f0;
}

.tou-recipe-detail__content-wrapper {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
    flex: 1;
}

.tou-recipe-detail__content-wrapper::-webkit-scrollbar {
    width: 8px;
}

.tou-recipe-detail__content-wrapper::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.tou-recipe-detail__content-wrapper::-webkit-scrollbar-thumb {
    background: #c3c4c7;
    border-radius: 4px;
}

.tou-recipe-detail__content-wrapper::-webkit-scrollbar-thumb:hover {
    background: #8c8f94;
}

/* =====================================
   Recipe Detail Content
   ===================================== */
.tou-recipe-detail__image {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f7f7;
    border-radius: 8px;
    overflow: hidden;
}

.tou-recipe-detail__image img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain !important;
    border-radius: 8px;
}

.tou-recipe-detail__title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #1d2327;
}

.tou-recipe-detail__meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.tou-recipe-detail__info {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.tou-recipe-detail__ingredients,
.tou-recipe-detail__instructions,
.tou-recipe-detail__section {
    margin-top: 30px;
}

.tou-recipe-detail__ingredients h3,
.tou-recipe-detail__instructions h3,
.tou-recipe-detail__section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1d2327;
}

.tou-recipe-detail__section p {
    line-height: 1.6;
    color: #50575e;
}

.tou-recipe-detail__section ul {
    list-style: none;
    padding: 0;
}

.tou-recipe-detail__section ul li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e5e5;
    color: #50575e;
}

.tou-recipe-detail__ingredients ul {
    list-style: none;
    padding: 0;
}

.tou-recipe-detail__ingredients li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e5e5;
}

.tou-recipe-detail__instructions ol {
    padding-left: 20px;
}

.tou-recipe-detail__instructions li {
    margin-bottom: 15px;
    line-height: 1.6;
}

/* =====================================
   Recipe Detail Footer
   ===================================== */
.tou-recipe-detail__footer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
    position: sticky;
    bottom: 0;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.tou-recipe-detail__footer-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 30px;
    width: 100%;
}

.tou-recipe-detail__footer-row--top {
    margin-bottom: 4px;
}

.tou-recipe-detail__footer-row--bottom {
    margin-top: 4px;
}

.tou-recipe-detail__footer-icon {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 8px;
}

.tou-recipe-detail__footer-icon:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.tou-recipe-detail__footer-icon--heart svg {
    stroke: red;
}

.tou-recipe-detail__footer-icon--star svg {
    stroke: #E81E63;
    color: #E81E63;
}

.tou-recipe-detail__footer-icon--star:hover svg {
    fill: #E81E63;
    stroke: #E81E63;
}

/* Filled state styles */
.tou-recipe-detail__footer-icon--filled.tou-recipe-detail__footer-icon--heart svg {
    fill: red;
    stroke: red;
}

.tou-recipe-detail__footer-icon--filled.tou-recipe-detail__footer-icon--star svg {
    fill: #E81E63;
    stroke: #E81E63;
}

.tou-map-popup__recipe-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    transition: all 0.3s ease;
    min-height: 80px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.tou-map-popup__recipe-item:first-child {
    padding-top: 10px;
}

.tou-map-popup__recipe-item:last-child {
    margin-bottom: 0;
    padding-bottom: 10px;
}

.tou-map-popup__recipe-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tou-map-popup__recipe-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.tou-map-popup__recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tou-map-popup__recipe-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.tou-map-popup__recipe-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.3;
}

.tou-map-popup__recipe-title--clickable {
    cursor: pointer;
    color: #E81E63;
    transition: all 0.3s ease;
}

.tou-map-popup__recipe-title--clickable:hover {
    color: #C2154D;
    text-decoration: underline;
}

.tou-map-popup__recipe-meta {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #50575e;
    line-height: 1.4;
}

/* =====================================
   Responsive
   ===================================== */
/* =====================================
   Login Notification Modal
   ===================================== */
.tou-login-notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tou-login-notification__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.tou-login-notification__content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: tou-fade-in 0.3s ease-out;
}

@keyframes tou-fade-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.tou-login-notification__close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.tou-login-notification__close:hover {
    color: #333;
}

.tou-login-notification__icon {
    text-align: center;
    margin-bottom: 20px;
}

.tou-login-notification__title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin: 0 0 10px;
}

.tou-login-notification__message {
    font-size: 16px;
    color: #666;
    text-align: center;
    margin: 0 0 25px;
}

.tou-login-notification__buttons {
    display: flex;
    gap: 10px;
}

.tou-login-notification__button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.tou-login-notification__button--primary {
    background: #E81E63;
    color: #fff;
}

.tou-login-notification__button--primary:hover {
    background: #C2154D;
}

.tou-login-notification__button--secondary {
    background: #f0f0f0;
    color: #333;
}

.tou-login-notification__button--secondary:hover {
    background: #e0e0e0;
}

/* =====================================
   Toast Notification
   ===================================== */
.tou-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000000;
    min-width: 300px;
    max-width: 500px;
    opacity: 0;
    transition: all 0.3s ease;
}

/* =====================================
   Welcome Popup (Map)
   ===================================== */
.tou-welcome-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
}

.tou-welcome-popup__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.tou-welcome-popup__content {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 26px;
    max-width: 560px;
    width: 92%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    animation: tou-fade-in 0.25s ease-out;
}

.tou-welcome-popup__title {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
}

.tou-welcome-popup__message {
    font-size: 15px;
    line-height: 1.6;
    color: #50575e;
    margin-bottom: 18px;
}

.tou-welcome-popup__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tou-welcome-popup__checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #50575e;
}

.tou-welcome-popup__button {
    margin-left: auto;
    background: #E81E63;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tou-welcome-popup__button:hover {
    background: #C2154D;
}

.tou-toast--show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.tou-toast--success {
    border-left: 4px solid #00a32a;
}

.tou-toast--error {
    border-left: 4px solid #d63638;
}

.tou-toast__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.tou-toast--success .tou-toast__icon {
    color: #00a32a;
}

.tou-toast--error .tou-toast__icon {
    color: #d63638;
}

.tou-toast__message {
    font-size: 14px;
    font-weight: 500;
    color: #1d2327;
    line-height: 1.4;
}

/* =====================================
   Responsive
   ===================================== */
@media (max-width: 768px) {
    .tou-map-wrapper {
        padding: 12px;
        margin: 12px 0;
        border-radius: 8px;
    }

    .tou-map-container {
        height: 350px;
        max-height: 350px;
        min-height: 300px;
    }

    .tou-map-filters {
        padding: 10px;
        margin-top: 12px;
        flex-direction: column;
        gap: 12px;
    }

    .tou-map-filters__item {
        width: 100%;
    }

    .tou-map-filters__select {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .tou-map-wrapper {
        padding: 8px;
        margin: 8px 0;
        border-radius: 6px;
    }

    .tou-map-container {
        height: 300px;
        max-height: 300px;
        min-height: 250px;
        border-radius: 6px;
    }

    .tou-map-filters {
        padding: 8px;
        margin-top: 8px;
        gap: 10px;
    }

    .tou-map-popup {
        min-width: 180px;
        max-width: 85%;
        max-height: 220px;
    }

    .tou-map-popup__recipes {
        max-height: 190px;
        padding: 8px;
    }

    .tou-map-popup__recipe-item {
        flex-direction: column;
        gap: 8px;
        min-height: auto;
        padding: 6px;
    }

    .tou-map-popup__recipe-image {
        width: 100%;
        height: 60px;
    }

    .tou-map-popup__recipe-content {
        width: 100%;
    }
    
    .tou-map-popup__recipe-title {
        font-size: 14px;
        line-height: 1.3;
    }
    
    .tou-map-popup__recipe-meta {
        font-size: 12px;
    }

    .tou-toast {
        min-width: 280px;
        max-width: 90%;
        left: 50%;
        transform: translateX(-50%) translateY(100px);
    }

    .tou-toast--show {
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 480px) {
    .tou-map-popup {
        min-width: 160px;
        max-width: 90%;
        max-height: 200px;
    }

    .tou-map-popup__recipes {
        max-height: 170px;
        padding: 8px;
    }
    
    .tou-map-popup__recipe-item {
        min-height: 60px;
        padding: 6px;
    }
    
    .tou-map-popup__recipe-image {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }
    
    .tou-map-popup__recipe-title {
        font-size: 13px;
        line-height: 1.3;
    }
    
    .tou-map-popup__recipe-meta {
        font-size: 11px;
    }

    .tou-toast {
        min-width: 250px;
        padding: 12px 16px;
    }
}