:root {
    /* Tông màu chủ đạo mới #012f5b */
    --primary: #012f5b; 
    --primary-light: #024585;
    --primary-gradient: linear-gradient(135deg, #012f5b 0%, #024585 50%, #0056b3 100%);
    --bg-body: linear-gradient(135deg, #f4f7f6 0%, #e8f0f5 50%, #dde8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --success: #198754;
    --success-gradient: linear-gradient(135deg, #198754 0%, #20c997 100%);
    --danger: #dc3545;
    --text-main: #333333;
    --text-sub: #666666;
    --border-radius: 12px;
    --shadow-sm: 0 2px 8px rgba(1, 47, 91, 0.08);
    --shadow-md: 0 4px 20px rgba(1, 47, 91, 0.12);
    --shadow-lg: 0 8px 30px rgba(1, 47, 91, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-body);
    background-attachment: fixed;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    padding-bottom: 60px;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated background pattern */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(1, 47, 91, 0.03) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.container {
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

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

h4 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(1, 47, 91, 0.2);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- COMPACT INPUT CARD --- */
.input-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 25px;
    border-top: 5px solid;
    border-image: var(--primary-gradient) 1;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInDown 0.5s ease-out;
}

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

.input-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.input-card:hover::before {
    left: 100%;
}

.input-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(1, 47, 91, 0.2);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-control, .input-group-text {
    border: 1px solid #ced4da;
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.9);
}

.form-control:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(1, 47, 91, 0.1);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(1, 47, 91, 0.15), 0 4px 12px rgba(1, 47, 91, 0.1);
    transform: translateY(-2px);
    background: #fff;
}

.input-group-text {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    color: var(--primary);
}

/* --- SWITCH TOGGLE (GROSS/NET) --- */
.switch-container {
    display: flex;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    padding: 4px;
    border-radius: 30px;
    position: relative;
    cursor: pointer;
    width: 240px;
    margin: 0 auto 20px auto;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.switch-container:hover {
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(1, 47, 91, 0.15);
}

.switch-option {
    flex: 1;
    padding: 8px 0;
    z-index: 2;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-sub);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.switch-active { 
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch-bg {
    position: absolute;
    height: calc(100% - 8px);
    width: calc(50% - 4px);
    background: var(--primary-gradient);
    border-radius: 25px;
    top: 4px;
    left: 4px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(1, 47, 91, 0.3);
}

/* --- BUTTON --- */
.btn-calc {
    background: var(--primary-gradient);
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-calc::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-calc:hover::before {
    width: 300px;
    height: 300px;
}

.btn-calc:hover { 
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(1, 47, 91, 0.3);
}

.btn-calc:active {
    transform: translateY(0);
}

/* --- RESULT LAYOUT --- */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.info-panel {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(224, 224, 224, 0.5);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.info-panel:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.info-panel:hover::before {
    opacity: 1;
}

.panel-head {
    background: var(--primary-gradient);
    color: white;
    padding: 12px 18px;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(1, 47, 91, 0.2);
    position: relative;
}

.panel-head::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
}

/* Header doanh nghiệp nhạt hơn chút để phân biệt */
.head-com { 
    background: linear-gradient(135deg, #024585 0%, #0056b3 100%);
}

.row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px dashed #e0e0e0;
    font-size: 0.9rem;
    transition: all 0.2s;
    position: relative;
}

.row-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.2s;
}

.row-item:hover::before {
    transform: scaleY(1);
}

.row-item:hover {
    background: rgba(1, 47, 91, 0.02);
    padding-left: 22px;
}

.row-item:last-child { 
    border-bottom: none; 
}

.val { 
    font-weight: 700; 
    color: var(--text-main);
    transition: all 0.2s;
}

.row-item:hover .val {
    transform: scale(1.05);
}

.val-lg { 
    font-size: 1.15rem;
}

.highlight-net { 
    color: var(--success);
    background: linear-gradient(135deg, var(--success) 0%, #20c997 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.highlight-tax { 
    color: var(--danger);
}

/* Summary Box */
.summary-box {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-left: 5px solid;
    border-image: var(--success-gradient) 1;
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
}

.summary-box:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

/* Tax Collapse Header */
.tax-collapse-header:hover {
    background: rgba(220, 53, 69, 0.1) !important;
}

.tax-collapse-header:active {
    background: rgba(220, 53, 69, 0.15) !important;
}

.tax-breakdown {
    padding: 0;
}

.tax-step {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
    transition: all 0.2s;
}

.tax-step:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 6px rgba(1, 47, 91, 0.1);
}

.tax-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tax-step-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
}

.tax-step-amount {
    font-weight: 700;
    color: var(--danger);
    font-size: 1.1rem;
}

.tax-step-formula {
    font-size: 0.8rem;
    color: var(--text-sub);
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 10px;
    border-radius: 4px;
    margin-top: 8px;
    line-height: 1.5;
}

.tax-calculation-summary {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.08) 0%, rgba(220, 53, 69, 0.03) 100%);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px dashed rgba(220, 53, 69, 0.25);
}

.tax-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(220, 53, 69, 0.1);
}

.tax-summary-row:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 1rem;
    color: var(--danger);
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(220, 53, 69, 0.25);
}

.tax-summary-row {
    font-size: 0.85rem;
}

/* Removed old collapsible styles - now using inline styles for tax collapse */

/* Badge styling */
.badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Tooltip icon */
.fa-circle-info {
    cursor: help;
    transition: all 0.2s;
}

.fa-circle-info:hover {
    color: var(--primary) !important;
    transform: scale(1.2);
}

/* Radio buttons styling */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(1, 47, 91, 0.25);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .result-grid { 
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .col-salary { 
        margin-bottom: 10px; 
    }

    .input-card {
        padding: 20px;
    }

    .switch-container {
        width: 200px;
    }

    body::before {
        animation-duration: 20s;
    }

    .tax-breakdown {
        padding: 15px;
    }

    .tax-step {
        padding: 12px;
    }
}

@media (max-width: 576px) {
    .input-card {
        padding: 18px;
        border-radius: 10px;
    }

    .switch-container {
        width: 180px;
        font-size: 0.8rem;
    }

    .panel-head {
        padding: 10px 15px;
        font-size: 0.8rem;
    }

    .row-item {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .tax-breakdown {
        padding: 12px;
    }

    .tax-step-formula {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* Loading animation for results */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Smooth number transitions */
.val {
    transition: all 0.3s ease-out;
}

/* Print styles */
@media print {
    body::before {
        display: none;
    }
    
    .input-card,
    .text-center.mt-5,
    .d-flex.gap-2 {
        display: none !important;
    }
    
    .result-grid,
    .tax-details-panel {
        page-break-inside: avoid;
    }
    
    .info-panel,
    .tax-details-panel {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

