/* ==========================================================================
   layout.css - Responsive Page Layout Grid & Outer Containers
   ========================================================================== */

/* 1. Page Layout (Grid System & Sticky Footer) */
.app-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main"
        "footer footer";
    grid-template-rows: var(--header-height) 1fr var(--footer-height);
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    position: relative;
}

/* 2. Header Layout & Logo & User Area */
.app-header {
    grid-area: header;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Hamburger Menu Toggle (Mobile only, animated) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    padding: 0;
    z-index: 1010;
}

.menu-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: var(--deep-sea-dark);
    border-radius: 2px;
    transition: var(--transition-smooth);
    transform-origin: left center;
}

/* Logo Design */
.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.header-logo:hover .logo-icon {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px var(--primary-glow);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary-color), #0f172a);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 3px 8px var(--primary-glow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0;
    background: linear-gradient(135deg, var(--deep-sea-dark), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* User Business Section */
.header-user-section {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Common Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

/* 로그인 전 버튼군 */
.user-guest-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-login {
    color: var(--text-muted);
}

.btn-login:hover {
    color: var(--deep-sea-dark);
    background-color: var(--bg-primary);
}

.btn-register {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px var(--primary-glow);
}

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

/* 로그인 후 사용자 영역 */
.user-member-area {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.profile-name {
    font-size: 0.9rem;
    color: var(--deep-sea-light);
}

.profile-name strong {
    color: var(--deep-sea-dark);
}

.btn-logout {
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
}

.btn-logout:hover {
    border-color: var(--text-muted);
    color: var(--deep-sea-dark);
    background-color: var(--bg-primary);
}

/* 3. Sidebar Layout */
.app-sidebar {
    grid-area: sidebar;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.sidebar-close:hover {
    color: var(--deep-sea-dark);
}

.sidebar-placeholder {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--bg-card);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-placeholder-title {
    font-weight: 700;
    color: var(--deep-sea-dark);
    font-size: 1rem;
}

/* 4. Main Content Layout & Typography */
.app-main {
    grid-area: main;
    padding: 3rem 2.5rem;
    background-color: var(--bg-primary);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: background-color 0.3s ease;
}

.content-card {
    background-color: var(--bg-card);
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 3.5rem;
    box-shadow: var(--shadow-md);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.content-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -1px;
    color: var(--deep-sea-dark);
}

.content-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

.welcome-info {
    border-left: 4px solid var(--primary-color);
    background-color: var(--primary-light);
    padding: 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--primary-hover);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.welcome-info strong {
    color: var(--deep-sea-dark);
}

.welcome-note {
    background-color: var(--accent-light);
    border: 1px solid rgba(249, 115, 22, 0.15);
    padding: 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 2rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.welcome-note strong {
    color: var(--accent-text);
}

/* UI Action Buttons group */
.test-actions-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-test-modal {
    background-color: var(--deep-sea-medium);
    color: var(--bg-card);
}
.btn-test-modal:hover {
    background-color: var(--deep-sea-dark);
}

.btn-test-toast {
    background-color: transparent;
    color: var(--deep-sea-dark);
    border: 1px solid var(--border-color);
}
.btn-test-toast:hover {
    background-color: var(--bg-primary);
}

/* 5. Footer Layout */
.app-footer {
    grid-area: footer;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* ==========================================================================
   6. Advanced Responsive & Media Queries (Layout)
   ========================================================================== */

/* 1) Tablet Mode (769px ~ 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }
    
    .app-main {
        padding: 2rem 1.5rem;
    }
    
    .content-card {
        padding: 2.5rem;
    }
}

/* 2) Mobile Mode (max-width: 768px) */
@media (max-width: 768px) {
    .app-container {
        grid-template-areas:
            "header"
            "main"
            "footer";
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr var(--footer-height);
    }
    
    .app-header {
        padding: 0 1rem;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .sidebar-active .bar-top {
        transform: translateY(8px) rotate(45deg);
        background-color: var(--primary-color);
    }
    
    .sidebar-active .bar-middle {
        opacity: 0;
    }
    
    .sidebar-active .bar-bottom {
        transform: translateY(-8px) rotate(-45deg);
        background-color: var(--primary-color);
    }
    
    .app-sidebar {
        grid-area: unset;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(280px, calc(100vw - 48px));
        z-index: 1000;
        transform: translateX(-100%);
        transition: var(--transition-smooth);
        box-shadow: var(--shadow-lg);
        background-color: var(--bg-card);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }
    
    .sidebar-close {
        display: block;
    }
    
    .sidebar-active .app-sidebar {
        transform: translateX(0);
    }
    
    .app-container::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 990;
        opacity: 0;
        pointer-events: none;
        transition: var(--transition-smooth);
    }
    
    .sidebar-active::after {
        opacity: 1;
        pointer-events: auto;
    }
    
    .app-main {
        padding: 1.5rem 1rem;
    }
    
    .content-card {
        padding: 2rem 1.5rem;
    }
    
    .content-title {
        font-size: 1.75rem;
    }
    
    .content-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .btn {
        padding: 0.4rem 0.85rem;
        font-size: 0.8rem;
    }
    
    .user-member-area {
        gap: 0.75rem;
    }
    
    .profile-name {
        display: none;
    }
}

/* ==========================================================================
   7. Form Controls & Form Layout Style
   ========================================================================== */
.register-card {
    max-width: 500px;
    margin: 2rem auto;
    padding: 3rem;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--deep-sea-light);
    transition: color 0.3s ease;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

/* 다크모드 대응 드롭다운 화살표 색상 변경 */
body.dark-mode select.form-control {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.btn-submit {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 3px 8px var(--primary-glow);
    margin-top: 1rem;
}

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

.register-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.register-footer a {
    color: var(--primary-color);
    font-weight: 600;
    margin-left: 0.25rem;
}
.register-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ─── 실시간 유효성 검사 피드백 스타일 ─── */
.form-feedback {
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.35rem;
    transition: color 0.3s ease;
}

.form-feedback.success {
    color: #10b981; /* 에메랄드 그린 */
}

.form-feedback.error {
    color: #ef4444; /* 적색 */
}

/* 입력 필드 테두리 피드백 */
.form-control.is-valid {
    border-color: #10b981 !important;
}
.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

.form-control.is-invalid {
    border-color: #ef4444 !important;
}
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* 비활성화된 서브밋 버튼 디자인 */
.btn-submit:disabled {
    background-color: #94a3b8;
    color: #f1f5f9;
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}
body.dark-mode .btn-submit:disabled {
    background-color: #334155;
    color: #64748b;
}

/* ─── 비밀번호 보기/숨기기 버튼 및 강도 표시 스타일 ─── */
.input-password-wrapper {
    position: relative;
    width: 100%;
}

.input-password-wrapper .form-control {
    padding-right: 2.75rem; /* 우측 눈 아이콘 공간 확보 */
}

.password-toggle-btn {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1;
    padding: 0.25rem;
    z-index: 5;
    transition: var(--transition-smooth);
}

.password-toggle-btn:hover {
    color: var(--deep-sea-dark);
    transform: translateY(-50%) scale(1.08);
}

.password-strength-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.6rem;
}

.strength-bar {
    height: 6px;
    width: 120px;
    background-color: var(--strength-bg);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}

.strength-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.strength-bar.weak::after {
    width: 33.33%;
    background-color: var(--strength-weak);
    box-shadow: 0 0 6px var(--strength-weak);
}

.strength-bar.medium::after {
    width: 66.66%;
    background-color: var(--strength-medium);
    box-shadow: 0 0 6px var(--strength-medium);
}

.strength-bar.strong::after {
    width: 100%;
    background-color: var(--strength-strong);
    box-shadow: 0 0 6px var(--strength-strong);
}

.strength-text {
    font-size: 0.8rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

.strength-text.weak { color: var(--strength-weak); }
.strength-text.medium { color: var(--strength-medium); }
.strength-text.strong { color: var(--strength-strong); }

/* ─── 약관 동의 체크박스 영역 스타일 ─── */
.terms-container {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: left;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.terms-all-wrapper {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.3s ease;
}

.terms-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.terms-item:last-child {
    margin-bottom: 0;
}

.terms-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s ease;
}

.terms-all-wrapper .terms-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--deep-sea-dark);
}

.terms-required {
    color: var(--accent-color);
    font-weight: 700;
    margin-left: 0.25rem;
    font-size: 0.8rem;
}

/* 체크박스 정렬 보정 */
.terms-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* ─── 프로필 사진 업로드 섹션 스타일 ─── */
.profile-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
}

.profile-preview-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    background-color: var(--bg-primary);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
}

.profile-preview-wrapper:hover {
    border-color: var(--primary-color);
    transform: scale(1.03);
    box-shadow: 0 4px 12px var(--primary-glow);
}

#profile-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.profile-preview-wrapper:hover .profile-upload-overlay {
    opacity: 1;
}

.profile-upload-overlay i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.profile-upload-overlay span {
    font-size: 0.75rem;
    font-weight: 600;
}

.profile-upload-help {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

.profile-upload-help .help-specs {
    font-weight: 600;
    color: var(--primary-color);
}


