/* css/components.css */

/* Buttons */
.btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 0.5rem;
    outline: none;
}

.btn-lg {
    padding: -0.2rem 1.8rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
    transform: none;
}

.btn-outline:disabled,
.btn-outline[aria-disabled="true"] {
    border-color: var(--border-color);
    color: var(--text-muted);
    background-color: #f5f7fa;
}

.btn-outline:disabled:hover,
.btn-outline[aria-disabled="true"]:hover {
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Header */
.app-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-inner {
    max-width: var(--max-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    display: flex;
    align-items: center;
}

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

.header-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Header User Profile */
.header-user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
    position: relative;
}

.header-user-profile.hidden {
    display: none !important;
}

.user-name {
    font-weight: 700;
    color: var(--primary-color);
}

.user-greeting {
    font-size: 0.9rem;
    color: var(--text-muted);
}


/* Modal Backbone */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-main);
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-close:hover {
    color: var(--text-main);
}

/* Provider Login Buttons */
.auth-provider-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid;
}

.auth-provider-btn i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.btn-kakao {
    background-color: #FEE500;
    color: #000000;
    border-color: #FEE500;
}

.btn-kakao:hover {
    background-color: #f4dc00;
}

.btn-naver {
    background-color: #03C75A;
    color: #ffffff;
    border-color: #03C75A;
}

.btn-naver:hover {
    background-color: #02b350;
}

.btn-google {
    background-color: #ffffff;
    color: #000000;
    border-color: var(--border-color);
}

.btn-google:hover {
    background-color: var(--bg-muted);
}

.terms-consent-modal {
    z-index: 10000;
}

.terms-consent-modal-content {
    max-width: 460px;
}

.terms-consent-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.terms-consent-option {
    margin-bottom: 0.9rem;
}

.terms-consent-option-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.45;
}

.terms-consent-option-label input {
    margin-top: 0.2rem;
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.terms-consent-links {
    margin-left: 1.5rem;
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.terms-consent-links a {
    font-size: 0.88rem;
    color: var(--primary-color);
    text-decoration: underline;
}

.terms-consent-action {
    margin-top: 1.1rem;
    width: 100%;
    border: none;
}

.terms-consent-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.terms-consent-error {
    margin-top: 0.7rem;
    color: #ef4444;
    font-size: 0.88rem;
    display: none;
}

/* 모바일 사용자 드롭다운 메뉴 */
.mobile-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 130px;
    z-index: 2000;
    overflow: hidden;
}

.mobile-user-dropdown.open {
    display: block;
}

.mobile-user-dropdown a,
.mobile-user-dropdown button {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.mobile-user-dropdown a:hover,
.mobile-user-dropdown button:hover {
    background: var(--bg-muted);
    color: var(--primary-color);
}

/* ────────────────────────────────────────
   모바일 헤더 반응형
──────────────────────────────────────── */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 12px;
    }

    .header-logo-img {
        height: 30px;
    }

    .header-nav {
        gap: 0.6rem;
        flex-wrap: nowrap;
        align-items: center;
    }

    .nav-link {
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .header-nav .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    .header-user-profile {
        gap: 0.4rem;
        padding-left: 0.6rem;
    }

    /* 모바일: 마이페이지/로그아웃 버튼 숨기고 드롭다운으로 대체 */
    .header-user-profile #btn-header-mypage,
    .header-user-profile #btn-header-admin,
    .header-user-profile #btn-header-logout {
        display: none !important;
    }

    .user-name {
        font-size: 0.85rem;
        cursor: pointer;
        color: var(--primary-color);
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 4px;
        white-space: nowrap;
    }

    .user-name::after {
        content: '\25BE';
        font-size: 0.7rem;
    }

    .user-greeting {
        display: none;
    }

    .header-user-profile .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* POI 카테고리 뱃지 */
.poi-category {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-muted);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}

/* Footer */
#footer-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 400; /* 패널들(500)보다 아래에 오도록 설정 */
    pointer-events: none; /* 지도 클릭 방해 금지 */
}

.app-footer {
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    pointer-events: auto; /* 푸터 내 링크는 클릭 가능하게 */
    color: var(--text-main);
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: none; /* 상세 정보는 지도 페이지 방식처럼 기본적으로 숨김 */
}

.footer-bottom {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.footer-legal-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    font-size: 0.75rem;
}

.footer-legal-links a {
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-legal-links a:hover {
    color: var(--primary-color);
}

.footer-legal-links a[data-popup-type] {
    text-decoration: none;
}

.footer-legal-links .divider {
    color: var(--border-color);
}

.footer-bottom .copyright {
    margin: 0;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.business-info-summary {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-align: center;
    margin-bottom: 2px;
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Home Page Footer (거의 완전 투명) */
#footer-container.home-page-footer {
    z-index: 600; /* 메인 페이지에서 가시성 확보 */
}

.home-page .app-footer {
    background: rgba(255, 255, 255, 0.05); /* 투명도 미세 조정 */
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff; /* 완전 흰색으로 */
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); /* 텍스트 그림자 추가로 가독성 확보 */
}

.home-page .footer-legal-links a,
.home-page .footer-bottom .copyright,
.home-page .business-info-summary {
    color: rgba(255, 255, 255, 0.9);
}

.home-page .footer-legal-links .divider {
    color: rgba(255, 255, 255, 0.2);
}

.home-page .footer-legal-links a:hover {
    color: #fff;
}

.footer-layer-popup {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1300;
    pointer-events: none;
}

.footer-layer-popup.is-open {
    display: flex;
    pointer-events: auto;
}

.footer-layer-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
}

.footer-layer-popup__content {
    position: relative;
    width: min(960px, calc(100vw - 32px));
    max-height: calc(100vh - 80px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.footer-layer-popup__close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.footer-layer-popup__title {
    margin: 0;
    padding: 14px 46px 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
}

.footer-layer-popup__body {
    overflow: auto;
}

.footer-layer-popup__iframe {
    display: block;
    width: 100%;
    height: min(720px, calc(100vh - 150px));
    border: 0;
}

.footer-business-popup {
    padding: 20px 18px 22px;
}

.footer-business-popup p {
    margin: 0 0 10px;
    color: var(--text-main);
}

.footer-business-popup p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 6px 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .business-info-summary {
        font-size: 0.6rem;
        padding: 0 10px;
        display: block;
        line-height: 1.4;
    }

    .footer-legal-links {
        gap: 8px;
        font-size: 0.7rem;
    }

    .footer-layer-popup__content {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 32px);
    }

    .footer-layer-popup__title {
        font-size: 0.95rem;
        padding: 12px 42px 12px 14px;
    }

    .footer-layer-popup__iframe {
        height: calc(100vh - 190px);
    }

    .footer-business-popup {
        padding: 16px 14px 18px;
    }
}
