/**
 * Style kalkulatora wynagrodzeń 2026
 * Responsywne, czytelne tabele, tooltips
 */

/* ============ ZMIENNE ============ */
:root {
    --salary-primary: #4DB7FE;
    --salary-success: #28a745;
    --salary-warning: #ffc107;
    --salary-danger: #dc3545;
    --salary-info: #17a2b8;
    --salary-dark: #333;
    --salary-gray: #666;
    --salary-light-gray: #f6f6f6;
    --salary-border: #e5e5e5;
    --salary-white: #fff;
}

/* ============ LAYOUT ============ */
.salary-calculator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--salary-dark);
    line-height: 1.5;
}

.salary-section {
    background: var(--salary-white);
    border: 1px solid var(--salary-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.salary-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--salary-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--salary-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.salary-section-title i {
    color: var(--salary-primary);
}

/* ============ TRYB WPROWADZANIA ============ */
.input-mode-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.input-mode-btn {
    flex: 1;
    min-width: 150px;
    padding: 15px 20px;
    border: 2px solid var(--salary-border);
    border-radius: 8px;
    background: var(--salary-white);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.input-mode-btn:hover {
    border-color: var(--salary-primary);
}

.input-mode-btn.active {
    border-color: var(--salary-primary);
    background: rgba(77, 183, 254, 0.1);
}

.input-mode-btn input[type="radio"] {
    display: none;
}

.input-mode-btn .mode-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
}

.input-mode-btn .mode-desc {
    font-size: 12px;
    color: var(--salary-gray);
}

/* ============ SEKCJA KWOTY ============ */
.salary-amount-section {
    margin-top: 10px;
}

.salary-amount-section .salary-input {
    font-size: 18px !important;
    padding: 15px !important;
    height: auto !important;
}

#uniformAmountSection {
    padding: 15px;
    background: rgba(77, 183, 254, 0.05);
    border-radius: 8px;
    border: 1px dashed var(--salary-primary);
}

/* ============ DODATKI (STAŻOWY, FUNKCYJNY) ============ */
.addons-container {
    margin-top: 15px;
    padding: 15px;
    background: rgba(40, 167, 69, 0.05);
    border: 1px dashed var(--salary-success);
    border-radius: 8px;
}

.addon-group {
    min-width: 280px;
}

.addon-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.addon-unit {
    font-size: 14px;
    color: var(--salary-gray);
    min-width: 20px;
}

.addon-switch-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.addon-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin: 0;
}

.addon-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--salary-success);
    transition: 0.3s;
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.addon-switch input:checked + .switch-slider {
    background-color: var(--salary-success);
}

.addon-switch input:not(:checked) + .switch-slider {
    background-color: var(--salary-primary);
}

.addon-switch input:checked + .switch-slider:before {
    transform: translateX(0);
}

.addon-switch input:not(:checked) + .switch-slider:before {
    transform: translateX(20px);
}

.addon-switch-group.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.addon-switch-group.disabled .switch-slider {
    cursor: not-allowed;
    background-color: #999 !important;
}

.addon-switch-label {
    font-size: 12px;
    color: var(--salary-gray);
    white-space: nowrap;
}

/* ============ BADGE TRYBU DODATKÓW W TABELI ============ */
.addon-mode-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.addon-mode-badge.mode-included {
    background-color: rgba(77, 183, 254, 0.15);
    color: #0d6efd;
}

.addon-mode-badge.mode-added {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

/* ============ TOOLTIP ZALICZKA PIT ============ */
.pit-advance-cell {
    color: var(--salary-primary);
    cursor: help;
    text-decoration: underline dotted;
}

.pit-advance-cell .pit-tip-icon {
    font-size: 10px;
    margin-left: 2px;
    opacity: 0.7;
}

.pit-advance-cell .pit-tip-icon.text-white {
    color: #fff !important;
}

.pit-advance-cell:hover {
    color: #0d6efd;
}

/* Globalny tooltip container - dodawany do body przez JS */
.pit-tooltip-popup {
    position: fixed;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 0;
    border-radius: 8px;
    font-size: 12px;
    max-width: 350px;
    line-height: 1.6;
    z-index: 99999;
    pointer-events: auto;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    text-align: left;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pit-tooltip-header {
    background: rgba(255,255,255,0.1);
    padding: 8px 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.pit-tooltip-header i {
    margin-right: 6px;
    opacity: 0.8;
}

.pit-tooltip-body {
    padding: 10px 12px;
}

.pit-tip-line {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.pit-tip-line:last-child {
    border-bottom: none;
}

.pit-tip-bracket {
    padding-left: 12px;
    color: #adb5bd;
    font-size: 11px;
}

.pit-tip-deduction {
    color: #51cf66;
}

.pit-tip-result {
    margin-top: 5px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 13px;
}

.pit-tip-line strong {
    color: white !important;
}

.pit-tip-section {
    margin-top: 6px;
    font-weight: 600;
    color: #74c0fc;
}

.pit-tip-warning {
    color: #ffc078 !important;
    font-style: italic;
}

/* ============ FORMULARZE ============ */
.salary-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.salary-form-group {
    flex: 1;
    min-width: 200px;
}

.salary-form-group.small {
    min-width: 120px;
    max-width: 150px;
}

.salary-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--salary-dark);
    margin-bottom: 5px;
}

.salary-form-group label .tip-icon {
    margin-left: 5px;
    color: var(--salary-info);
    cursor: help;
}

.salary-input,
.salary-select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--salary-border);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.salary-input:focus,
.salary-select:focus {
    outline: none;
    border-color: var(--salary-primary);
}

.salary-input.error {
    border-color: var(--salary-danger);
}

/* Checkbox i radio */
.salary-checkbox,
.salary-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 8px;
}

.salary-checkbox input,
.salary-radio input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Radio group inline */
.salary-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.salary-radio-group .salary-radio {
    margin-bottom: 0;
}

/* ============ TABELA MIESIĘCY ============ */
.salary-table-container {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
}

.salary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.salary-table th,
.salary-table td {
    padding: 8px 10px;
    text-align: right;
    border-bottom: 1px solid var(--salary-border);
    white-space: nowrap;
}

.salary-table th {
    background: var(--salary-light-gray);
    font-weight: 600;
    font-size: 12px;
    color: var(--salary-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.salary-table th:first-child,
.salary-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--salary-white);
    z-index: 5;
}

.salary-table th:first-child {
    background: var(--salary-light-gray);
    z-index: 15;
}

.salary-table tbody tr:hover {
    background: rgba(77, 183, 254, 0.05);
}

.salary-table .month-name {
    font-weight: 500;
    color: var(--salary-dark);
}

/* Inputy w tabeli */
.month-input {
    width: 100%;
    min-width: 80px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--salary-border);
    border-radius: 4px;
    font-size: 13px;
    text-align: right;
}

.month-input:focus {
    outline: none;
    border-color: var(--salary-primary);
}

.month-input-small {
    min-width: 60px;
    max-width: 80px;
}

/* Wiersz sumy */
.salary-table tfoot tr {
    background: var(--salary-light-gray);
    font-weight: 600;
}

.salary-table tfoot td {
    border-top: 2px solid var(--salary-primary);
}

/* ============ TABELA WYNIKÓW ============ */
.results-table th {
    background: #2c3e50;
    color: var(--salary-white);
}

.results-table .result-net,
.results-table .result-employer-cost {
    color: var(--salary-success);
    font-weight: 600;
}

.results-table .result-gross {
    color: var(--salary-primary);
}

/* ============ KARTY PODSUMOWANIA ============ */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.summary-card {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.summary-card.gross {
    background: linear-gradient(135deg, #4DB7FE 0%, #3498db 100%);
    color: var(--salary-white);
}

.summary-card.net {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: var(--salary-white);
}

.summary-card.employer {
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
    color: var(--salary-white);
}

.summary-card.tax-rate {
    background: linear-gradient(135deg, #fd7e14 0%, #ffc107 100%);
    color: var(--salary-dark);
}

.summary-card .card-label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.summary-card .card-value {
    font-size: 24px;
    font-weight: 700;
}

.summary-card .card-sublabel {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 5px;
}

/* ============ SEKCJA COPYRIGHT ============ */
.copyright-eligible-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 15px;
    background: var(--salary-light-gray);
    border-radius: 8px;
    margin-top: 10px;
}

.copyright-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    font-size: 13px;
}

.copyright-warning i {
    color: #856404;
    margin-right: 8px;
}

/* ============ TOOLTIPS ============ */
.tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--salary-info);
    color: var(--salary-white);
    font-size: 10px;
    cursor: help;
    vertical-align: middle;
}

.salary-tooltip {
    position: fixed;
    max-width: 350px;
    background: var(--salary-white);
    border: 1px solid var(--salary-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 13px;
}

.salary-tooltip-section {
    padding: 15px;
    border-bottom: 1px solid var(--salary-border);
}

.salary-tooltip-section:last-child {
    border-bottom: none;
}

.salary-tooltip-header {
    font-weight: 600;
    color: var(--salary-primary);
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
}

.salary-tooltip-header i {
    margin-right: 5px;
}

.salary-tooltip-content {
    color: var(--salary-gray);
    line-height: 1.6;
    text-align: left;
}

.salary-tooltip-content ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.salary-tooltip-content li {
    margin-bottom: 4px;
}

/* ============ PRZYCISKI AKCJI ============ */
.salary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--salary-border);
}

.salary-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.salary-btn i {
    font-size: 14px;
}

.salary-btn-primary {
    background: var(--salary-primary);
    color: var(--salary-white);
}

.salary-btn-primary:hover {
    background: #3498db;
}

.salary-btn-success {
    background: var(--salary-success);
    color: var(--salary-white);
}

.salary-btn-success:hover {
    background: #218838;
}

.salary-btn-secondary {
    background: var(--salary-light-gray);
    color: var(--salary-dark);
    border: 1px solid var(--salary-border);
}

.salary-btn-secondary:hover {
    background: var(--salary-border);
}

.salary-btn-danger {
    background: var(--salary-danger);
    color: var(--salary-white);
}

.salary-btn-danger:hover {
    background: #c82333;
}

/* ============ OSTRZEŻENIA ============ */
.salary-warnings {
    margin-top: 20px;
}

.salary-warnings .alert {
    border-radius: 8px;
}

.salary-warnings ul {
    margin-bottom: 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 991px) {
    .salary-section {
        padding: 15px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .salary-form-group {
        min-width: 100%;
    }
    
    .salary-form-group.small {
        min-width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 767px) {
    .input-mode-selector {
        flex-direction: column;
    }
    
    .input-mode-btn {
        min-width: 100%;
    }
    
    .salary-table {
        font-size: 12px;
    }
    
    .salary-table th,
    .salary-table td {
        padding: 6px 8px;
    }
    
    .month-input {
        min-width: 60px;
        font-size: 12px;
    }
    
    .salary-radio-group {
        flex-direction: column;
    }
    
    .summary-card .card-value {
        font-size: 20px;
    }
    
    .salary-actions {
        flex-direction: column;
    }
    
    .salary-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Tooltip na mobile */
    .salary-tooltip {
        left: 10px !important;
        right: 10px !important;
        max-width: none;
    }
}

/* ============ PRINT ============ */
@media print {
    .salary-section {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
    
    .salary-actions,
    .tip-icon,
    .input-mode-selector {
        display: none !important;
    }
    
    .month-input {
        border: none;
        background: none;
    }
    
    .summary-card {
        background: var(--salary-light-gray) !important;
        color: var(--salary-dark) !important;
    }
}

/* ============ ANIMACJE ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.salary-section {
    animation: fadeIn 0.3s ease-out;
}

/* ============ AKCESORIA ============ */
.text-muted {
    color: var(--salary-gray);
    font-size: 12px;
}

.text-small {
    font-size: 12px;
}

.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }

.d-none { display: none !important; }
.d-block { display: block !important; }

/* Ukrycie sekcji */
.hidden-section {
    display: none;
}

/* ============ TABS (dla sekcji) ============ */
.salary-tabs {
    display: flex;
    border-bottom: 2px solid var(--salary-border);
    margin-bottom: 20px;
}

.salary-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--salary-gray);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.salary-tab:hover {
    color: var(--salary-primary);
}

.salary-tab.active {
    color: var(--salary-primary);
    border-bottom-color: var(--salary-primary);
}

.salary-tab-content {
    display: none;
}

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

/* ============ HEADER CHECKBOX ============ */
.salary-section-title .header-checkbox {
    margin-left: auto;
    font-weight: 400;
    font-size: 14px;
    color: var(--salary-gray);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.salary-section-title .header-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--salary-primary);
}

.salary-section-title .header-checkbox:hover {
    color: var(--salary-dark);
}

.salary-section-title .header-checkbox .tip-icon {
    margin-left: 4px;
}

/* ============ FAQ SECTION ============ */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: #fff;
    border: 1px solid var(--salary-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: var(--salary-primary);
}

.faq-item.active {
    border-color: var(--salary-primary);
    box-shadow: 0 2px 10px rgba(77, 183, 254, 0.15);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--salary-dark);
    transition: background 0.2s;
}

.faq-question:hover {
    background: rgba(77, 183, 254, 0.05);
}

.faq-question span {
    flex: 1;
    padding-right: 15px;
}

.faq-question i {
    color: var(--salary-primary);
    transition: transform 0.3s ease;
    font-size: 14px;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 300px;
    padding: 0 20px 16px 20px;
}

.faq-answer p {
    margin: 0;
    color: var(--salary-gray);
    font-size: 14px;
    line-height: 1.6;
}
