/* ===================================
   2025 Modern Tax Calculator Styles
   - Glass Morphism
   - Soft Shadows
   - Improved Typography
   - Enhanced User Experience
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 2025 Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    
    --text-dark: #2d3748;
    --text-medium: #4a5568;
    --text-light: #718096;
    
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', '맑은 고딕', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    padding-top: 160px;
    position: relative;
    color: var(--text-dark);
    line-height: 1.6;
}

/* Enhanced Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ===================================
   BANNER ADVERTISEMENTS
   =================================== */

/* Side Banners */
.side-banner {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 150px;
    height: 600px;
    z-index: 1000;
    display: none; /* 기본적으로 숨김 */
    align-items: center;
    justify-content: center;
}

.left-banner {
    /* 
    화면 끝과 컨테이너 사이의 정중앙
    전체 여백: (100vw - 1200px) / 2
    좌측 여백의 중앙: (100vw - 1200px) / 4
    배너 왼쪽 끝: 여백 중앙 - 75px (배너 절반)
    */
    left: calc(50% - 600px - 75px);
}

.right-banner {
    /* 
    화면 끝과 컨테이너 사이의 정중앙
    */
    right: calc(50% - 600px - 75px);
}

.side-banner .banner-content {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.side-banner .banner-content:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

.side-banner .banner-content p {
    padding: 10px;
}

/* Top Banners */
.top-banners {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    flex-wrap: wrap;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.top-banner {
    width: 100%;
    max-width: 600px;
    height: 100px;
    flex: 1 1 auto;
    min-width: 280px;
}

.top-banner .banner-content {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

.top-banner .banner-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.top-banner .banner-content:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===================================
   MAIN CONTAINER
   =================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ===================================
   HEADER
   =================================== */

.header {
    background: var(--primary-gradient);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header h1 {
    font-size: 2.8em;
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -1px;
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
}

.header p {
    font-size: 1.15em;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* ===================================
   TABS
   =================================== */

.tabs {
    display: flex;
    flex-wrap: wrap;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    padding: 5px 10px 0;
    gap: 5px;
}

.tab-button {
    flex: 1;
    min-width: 150px;
    padding: 16px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-button::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px 2px 0 0;
    transition: transform 0.3s ease;
}

.tab-button:hover {
    background: rgba(102, 126, 234, 0.08);
    color: var(--primary);
}

.tab-button:hover::before {
    transform: translateX(-50%) scaleX(0.5);
}

.tab-button.active {
    color: var(--primary);
    background: white;
    box-shadow: var(--shadow-sm);
}

.tab-button.active::before {
    transform: translateX(-50%) scaleX(1);
}

/* ===================================
   TAB CONTENT
   =================================== */

.tab-content {
    display: none;
    padding: 50px 40px;
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   CALCULATOR SECTION
   =================================== */

.calculator-section {
    max-width: 750px;
    margin: 0 auto;
}

.calc-title {
    font-size: 2em;
    color: var(--text-dark);
    margin-bottom: 12px;
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.calc-description {
    color: var(--text-medium);
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.7;
    font-size: 1.05em;
}

/* Section Headers (h3) */
h3 {
    color: var(--primary);
    font-size: 1.3em;
    font-weight: 700;
    margin-top: 35px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary-gradient);
}

/* ===================================
   INPUT GROUPS
   =================================== */

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95em;
    letter-spacing: -0.2px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: var(--text-dark);
    font-weight: 500;
}

.input-group input:hover,
.input-group select:hover {
    border-color: #cbd5e0;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85em;
    line-height: 1.4;
}

/* ===================================
   BUTTONS
   =================================== */

.calc-button {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    letter-spacing: -0.3px;
}

.calc-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.calc-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* ===================================
   RESULT BOX
   =================================== */

.result-box {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-box h3 {
    color: var(--text-dark);
    margin-bottom: 20px;
    margin-top: 0;
    font-size: 1.5em;
    border: none;
    padding-bottom: 0;
}

.result-box h3::after {
    display: none;
}

/* Calculation Process Box */
.result-box > div[style*="background:#f8f9fa"],
.result-box > div[style*="background: #f8f9fa"] {
    background: white !important;
    padding: 20px !important;
    border-radius: var(--radius-md) !important;
    margin: 20px 0 !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm) !important;
}

.result-box > div h4 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 700;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.result-item:hover {
    padding-left: 10px;
    background: rgba(102, 126, 234, 0.03);
    border-radius: var(--radius-sm);
}

.result-item:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 1.25em;
    color: var(--primary);
    padding-top: 20px;
    margin-top: 15px;
    border-top: 2px solid var(--primary);
}

.result-label {
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.95em;
}

.result-value {
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.05em;
    text-align: right;
}

/* ===================================
   INFO BOX
   =================================== */

.info-box {
    margin-top: 30px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #fff5e6 0%, #ffe8cc 100%);
    border-left: 4px solid #ff9800;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.info-box h4 {
    color: #e65100;
    margin-bottom: 10px;
    font-size: 1.05em;
    font-weight: 700;
}

.info-box p {
    color: #e65100;
    font-size: 0.9em;
    line-height: 1.7;
}

/* Warning/Alert Style Info Box */
.info-box[style*="background: #fff3cd"],
.info-box[style*="background:#fff3cd"] {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cc 100%) !important;
}

/* ===================================
   TABLES
   =================================== */

.tax-table {
    width: 100%;
    margin: 25px 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9em;
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.tax-table th,
.tax-table td {
    padding: 14px 12px;
    text-align: center;
}

.tax-table th {
    background: var(--primary-gradient);
    color: white;
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: -0.2px;
}

.tax-table thead tr th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.tax-table thead tr th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.tax-table tbody tr {
    transition: all 0.2s ease;
}

.tax-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
}

.tax-table tr:nth-child(even) {
    background: #f7fafc;
}

.tax-table td {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    font-weight: 500;
}

.tax-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-md);
}

.tax-table tbody tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-md) 0;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    body {
        padding: 8px;
        padding-top: 170px;
    }

    .top-banner {
        height: 60px;
        min-height: 60px;
    }

    .top-banners {
        padding: 6px;
        gap: 6px;
    }

    .top-banner .banner-content {
        border-radius: 8px;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-top: 180px; /* 배너 2개 (70px × 2) + padding + gap */
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .header p {
        font-size: 1em;
    }

    .tabs {
        padding: 5px;
    }

    .tab-button {
        min-width: 120px;
        font-size: 0.85em;
        padding: 14px 10px;
    }

    .tab-content {
        padding: 30px 20px;
    }

    .calc-title {
        font-size: 1.6em;
    }

    .calc-description {
        font-size: 0.95em;
    }

    .result-box {
        padding: 20px;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .result-value {
        text-align: left;
    }

    /* Hide side banners on mobile */
    .side-banner {
        display: none;
    }

    /* Adjust top banners for mobile */
    .top-banner {
        width: 100%;
        max-width: 100%;
        height: 70px;
        min-width: 100%;
        flex: 1 1 100%;
    }

    .top-banner .banner-content img {
        object-fit: contain;
        max-width: 100%;
        height: auto;
    }

    .top-banners {
        padding: 8px;
        gap: 8px;
        flex-direction: column;
    }

    /* Table responsive */
    .tax-table {
        font-size: 0.8em;
    }

    .tax-table th,
    .tax-table td {
        padding: 10px 6px;
    }
}

/* Medium Screens */
@media (min-width: 769px) and (max-width: 1280px) {
    body {
        padding-top: 140px;
    }

    .side-banner {
        display: none;
    }

    .top-banner {
        width: 100%;
        max-width: 48%;
        min-width: 280px;
        height: 90px;
    }

    .top-banners {
        padding: 12px;
        gap: 12px;
    }
}

/* Large Screens - 배너 표시 (컨테이너 침범 방지) */
/* 최소 1600px 이상에서만 배너 표시 */
/* 1200px (컨테이너) + 300px (배너) + 100px (최소 여백) = 1600px */
@media (min-width: 1600px) {
    .side-banner {
        display: flex; /* 배너 표시 */
    }
}

/* 1800px 이상 - body padding 적용 */
@media (min-width: 1800px) {
    body {
        padding-left: 140px;
        padding-right: 140px;
    }

    /* 
    body padding 고려한 중앙 배치
    화면 중앙에서 컨테이너 절반 + padding + 배너 절반
    */
    .left-banner {
        left: calc(50% - 600px - 140px - 75px);
    }

    .right-banner {
        right: calc(50% - 600px - 140px - 75px);
    }
}

/* Extra Large Screens */
@media (min-width: 1920px) {
    .container {
        max-width: 1400px;
    }

    .calculator-section {
        max-width: 850px;
    }

    /* 컨테이너 1400px 기준 재조정 */
    .left-banner {
        left: calc(50% - 700px - 140px - 75px);
    }

    .right-banner {
        right: calc(50% - 700px - 140px - 75px);
    }
}

/* ===================================
   INPUT GRID LAYOUT
   =================================== */

.input-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.input-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Responsive grid */
@media (max-width: 768px) {
    .input-grid,
    .input-grid-3 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .input-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Full width input in grid */
.input-full {
    grid-column: 1 / -1;
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.text-primary {
    color: var(--primary) !important;
}

.text-secondary {
    color: var(--secondary) !important;
}

.bg-gradient {
    background: var(--primary-gradient) !important;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 40px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

/* ===================================
   SCROLLBAR STYLING
   =================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
    body {
        background: white;
        padding: 0;
    }

    .top-banners,
    .side-banner,
    .tabs,
    .calc-button {
        display: none !important;
    }

    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .tab-content {
        display: block !important;
        page-break-after: always;
    }
}
