/* ================================== */
/* ========= 공통 기본 스타일 ========= */
/* ================================== */
body { font-family: "Inter", sans-serif; background: #f5f7fa; padding: 20px; }
html, body { height: 100%; margin: 0; }
.container { background: #fff; padding: 30px; border-radius: 12px; max-width: 1100px; margin: auto; box-shadow: 0 6px 20px rgba(0,0,0,0.08); position: relative; }
h1, h2 { text-align: center; color: #1a73e8; }
.main-content { display: flex; gap: 30px; flex-wrap: wrap; }
.section { flex: 1; background: #fafafa; padding: 20px; border-radius: 8px; border: 1px solid #ddd; min-width: 300px; }
.section h3 { border-bottom: 2px solid #1a73e8; padding-bottom: 5px; }
.input-group { margin-bottom: 15px; }
.input-group label { display: block; font-weight: bold; margin-bottom: 5px; }
.input-group input, .input-group select { width: 95%; padding: 10px; border-radius: 4px; border: 1px solid #ccc; }
.error-message { color: #d93025; text-align: center; margin: 15px 0; font-weight: bold; min-height: 20px; }
.calc-button { width: 100%; padding: 15px; font-size: 1.2em; background: #1a73e8; color: #fff; border: none; border-radius: 5px; margin-top: 20px; cursor: pointer;}
.calc-button:hover { background: #155ab6; }
.result-section { margin-top: 30px; padding: 20px; background: #e8f0fe; border-radius: 8px; }
.info-box { font-size: 0.9em; color: #555; background-color: #f0f0f0; padding: 10px; border-radius: 4px; line-height: 1.5; margin-top: 5px; }
.info-box-red { font-size: 0.9em; color: #d93025; padding-top: 5px; text-align: center; }
.radio-button-group { display: flex; gap: 15px; align-items: center; padding: 5px 0; }
.radio-button-group label { font-weight: normal; }


/* ================================== */
/* ======== index.html (랜딩) ======== */
/* ================================== */
.landing-container { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; background: #f5f7fa; text-align: center; }
.landing-content { max-width: 500px; width: 90%; }
.landing-logo { max-width: 350px; margin-bottom: 40px; }
.landing-buttons { display: flex; flex-direction: column; gap: 20px; }
.landing-button { display: block; padding: 20px; font-size: 1.3em; font-weight: bold; color: #fff; background-color: #1a73e8; border-radius: 12px; text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.landing-button:hover { background-color: #155ab6; transform: translateY(-3px); }


/* ================================== */
/* ======== phone.html 스타일 ======== */
/* ================================== */
.top-right-buttons { position: absolute; top: 20px; right: 20px; display: flex; gap: 15px; z-index: 10; }
.icon-button { background: none; border: none; font-size: 1.2em; color: #6c757d; cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.icon-button:hover { color: #1a73e8; }
.icon-button span { font-size: 0.6em; margin-top: 4px; }
.hamburger-icon { display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.hamburger-icon .bar { width: 1em; height: 2px; background-color: currentColor; }
.action-buttons { position: absolute; top: 20px; left: 20px; display: flex; gap: 10px; z-index: 10; }
.action-buttons button { padding: 8px 15px; font-size: 0.9em; border-radius: 5px; border: 1px solid #1a73e8; background-color: #1a73e8; color: #fff; cursor: pointer; }
.view-mode-buttons { text-align: center; margin-bottom: 20px; }
.view-mode-buttons button { padding: 10px 20px; margin: 0 5px; border: 1px solid #1a73e8; border-radius: 5px; background-color: #fff; color: #1a73e8; font-size: 1em; cursor: pointer;}
.view-mode-buttons button.active { background-color: #1a73e8; color: #fff; }
.comparison-toggle { text-align: center; margin-bottom: 20px; }
.monthly-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.monthly-table th, .monthly-table td { border: 1px solid #ddd; padding: 8px; text-align: center; }
.monthly-table th { background: #f2f2f2; }
.monthly-table-wrapper { width: 100%; overflow-x: hidden; } /* 모바일 가로 스크롤을 위해 추가 */
.winner { font-size: 1.2em; font-weight: bold; color: #1e8e3e; margin-bottom: 15px; text-align: center;}
#discount-breakdown { display: flex; gap: 15px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }
.breakdown-card { flex: 1; background: #fff; border: 1px solid #ddd; padding: 15px; border-radius: 8px; }
.breakdown-card h4 { margin-top: 0; color: #1a73e8; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 10px; }
.breakdown-card p { margin: 5px 0; }
.tooltip-icon { cursor: help; margin-left: 5px; color: #666; position: relative; display: inline-block; }
.tooltip-text { visibility: hidden; width: 250px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 8px; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -125px; opacity: 0; transition: opacity 0.3s; font-size: 0.8em; }
.tooltip-icon:hover .tooltip-text { visibility: visible; opacity: 1; }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; }
.modal-content { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; padding: 30px; border-radius: 10px; z-index: 1001; width: 90%; max-width: 700px; max-height: 80vh; overflow-y: auto; }
.modal-close-button { position: absolute; top: 15px; right: 15px; font-size: 1.8em; cursor: pointer; }
.modal-footer { margin-top: 25px; padding-top: 15px; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.date-calculator { display: flex; gap: 20px; }
.date-calculator-section { flex: 1; }
.sidebar-menu { position: fixed; top: 0; right: -280px; width: 280px; height: 100%; background: #fff; z-index: 2000; transition: right 0.3s ease-in-out; }
.sidebar-menu.active { right: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #eee; }
.sidebar-menu nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-menu nav a { display: block; padding: 15px 20px; color: #333; text-decoration: none; }
.sidebar-menu nav a i { margin-right: 10px; }
.footer-container { text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee; font-size: 0.85em; color: #888; }

/* =================================== */
/* ======== internet.html 스타일 ======== */
/* =================================== */
.result-breakdown { display: flex; gap: 15px; text-align: center; justify-content: space-between; padding: 10px; flex-wrap: wrap; }
.result-card { flex: 1; min-width: 200px; padding: 15px 10px; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fff; }
.result-card h4 { margin-top: 0; margin-bottom: 10px; color: #1a73e8; font-size: 1.1em; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.result-card p { margin: 8px 0; font-size: 0.95em; min-height: 20px; }
.result-card hr { border: 0; border-top: 1px dashed #ccc; margin: 10px 0; }
.result-summary { text-align: right; margin-top: 20px; padding: 15px; }
.result-summary hr { margin: 10px 0 10px 50%; border: 0; border-top: 1px solid #ccc; }
.result-summary .summary-total { font-size: 1.5em; color: #1a73e8; }
.result-summary .summary-support, .result-summary .summary-contract-total { font-size: 1.1em; }
.result-table-container { max-height: 400px; overflow-y: auto; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 15px; }
.result-table { width: 100%; border-collapse: collapse; text-align: center; }
.result-table thead { background-color: #f2f2f2; }
.result-table th, .result-table td { padding: 10px 8px; border-bottom: 1px solid #e0e0e0; font-size: 0.9em; }
.result-table th { font-weight: bold; }
.result-table tbody tr:last-child td { border-bottom: none; }
.result-table .plan-change-row { background-color: #fffbdd !important; font-weight: bold; }
.result-table .plan-change-row td { color: #b45309; }
.fieldset-grid-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.selection-fieldset { border: 1px solid #ddd; border-radius: 8px; padding: 10px 15px 5px 15px; margin-bottom: 15px; background-color: #fcfcfc; }
.selection-fieldset legend { font-weight: bold; color: #1a73e8; padding: 0 10px; font-size: 1.0em; }
.checkbox-align-group { display: flex; align-items: center; padding-top: 25px; }
.checkbox-align-group input[type="checkbox"] { margin: 0 8px 0 0; width: auto; }
.checkbox-align-group label { margin: 0; font-weight: bold; cursor: pointer; }
.fee-total { font-size: 1.1em; color: #1a73e8; text-align: right; }
.fee-note { font-size: 0.85em; color: #666; text-align: right; }
.result-subtitle { text-align: center; color: #0d47a1; font-size: 1.2em; font-weight: bold; margin-top: 25px; margin-bottom: -15px; padding: 8px; background-color: #e3f2fd; border-radius: 8px; border: 1px dashed #90caf9; }
.breakdown-card.compact { padding: 15px; display: flex; flex-direction: column; min-width: 300px; }
.breakdown-card.compact h4 { font-size: 1.1em; padding-bottom: 8px; margin-bottom: 8px; text-align: center; }
.compact-summary-list { list-style: none; padding: 0; margin: 0; font-size: 0.9em; line-height: 1.6; }
.compact-summary-list li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #f0f0f0; }
.compact-summary-list li:last-child { border-bottom: none; }
.compact-summary-list li span:first-child { padding-right: 10px; color: #555; word-break: keep-all; }
.compact-summary-list li span:last-child { font-weight: 500; white-space: nowrap; }
.compact-summary-list li.discount span { color: #1a73e8; }
.compact-summary-total { margin-top: auto; padding-top: 10px; }
.compact-summary-total hr { border: 0; border-top: 1px solid #ccc; margin: 8px 0; }
.compact-summary-total p { margin: 8px 0; }
.compact-summary-total .summary-total { display: flex; justify-content: space-between; align-items: center; font-size: 1.1em; font-weight: bold; color: #1a73e8; }
.compact-summary-total .summary-total strong { font-size: 1.2em; color: #d93025; }
.compact-summary-total .mobile-discount { text-align: right; font-size: 0.85em; color: #1e8e3e; font-weight: bold; }

@media (max-width: 992px) { .fieldset-grid-container { grid-template-columns: 1fr; gap: 0; } }

/* ================================== */
/* 추가된 요소 스타일 (Navbar 등)     */
/* ================================== */
.navbar {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.navbar-brand a { font-size: 1.5rem; font-weight: bold; color: #333; text-decoration: none; }
.navbar-nav { list-style: none; display: flex; margin: 0; padding: 0; }
.navbar-nav li a { display: block; padding: 1.5rem 1rem; text-decoration: none; color: #555; font-weight: 500; transition: color 0.3s, background-color 0.3s; }
.navbar-nav li a:hover { color: #007bff; background-color: #f8f9fa; }
.info-section { max-width: 1200px; margin: 2rem auto; padding: 2rem; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.info-section h2 { margin-top: 0; border-bottom: 2px solid #eee; padding-bottom: 1rem; margin-bottom: 1rem; font-size: 1.4rem; }
.info-section ul { list-style: none; padding: 0; margin: 0; }
.info-section ul li { padding: 0.75rem 0.5rem; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.info-section ul li:last-child { border-bottom: none; }
.info-section ul li span:first-child { font-weight: bold; color: #007bff; margin-right: 1rem; }
.info-section ul li .date { color: #888; font-size: 0.9em; white-space: nowrap; }
.guide-section p { line-height: 1.7; color: #444; }

/* ================================== */
/* ▼▼▼ 공지사항 & 로그인 추가 스타일 ▼▼▼ */
/* ================================== */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0); /* 투명하지만 클릭 가능 */
    z-index: 1001;
}
.side-menu {
    position: fixed; top: 0; right: 0; width: 250px; height: 100%;
    background-color: #fff; box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    transform: translateX(100%); transition: transform 0.3s ease-in-out;
    z-index: 1002; padding-top: 20px; box-sizing: border-box;
}
.side-menu.show { transform: translateX(0); }
.side-menu a { display: block; padding: 15px 20px; color: #333; text-decoration: none; font-size: 16px; }
.side-menu a:hover { background-color: #f1f1f1; }

.modal-content {
    max-height: 85vh;
}
#notice-list { margin-top: 20px; }
.notice-item { border-bottom: 1px solid #eee; }
.notice-title {
    padding: 15px 10px; font-weight: bold; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
}
.notice-title:hover { background-color: #f8f9fa; }
.notice-content {
    padding: 15px 20px; background-color: #f8f9fa;
    border-top: 1px solid #eee;
}
.notice-content p { margin: 0 0 10px; }
.new-badge {
    background-color: #d93025; color: white;
    font-size: 0.7em; font-weight: bold;
    padding: 3px 6px; border-radius: 4px;
    margin-left: 8px;
}
.delete-btn {
    background: #f1f1f1; border: 1px solid #ddd;
    padding: 4px 8px; font-size: 0.8em;
    border-radius: 4px; cursor: pointer;
}
.delete-btn:hover { background: #e0e0e0; }
#write-notice-btn {
    padding: 10px 15px; background-color: #1a73e8; color: white;
    border: none; border-radius: 5px; cursor: pointer; float: right;
}
#write-modal #notice-title {
    width: calc(100% - 20px); padding: 10px;
    font-size: 1.2em; margin-bottom: 15px;
}
#editor-container { height: 300px; margin-bottom: 15px; }
#save-notice-btn {
    padding: 12px 25px; background-color: #1a73e8; color: white;
    border: none; border-radius: 5px; cursor: pointer; font-size: 1em;
}
#login-modal .modal-content { max-width: 400px; }
.login-form { display: flex; flex-direction: column; gap: 15px; margin-top: 20px;}
.login-form input {
    width: 100%; padding: 12px; box-sizing: border-box;
    border: 1px solid #ccc; border-radius: 5px;
}
.login-form button {
    width: 100%; padding: 12px; background-color: #1a73e8; color: white;
    border: none; border-radius: 5px; cursor: pointer; font-size: 1em;
}
.login-form button:hover { background-color: #155ab6; }

/* ======================================================= */
/* ======== 모바일 반응형 스타일 (자동 인식) ======== */
/* ======================================================= */
/* 화면 너비가 768px 이하일 때 아래 스타일을 적용합니다. */
@media (max-width: 768px) {
    .container { max-width: 100%; padding: 15px; box-sizing: border-box; }
    h1 { font-size: 1.5em; margin-top: 55px; } /* UI 수정: 상단 마진 증가 */
    .comparison-toggle label { display: block; margin-right: 0 !important; margin-bottom: 10px; font-size: 0.9em; }
    .main-content { flex-direction: column; gap: 15px; }
    .section { min-width: auto; width: 100%; padding: 15px; box-sizing: border-box; }
    .input-group input, .input-group select { width: 100%; box-sizing: border-box; }
    .calc-button { font-size: 1.1em; padding: 12px; margin-top: 15px; margin-bottom: 15px; }
    .result-section { padding: 15px; }
    .monthly-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 10px; }
    .monthly-table { width: auto; }
    .monthly-table th, .monthly-table td { padding: 6px 4px; font-size: 0.75em; white-space: nowrap; }
    .monthly-table th { white-space: normal; word-break: keep-all; min-width: 70px; }
    .tooltip-text { width: 140px; margin-left: -70px; left: 50%; bottom: 110%; font-size: 0.75em; }
    /* UI 수정: 모바일 버튼 크기 및 위치 조정 */
    .top-right-buttons { top: 15px; right: 10px; gap: 10px; }
    .icon-button { font-size: 1.1em; }
    .action-buttons { top: 15px; left: 10px; gap: 5px; }
    .action-buttons button { padding: 6px 10px; font-size: 0.8em; }
    .modal-content { width: 95%; padding: 20px; }
}

/* ================================== */
/* ======== 인쇄 스타일 (통합) ======== */
/* ================================== */
@media print {
    /* --- 공통 인쇄 설정 --- */
    @page {
        size: A4 portrait;
        margin: 0.7cm;
    }
    body, .container {
        background: #fff !important; color: #000 !important;
        font-size: 7pt;
        box-shadow: none !important; padding: 0 !important;
        margin: 0 !important; border: none !important;
    }

    /* 1. 인쇄에 불필요한 모든 UI 요소와 '입력' 관련 섹션을 전부 숨깁니다. */
    #page-footer, h1, .top-right-buttons, .action-buttons, .view-mode-buttons,
    .section, /* '매장 구매', '자급제 구매' 등 모든 입력 섹션 */
    #error-message, .calc-button, #side-menu, .modal-overlay, #menu-overlay,
    .comparison-toggle, #prorate-option-group,
    #penalty-calculator-wrapper > h2, #penalty-calculator-wrapper > .info-box-red, #calculateAllPenaltiesBtn {
        display: none !important;
    }

    /* 2. '결과' 영역의 불필요한 여백 등을 제거합니다. */
    /* 이제 브라우저가 화면에 보이는 결과(요금계산기 또는 위약금계산기)만 알아서 인쇄합니다. */
    #result, #penalty-calc-table-wrapper {
        padding: 0 !important; background: none !important; border-radius: 0 !important;
        margin: 0 !important; box-shadow: none !important; border: none !important;
    }

    /* 3. 나머지 표와 텍스트 스타일은 그대로 적용합니다. */
    #result h2, #result p, #result .winner, #penalty-calc-table-wrapper h3 { font-size: 8.5pt !important; margin: 0 !important; text-align: center; line-height: 1.2; }
    #result h2, #penalty-calc-table-wrapper h3 { font-size: 10pt !important; margin-bottom: 2px !important; }
    #device-price-comparison { font-size: 7.5pt !important; padding: 2px 0 !important; margin: 2px 0 !important; }
    #device-price-comparison h4 { font-size: 8.5pt !important; margin-bottom: 1px !important; }
    #discount-breakdown { display: flex !important; flex-wrap: nowrap !important; justify-content: space-around; gap: 4px !important; margin-bottom: 2px !important; padding-top: 2px !important; border-top: 1px solid #ccc !important; }
    .breakdown-card { flex: 1 1 45%; padding: 2px !important; font-size: 6.5pt !important; border: 1px solid #ccc !important; }
    .breakdown-card h4 { font-size: 7.5pt !important; margin: 0 0 1px 0 !important; padding-bottom: 1px !important; }
    .breakdown-card p { margin: 0 !important; padding: 0 !important; }
    .breakdown-card ul { list-style: none; padding: 0; margin: 2px 0; line-height: 1.2; }
    .breakdown-card li { margin: 0; padding: 0; }
    .breakdown-card li:not(:last-child)::after { content: none; }
    .monthly-table, #penalty-calc-table-wrapper table { table-layout: fixed; width: 100%; border-collapse: collapse; font-size: 7pt; page-break-inside: auto; }
    .monthly-table th:nth-child(1) { width: 14%; }
    .monthly-table th:nth-child(2) { width: 21%; }
    .monthly-table th:nth-child(3) { width: 23%; }
    .monthly-table th:nth-child(4) { width: 21%; }
    .monthly-table th:nth-child(5) { width: 21%; }
    .monthly-table thead, #penalty-calc-table-wrapper thead { display: table-header-group; }
    .monthly-table tr, .monthly-table td, .monthly-table th, #penalty-calc-table-wrapper tr, #penalty-calc-table-wrapper td, #penalty-calc-table-wrapper th { page-break-inside: avoid; page-break-after: auto; }
    .monthly-table th, .monthly-table td, #penalty-calc-table-wrapper th, #penalty-calc-table-wrapper td { padding: 1px; border: 1px solid #ccc; line-height: 1.1; }
    .monthly-table th, #penalty-calc-table-wrapper th { background-color: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* --- internet.html 인쇄 스타일 --- */
    body:has(#printable-area) .container > *:not(#printable-area) { display: none !important; }
    #printable-area { display: flex !important; flex-direction: row !important; justify-content: space-between; align-items: flex-start; }
    #printable-area > hr { display: none !important; }
    #printable-area > .section { display: block !important; border: none !important; padding: 0 !important; margin: 0 !important; page-break-inside: avoid; }
    #summary-section-print { width: 42%; padding-right: 10px; }
    #table-section-print { width: 58%; }
    #summary-section-print > h3, #table-section-print > h3 { display: none !important; }
    #printable-area .result-subtitle { font-size: 9.5pt; padding: 4px; margin-top: 8px; margin-bottom: 5px; }
    #printable-area .result-breakdown { flex-direction: column; gap: 5px; padding: 0; }
    #printable-area .result-card { padding: 6px; min-width: 100%; }
    #printable-area .result-card p { font-size: 8pt; margin: 2px 0; min-height: auto; }
    #printable-area .result-summary { padding: 6px; margin-top: 8px; border: 1px solid #ccc; border-radius: 8px; }
    #printable-area .result-summary p { font-size: 8.5pt; margin: 2px 0; }
    #printable-area .result-summary .summary-total { font-size: 10pt; }
    #printable-area .result-table-container { max-height: none !important; overflow-y: visible !important; border: 1px solid #ccc !important; }
    #printable-area .result-table th, #printable-area .result-table td { padding: 1.5px 3px; line-height: 1.2; font-size: 8pt; }
    #printable-area .result-table th { background-color: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}