/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700;900&family=Noto+Sans+JP:wght@400;700;900&display=swap');

/* ===== 리셋 및 기본 스타일 ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', 'Noto Sans JP', Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

/* ===== 헤더 ===== */
header {
    background-color: #333;
    color: #fff;
    padding: 1em 0;
    text-align: center;
}

/* ===== 네비게이션 ===== */
nav {
    background-color: #eee;
    padding: 0.5em 0;
    position: relative;
}

.nav-list {
    list-style: none;
    padding: 0;
    text-align: center;
    margin: 0;
    z-index: 998;
}

.nav-list li {
    display: inline-block;
    margin: 0 15px;
}

.nav-list a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
    padding: 0.5em 1em;
    display: block;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-list a:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* ===== 햄버거 메뉴 ===== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    cursor: pointer;
    padding: 10px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
}

.menu-toggle .bar {
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.is-active .bar:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.menu-toggle.is-active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .bar:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

/* ===== 레이아웃 ===== */
.container {
    width: 80%;
    margin: auto;
    overflow: hidden;
    padding: 20px 0;
}

.hero {
    background: #5cb85c;
    color: #fff;
    padding: 50px 0;
    text-align: center;
    margin-bottom: 20px;
}

.section {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===== 버튼 공통 스타일 ===== */
button, 
.apply-button, 
.my-page-btn,
.admin-btn,
input[type="button"], 
input[type="submit"] {
    cursor: pointer;
    user-select: none;
    outline: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.apply-button {
    background-color: #007bff;
    color: white;
    padding: 12px 25px;
    font-size: 1.1em;
    display: inline-block;
    text-decoration: none;
    margin-top: 15px;
}

.apply-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.my-page-btn {
    background-color: #17a2b8;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    text-decoration: none;
    display: none;
}

.my-page-btn:hover {
    background-color: #138496;
}

.admin-btn {
    background: #007bff;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    margin-left: 10px;
    font-weight: 600;
    display: none;
}

/* ===== 로그인 상태 제어 ===== */
body.logged-out #loginBtn { display: inline-block; }
body.logged-out #logoutBtn,
body.logged-out #myPageBtn,
body.logged-out #userInfo,
body.logged-out #adminPanel,
body.logged-out .admin-btn { display: none; }

body.logged-in #loginBtn { display: none; }
body.logged-in #logoutBtn { display: inline-block; }
body.logged-in #myPageBtn { display: inline-block; }
body.logged-in #userInfo { display: flex; }

/* ===== 사용자 정보 ===== */
.user-info {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
}

/* ===== 코스 & 요금 ===== */
.course-items-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    margin-top: 15px;
}

.course-item {
    background-color: #e2f0d9;
    padding: 15px;
    border-left: 5px solid #5cb85c;
    border-radius: 4px;
    flex: 1;
    min-width: 300px;
}

.course-item h3 {
    color: #333;
    margin-top: 0;
    margin-bottom: 5px;
}

.course-item .price {
    font-size: 1.0em;
    font-weight: bold;
    color: #000;
    margin-bottom: 10px;
}

/* ===== 강사 소개 ===== */
.teacher-profile {
    padding: 20px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.teacher-image {
    max-width: 150px;
    height: auto;
    border-radius: 50%;
    display: block;
    margin: 15px auto 0 auto;
}

/* ===== 연락처 ===== */
.contact-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.contact-table td {
    padding: 10px;
    vertical-align: top;
}

.contact-table .contact-text {
    width: 70%;
    font-size: 1.1em;
}

.contact-table .contact-line {
    width: 30%;
    text-align: center;
}

.contact-table .line-icon {
    display: block;
    width: 60px;
    height: auto;
    margin: 0 auto;
}

.contact-table .contact-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 5px;
}

.contact-button-wrapper {
    text-align: center;
    margin-top: 20px;
}

/* ===== 지도 ===== */
#map-section h2 {
    text-align: left;
    margin-bottom: 20px;
}

.map-address {
    font-size: 1.0em;
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
}

#map {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto;
}

/* ===== 관리자 패널 ===== */
.admin-panel {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
}

.admin-panel h3 {
    margin-top: 0;
    color: #856404;
}

.admin-panel button {
    background-color: #ffc107;
    color: #212529;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 5px;
}

.admin-panel button:hover {
    background-color: #e0a800;
}

.member-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    margin-top: 10px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
    background-color: #f9f9f9;
    margin-bottom: 5px;
    border-radius: 4px;
}

.member-item:last-child {
    border-bottom: none;
}

.member-info {
    flex: 1;
    min-width: 200px;
}

.member-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.approve-btn {
    background-color: #28a745;
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.approve-btn:hover {
    background-color: #218838;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
    font-size: 12px;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.delete-btn:hover {
    background-color: #c82333;
}

.role-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

/* ===== 모달 공통 ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1002;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 700px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 9999;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-button:hover {
    color: #000;
    background-color: rgba(0, 0, 0, 0.1);
}

.modal-iframe {
    width: 100%;
    height: 600px;
    border: none;
}

/* ===== 인증 모달 ===== */
.auth-modal {
    max-width: 450px;
    padding: 30px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #e9ecef;
}

.auth-tabs .tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.auth-tabs .tab-btn:hover {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.05);
}

.auth-tabs .tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background-color: rgba(0, 123, 255, 0.05);
}

.auth-form {
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-form input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.auth-form button {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.auth-form button:hover {
    background: linear-gradient(135deg, #0056b3, #004494);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

.auth-form button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.auth-info {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.auth-info p {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

.auth-message {
    margin: 15px 0;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    animation: messageSlideIn 0.3s ease-out;
}

.auth-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.auth-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 탭 시스템 (마이페이지용) ===== */
.tab-buttons {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 14px;
}

.tab-btn.active {
    border-bottom-color: #007bff;
    color: #007bff;
    font-weight: bold;
}

.tab-btn:hover {
    background-color: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tab-content form label {
    font-weight: bold;
    margin-bottom: 5px;
}

.tab-content form input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.tab-content form input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.tab-content form input[readonly] {
    background-color: #f5f5f5;
}

.tab-content form button {
    padding: 12px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.tab-content form button:hover {
    background-color: #0056b3;
}

/* ===== 게임 버튼 스타일 ===== */
#gameBtn::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
    margin-left: 5px;
}

#gameBtn:hover {
    background-color: rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* ===== Footer ===== */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1em 0;
    margin-top: 20px;
}

/* ===== 모바일 대응 ===== */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 10px 0;
    }

    nav {
        padding: 1em 0;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        height: 60px;
    }

    .nav-list {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 998;
        background-color: #eee;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .nav-list.is-active {
        display: flex;
    }

    .nav-list li {
        display: block;
        margin: 0;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }

    .nav-list li:last-child {
        border-bottom: none;
    }

    .nav-list a {
        padding: 15px 20px;
        font-weight: normal;
        min-height: 44px;
    }

    .nav-list a:hover {
        background-color: #f0f0f0;
    }

    .menu-toggle {
        display: flex;
        position: static;
        margin-right: 15px;
        transform: translateY(0);
        width: 25px;
        height: 20px;
        padding: 5px;
    }

    .menu-toggle .bar {
        height: 2px;
    }

    .menu-toggle.is-active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .menu-toggle.is-active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    header h1 {
        font-size: 6vw;
    }
    
    header p {
        font-size: 3.5vw;
    }
    
    .section h2 {
        font-size: 5vw;
    }

    .section {
        padding: 15px;
    }

    .modal-content {
        max-width: 95%;
        padding: 25px;
        width: calc(100% - 20px);
    }

    .auth-modal {
        max-width: 95%;
        padding: 25px;
        width: calc(100% - 20px);
    }

    .auth-tabs .tab-btn {
        padding: 10px 15px;
        font-size: 13px;
    }

    .auth-form input {
        padding: 12px 14px;
        margin-bottom: 14px;
    }

    .auth-form button {
        padding: 14px 18px;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .my-page-btn {
        align-self: flex-end;
        margin-top: 5px;
    }

    .apply-button {
        min-height: 44px;
        padding: 15px 30px;
    }

    .tab-content form input,
    .tab-content form button {
        min-height: 48px;
        font-size: 16px;
        padding: 14px;
    }

    .course-item {
        min-width: 100%;
    }

    .member-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .member-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ===== 접근성 ===== */
.auth-form button:focus,
.apply-button:focus,
.tab-content form button:focus,
.nav-list a:focus,
.my-page-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.auth-form input:focus,
.tab-content form input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ===== iOS Safari 대응 ===== */
@supports (-webkit-touch-callout: none) {
    .auth-form button,
    .apply-button,
    .tab-content form button,
    .auth-form input,
    .tab-content form input {
        -webkit-appearance: none;
        -webkit-border-radius: 8px;
        border-radius: 8px;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ===== 소형 화면 대응 ===== */
@media (max-width: 320px) {
    .modal-content {
        width: 98%;
        padding: 20px;
    }
    
    .auth-modal {
        width: 98%;
        padding: 20px;
    }
    
    .auth-form button {
        font-size: 15px;
        padding: 12px;
    }
    
    .container {
        width: 98%;
    }
    
    .apply-button {
        padding: 12px 20px;
        font-size: 1em;
    }
}

/* ===== 대형 화면 대응 ===== */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .modal-content {
        max-width: 700px;
    }
    
    .auth-modal {
        max-width: 500px;
    }
    
    .course-items-wrapper {
        justify-content: center;
        gap: 30px;
    }
    
    .course-item {
        max-width: 400px;
    }
}