/*
 * KDH Map – Modern Styling
 *
 * This stylesheet defines the look and feel for the redesigned K‑Pop Demon
 * Hunters map.  Inspired by current mobile UI/UX trends【869428546445513†L90-L117】, it
 * embraces minimalism, soft pastels and glassmorphism effects for a
 * contemporary yet playful experience.  All colours are configurable via
 * CSS custom properties at the top of the file.  The layout adapts to
 * smartphones and tablets using flexible widths and fixed bars.  Long
 * lists and panels scroll internally so the map remains visible beneath.
 */

:root {
    /* Colour palette */
    --bg: #fef9fd;
    --primary: #ff6b9a;      /* vibrant pink for accents */
    --secondary: #7c4dff;    /* deep purple for active states */
    --text: #333333;
    --muted: #666666;
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: 12px;
    --radius: 16px;
}

/* Reset and base styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

/* Full‑screen map container */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Glassmorphism utility class */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

/* Top bar containing search and categories */
#top-bar {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 16px);
    max-width: 600px;
    padding: 8px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

/* Search input container */
#search-box {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
#search-box input {
    flex: 1;
    font-size: 1rem;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text);
    padding: 6px 0;
}
#search-box input::placeholder {
    color: var(--muted);
}

/* Category bar */
#category-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}
#category-bar::-webkit-scrollbar {
    display: none;
}
.category-btn {
    flex: none;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 9999px;
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease;
}
.category-btn.active {
    background: var(--secondary);
}
.category-btn:hover:not(.active) {
    background: #ff94b8;
}

/* Results panel */
#results-panel {
    position: fixed;
    top: 90px;
    left: 8px;
    bottom: 80px;
    width: calc(100% - 16px);
    max-width: 420px;
    overflow-y: auto;
    z-index: 4;
    display: flex;
    flex-direction: column;
}
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.results-header h2 {
    margin: 0;
    font-size: 1.1rem;
}
.results-header button {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--muted);
}

#results-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px;
}
.result-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.result-item:last-child {
    margin-bottom: 0;
}
.result-item:hover {
    background: rgba(255, 255, 255, 0.9);
}
.result-item h3 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.result-item p {
    margin: 0 0 4px;
    font-size: 0.75rem;
    color: var(--muted);
}
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 9999px;
    background: var(--primary);
    color: white;
}
.tag.hero {
    background: var(--primary);
}
.tag.idol {
    background: #ff8f5e;
}
.tag.demon {
    background: #4caf50;
}

/* Bottom control bar */
#bottom-bar {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 5;
}
.fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Toggle for results panel on mobile */
#kdh-toggle {
    position: fixed;
    bottom: 70px;
    left: 8px;
    width: 60px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 5;
}

/* Feed overlay used for place details and user bios */
.feed-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;       /* 스마트폰 세로 화면 정도의 최대 폭 */
    height: 100%;
    max-height: 620px;       /* 스마트폰 세로 화면 정도의 최대 폭 */
    background: rgba(255, 255, 255, 0.1); /* 원하는 투명도 값으로 변경 background: var(--glass-bg); */
    backdrop-filter: blur(calc(var(--glass-blur) * 1.5));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 1.5));
    z-index: 15;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}
.feed-header {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px;
}
.feed-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
}
#content-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}
.feed-section {
    margin-bottom: 20px;
}
.feed-section h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    color: var(--text);
}
.feed-section p {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: var(--muted);
}
.contribution-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.contribution-card .user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary);
}
.contribution-card .comment {
    font-size: 0.8rem;
    color: var(--text);
}
.contribution-card .video {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

/* Additional styling for details button in info window */
.info-window .info-actions button.details-btn {
    font-size: 1rem;
    color: var(--secondary);
}
.fab:hover {
    background: var(--secondary);
}
.fab:active {
    transform: scale(0.9);
}

/* Offcanvas profile panel */
.offcanvas {
    position: fixed;
    left: 5%;
    right: 5%;
    bottom: 0;
    height: 70%;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(100%);
    transition: transform 0.4s ease;
    z-index: 10;
    display: flex;
    flex-direction: column;
}
.offcanvas.show {
    transform: translateY(0);
}
.offcanvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.offcanvas-header h2 {
    margin: 0;
    font-size: 1.1rem;
}
.offcanvas-header button {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--muted);
    cursor: pointer;
}
.offcanvas-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 0.9rem;
}

/* Profile panel styling */
.profile-meta {
    margin-bottom: 12px;
    text-align: center;
}
.profile-email {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
}
.profile-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
}
.profile-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 8px 12px;
    min-width: 70px;
}
.profile-stats .stat span {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}
.profile-stats .stat small {
    font-size: 0.65rem;
    color: var(--muted);
}
.offcanvas-content ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}
.offcanvas-content li {
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text);
}

/* Modal overlay */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}
.modal.hidden {
    display: none;
}
.modal-content {
    width: 90%;
    max-width: 420px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.modal-content h3 {
    margin: 0;
    font-size: 1.2rem;
}
.modal-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}
.modal-content input,
.modal-content select,
.modal-content textarea {
    padding: 8px 10px;
    font-size: 0.9rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.85);
    outline: none;
    width: 100%;
    color: var(--text);
}
.modal-content textarea {
    min-height: 80px;
    resize: vertical;
}
.modal-content button {
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}
.modal-content button#login-submit-btn,
.modal-content button#save-place-btn {
    background: var(--primary);
    color: white;
}
.modal-content button#cancel-place-btn {
    background: #e0e0e0;
    color: var(--text);
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Info window styling for markers (we rely on default overlay with custom HTML) */
/*
 * Custom overlay styling for place info windows.  Constrain the maximum
 * width so that the overlay does not stretch beyond the viewport on
 * mobile devices.  We use a percentage of the viewport width for
 * responsiveness and a pixel fallback.  All elements inside adopt
 * border-box sizing to prevent unexpected overflow.
 */
.info-window {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    max-width: min(280px, 90vw);
    width: auto;
    overflow-wrap: break-word;
    box-sizing: border-box;
    overflow-x: hidden;
}
.info-window h4 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.info-window .video {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 4px;
}

/* Ensure embedded video fits container */
.info-window .video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Ensure all elements inside info window follow border-box sizing */
.info-window * {
    box-sizing: border-box;
}
.info-window p {
    margin: 0 0 4px;
    font-size: 0.8rem;
    color: var(--muted);
}
.info-window a {
    font-size: 0.8rem;
    color: var(--secondary);
    text-decoration: none;
}
.info-window .info-actions {
    margin-top: 6px;
    display: flex;
    gap: 8px;
}
.info-window .info-actions button {
    border: none;
    background: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 2px;
}
.qr-container {
    margin-top: 6px;
    display: none;
}

/* Styling for share link input and copy button within info window */
.share-link {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.share-link input {
    flex: 1;
    padding: 4px 6px;
    font-size: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    background: rgba(255,255,255,0.9);
    color: var(--text);
}
.share-link button {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: none;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    cursor: pointer;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.toast.show {
    opacity: 1;
}