/* 공통 CSS - 인덱스/포트폴리오 공통 스타일 */

/* 폰트 및 기본 스타일 */
@font-face {
    font-family: 'TmonMonsori';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_two@1.0/TmonMonsori.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

:root{
    --main-blue:#092d4b;
    --main-orange:#ff6d28;
}

*{
    margin: 0;
    padding:0;
    border: 0;
    font-size: 100%;
    font-family: 'Pretendard', 'Roboto', 'Noto Sans KR' , sans-serif;
    box-sizing: border-box;
    line-height: 1.2;
    -webkit-font-smoothing: auto;
    color: var(--main-black);
}

html{
    position: relative;
}

body{
    overflow-y: auto;
}

ol, ul{
    list-style: none;
}

table{
    border-collapse: collapse;
    border-spacing: 0;
}

img{
    width: 100%;
    height: auto;
    vertical-align: top;
}

a{
    text-decoration: none;
}

input:focus {
    outline: none;
}

button {
    outline: 0;
    border: 0;
}

/* 컨테이너 및 헤더 스타일 */
.container{
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 3%;
}

.header{
    position: fixed;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0px 1px 6px #8d8d8d;
    z-index: 1000;
}

.hd-con{
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hd-logo{
    max-width: 190px;
}

.content-wrap{
    padding-top: 80px;
}

/* 반응형 헤더 */
@media screen and (max-width:991px){
    .container{
        padding: 0 3%;
    }
    .hd-con{
        height: 70px;
    }
    .content-wrap{
        padding-top:70px;
    }
}

@media screen and (max-width:768px){
    .container{
        padding:0 2%;
    }
}

/* PC와 모바일 공통 - 주가 예측 차트 오버플로우 해결 */
.info-card:has(#prediction-chart) {
    overflow: visible !important;
}

#prediction-chart {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.plotly-graph-div {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

/* PC와 모바일 공통 - 카드 화살표 기본 스타일 */
.info-card .card-arrow {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-card .card-arrow:hover {
    color: #333;
}

.info-card.collapsed .card-arrow i {
    transform: rotate(-90deg);
}

.info-card:not(.collapsed) .card-arrow i {
    transform: rotate(0deg);
}

/* 모달 공통 스타일 */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 420px;
    padding: 24px;
}

.auth-title {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
}

.auth-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.auth-field label {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.auth-field input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.auth-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.auth-actions button {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: #2d6cdf;
    color: #fff;
}

.btn-secondary {
    background: #f1f3f5;
    color: #333;
}

.auth-footer {
    margin-top: 12px;
    font-size: 12px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-link {
    color: #2d6cdf;
    cursor: pointer;
    text-decoration: underline;
}

.auth-close {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

.auth-modal-wrap {
    position: relative;
}

.auth-error {
    margin-top: 8px;
    color: #e03131;
    font-size: 12px;
    display: none;
}

/* 주문 확인/정정 모달 스타일 (공통 auth-modal과 동일 톤) */
/* 기본 스타일은 유지하되, 포트폴리오 원본 UI에 맞춰 재정의 (우선순위 위해 아래에 위치) */
.order-confirm-modal,
.order-modify-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    width: 90%;
    min-width: 240px;
    max-width: 300px; /* 원본: 작은 확인 모달 크기 */
    padding: 24px;
}

.order-confirm-title,
.order-modify-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

.order-confirm-content,
.order-modify-content { margin-bottom: 20px; }

/* Spinner utility */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.spinner-circle {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.order-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.order-info-row:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 16px;
    color: #2d6cdf;
}
.order-info-label { font-size: 14px; color: #666; }
.order-info-value { font-size: 14px; color: #333; font-weight: 600; }

.order-total { background: #f8f9fa; padding: 16px; border-radius: 8px; margin: 16px 0; }
.order-total-row { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.order-total-row:last-child { margin-bottom: 0; font-size: 18px; font-weight: 700; color: #2d6cdf; border-top: 1px solid #dee2e6; padding-top: 8px; }

.order-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}
.order-buttons button {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}
.btn-confirm { background: #28a745; color: #fff; }
.btn-confirm:hover { background: #218838; }
.btn-cancel { background: #6c757d; color: #fff; }
.btn-cancel:hover { background: #5a6268; }

/* 정정/취소 모달 전용 버튼 컬러 */
.order-modify-cancel { background: #6c757d; color: #fff; }
.order-modify-cancel:hover { background: #5a6268; }
.order-modify-submit { background: #ffc107; color: #000; }
.order-modify-submit:hover { background: #e0a800; }
.order-cancel-submit { background: #dc3545; color: #fff; }
.order-cancel-submit:hover { background: #c82333; }

.order-modify-modal .order-buttons { display: flex; gap: 12px; justify-content: center; }
.order-modify-modal .order-buttons button { flex: 1; max-width: 150px; }

/* 동의 모달 스타일 */
.consent-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    width: 92%;
    max-width: 860px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.consent-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
}

.consent-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.consent-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0;
}

.consent-content {
    height: 100%;
    overflow: auto;
    padding: 16px;
}

.consent-actions {
    padding: 10px 12px;
    border-top: 1px solid #edf2f7;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.consent-check {
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333;
}

/* 모바일 전용 스타일 */
@media (max-width: 768px) {
    #mobileLoginBtn {
        display: block;
    }
    
    body.auth #mobileMenuBtn {
        display: block !important;
    }
    
    body.auth #mobileLoginBtn {
        display: none !important;
    }
    
    body:not(.auth) #mobileMenuBtn {
        display: none !important;
    }
    
    body:not(.auth) #mobileLoginBtn {
        display: block !important;
    }
    
    #profileOverlay .auth-modal {
        max-width: 680px;
        width: 98%;
    }
}

/* 프로필 모달 스타일 */
#profileOverlay .auth-modal {
    width: 96vw;
    max-width: 720px;
    box-sizing: border-box;
}

/* Auth UI visibility handling */
body:not(.auth-ui-ready) #authMenuWrap{ visibility:hidden !important; }
body:not(.auth-ui-ready) #mobileMenuBtn{ visibility:hidden !important; }
body:not(.auth-ui-ready) #mobileLoginBtn{ visibility:hidden !important; }

/* Mobile-only login/menu button visibility based on auth state */
@media (max-width: 768px){
    body.auth #mobileMenuBtn{ display:block !important; }
    body.auth #mobileLoginBtn{ display:none !important; }
    body:not(.auth) #mobileMenuBtn{ display:none !important; }
    body:not(.auth) #mobileLoginBtn{ display:block !important; }
    /* Ensure profile modal is roomy across devices */
    #profileOverlay .auth-modal{ max-width: 680px; width: 98%; }
}
