/* sathor-operaciones — styles
   Design tokens copied from pazy.es (Webflow CSS variables):
   Plus Jakarta Sans, flat primary buttons (8px radius), 24px cards, tint backgrounds. */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* pazy.es palette */
    --primary: #00c6cc;
    --primary-medium: #33b0b4;
    --primary-dark: #0b8698;
    --accent: #f35c2b;
    --text: #374f65;          /* gray-dark */
    --text-light: #94a3b8;    /* gray-low */
    --bg: #ebfeff;            /* background-tint-extra-light */
    --tint-light: #defeff;    /* background-tint-light */
    --tint: #b2edef;          /* background-tint */
    --radius-button: 0.5rem;  /* border-radius--button */
    --radius-card: 1.5rem;    /* border-radius--m */
    --transition-btn: background-color 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    --shadow-soft: 0 3px 2px rgba(0, 0, 0, 0.02), 0 8px 7px rgba(0, 0, 0, 0.03), 0 20px 14px rgba(0, 0, 0, 0.04);
}

html {
    height: 100%;
}

body {
    min-height: 100%;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--tint-light);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo {
    height: 36px;
    width: auto;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
}

.logout-btn {
    font-family: inherit;
    background: white;
    color: var(--primary-dark);
    border: 1px solid var(--tint);
    border-radius: var(--radius-button);
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-btn), border-color 0.3s ease;
}

.logout-btn:hover {
    background: var(--tint-light);
    border-color: var(--primary);
}

/* ===== Search bar ===== */

.search-bar {
    display: flex;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--tint-light);
}

.search-bar input {
    font-family: inherit;
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--tint);
    border-radius: var(--radius-button);
    font-size: 1rem;
    color: var(--text);
    background: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar input::placeholder {
    color: var(--text-light);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 198, 204, 0.15);
}

.search-bar select {
    font-family: inherit;
    padding: 0.8rem 0.8rem;
    border: 1px solid var(--tint);
    border-radius: var(--radius-button);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    background: white;
    cursor: pointer;
}

.search-bar select:focus {
    outline: none;
    border-color: var(--primary);
}

.search-btn {
    font-family: inherit;
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-button);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-btn);
    white-space: nowrap;
}

.search-btn:hover:not(:disabled) {
    background: var(--primary-medium);
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.show-all-btn {
    font-family: inherit;
    padding: 0.8rem 1.3rem;
    background: white;
    color: var(--primary-dark);
    border: 1px solid var(--primary);
    border-radius: var(--radius-button);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-btn), color 0.3s ease;
    white-space: nowrap;
}

.show-all-btn:hover {
    background: var(--primary);
    color: white;
}

/* ===== Status bar ===== */

.status-bar {
    padding: 0.55rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-dark);
    background: var(--tint-light);
    min-height: 2.1rem;
}

/* ===== Main: map + detail panel ===== */

.app-main {
    position: relative;
}

#map {
    width: 100%;
    height: 62vh;
    min-height: 420px;
}

/* ===== Detail panel ===== */

.detail-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: 360px;
    max-width: calc(100% - 2rem);
    background: white;
    border-radius: var(--radius-card);
    border: 1px solid var(--tint-light);
    box-shadow: var(--shadow-soft);
    overflow-y: auto;
    padding: 1.25rem;
    z-index: 10;
}

.detail-panel.hidden {
    display: none;
}

.detail-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    background: var(--tint-light);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--primary-dark);
    transition: var(--transition-btn);
    z-index: 11;
}

.detail-close:hover {
    background: var(--tint);
}

.detail-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
    padding-right: 2.25rem;
    line-height: 1.3;
}

.detail-distance {
    font-size: 0.9rem;
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 0.9rem;
}

.detail-info {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.detail-info p {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
}

.detail-info a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
}

.detail-info a:hover {
    text-decoration: underline;
}

/* ===== Photos & carousel ===== */

.detail-photos {
    margin-top: 0.25rem;
}

.photos-loading,
.no-photos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--bg);
    border-radius: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: center;
}

.carousel {
    border-radius: 1rem;
    overflow: hidden;
    background: var(--tint-light);
    border: 1px solid var(--tint-light);
}

.carousel-photos {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
}

.carousel-photo {
    display: none;
    width: 100%;
    height: 100%;
}

.carousel-photo.active {
    display: block;
}

.carousel-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: white;
}

.carousel-prev,
.carousel-next {
    font-family: inherit;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-button);
    width: 34px;
    height: 30px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-btn);
}

.carousel-prev:hover,
.carousel-next:hover {
    background: var(--primary-medium);
}

.carousel-counter {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
}

/* ===== Result cards ===== */

.cards-section {
    padding: 1.5rem;
}

.cards-section.hidden {
    display: none;
}

.cards-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 0.9rem;
}

.tanatorio-card {
    background: white;
    border: 1px solid var(--tint-light);
    border-radius: var(--radius-card);
    padding: 1.1rem 1.2rem;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.tanatorio-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.tanatorio-card.selected {
    border-color: var(--primary);
    background: var(--tint-light);
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.card-name {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.card-distance {
    flex-shrink: 0;
    background: var(--primary);
    color: white;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6rem;
    padding: 0.2rem 0.65rem;
    white-space: nowrap;
}

.card-line {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.05rem;
    }

    .user-badge {
        display: none;
    }

    .search-bar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .search-bar input {
        flex-basis: 100%;
    }

    .search-bar select {
        flex: 1;
    }

    .search-btn {
        flex: 2;
    }

    .show-all-btn {
        flex: 1;
    }

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