/**
 * Payslip Explainer - Styles
 * HTML/CSS recreation of UK umbrella company payslip
 * All classes prefixed with "pe-" to avoid WordPress theme conflicts
 */

/* Wrapper to prevent theme conflicts */
.payslip-explainer-wrapper {
    margin: 0 auto;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    color: #333;
    line-height: 1.4;
}

.payslip-explainer-wrapper * {
    box-sizing: border-box;
}

/* Main payslip container */
.payslip-explainer-wrapper .payslip {
    background: white;
    border: 1px solid #999;
}

/* Clickable hotspot styling */
.payslip-explainer-wrapper .pe-hotspot {
    cursor: pointer;
    transition: all 0.15s ease;
}

.payslip-explainer-wrapper .pe-hotspot:hover {
    background-color: rgba(230, 126, 34, 0.2) !important;
    outline: 2px solid #e67e22;
    outline-offset: -2px;
}

/* Logo section */
.payslip-explainer-wrapper .pe-logo-section {
    text-align: center;
    padding: 20px 20px 15px;
}

.payslip-explainer-wrapper .pe-logo-section img,
.payslip-explainer-wrapper .pe-logo-section svg {
    height: 60px;
    width: auto;
}

/* Orange header bar */
.payslip-explainer-wrapper .pe-main-header {
    background: linear-gradient(180deg, #e8792a 0%, #d4691f 100%);
    color: white;
    text-align: center;
    padding: 7px 10px;
    font-weight: bold;
    font-size: 10px;
    letter-spacing: 0.5px;
    border-top: 1px solid #c55a1a;
    border-bottom: 1px solid #c55a1a;
}

/* Top sections grid */
.payslip-explainer-wrapper .pe-top-grid {
    display: grid;
    grid-template-columns: 290px 1fr;
    border-bottom: 1px solid #999;
}

/* Company Income section */
.payslip-explainer-wrapper .pe-company-income {
    border-right: 1px solid #999;
}

.payslip-explainer-wrapper .pe-section-header-orange {
    background: linear-gradient(180deg, #e8792a 0%, #d4691f 100%);
    color: white;
    padding: 5px 8px;
    font-weight: bold;
    font-size: 10px;
    text-align: center;
    border-bottom: 1px solid #c55a1a;
}

.payslip-explainer-wrapper .pe-income-table {
    width: 100%;
    border-collapse: collapse;
}

.payslip-explainer-wrapper .pe-income-table td {
    padding: 3px 8px;
    border-bottom: 1px solid #ddd;
    font-size: 10px;
}

.payslip-explainer-wrapper .pe-income-table td:last-child {
    text-align: right;
    width: 70px;
}

/* Assignment Rates section */
.payslip-explainer-wrapper .pe-assignment-section .pe-section-header-orange {
    text-align: center;
}

.payslip-explainer-wrapper .pe-assignment-table {
    width: 100%;
    border-collapse: collapse;
}

.payslip-explainer-wrapper .pe-assignment-table th {
    background: #f5f5f5;
    padding: 4px 6px;
    font-size: 9px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.payslip-explainer-wrapper .pe-assignment-table th:last-child {
    border-right: none;
}

.payslip-explainer-wrapper .pe-assignment-table td {
    padding: 12px 6px;
    font-size: 10px;
    text-align: center;
    border-right: 1px solid #ddd;
    vertical-align: middle;
}

.payslip-explainer-wrapper .pe-assignment-table td:last-child {
    border-right: none;
}

/* Blue header */
.payslip-explainer-wrapper .pe-blue-header {
    background: linear-gradient(180deg, #1e4a6d 0%, #163a55 100%);
    color: white;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 1px;
    border-top: 1px solid #0d2a3d;
    border-bottom: 1px solid #0d2a3d;
}

/* Employee details */
.payslip-explainer-wrapper .pe-employee-header {
    display: grid;
    grid-template-columns: 2fr 1.3fr 1.3fr 0.9fr 0.9fr 0.7fr;
    background: linear-gradient(180deg, #1e4a6d 0%, #163a55 100%);
    color: white;
    font-size: 9px;
    font-weight: bold;
}

.payslip-explainer-wrapper .pe-employee-header > div {
    padding: 5px 6px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.payslip-explainer-wrapper .pe-employee-header > div:last-child {
    border-right: none;
}

.payslip-explainer-wrapper .pe-employee-data {
    display: grid;
    grid-template-columns: 2fr 1.3fr 1.3fr 0.9fr 0.9fr 0.7fr;
    background: #fff;
    font-size: 10px;
    border-bottom: 1px solid #999;
}

.payslip-explainer-wrapper .pe-employee-data > div {
    padding: 6px;
    text-align: center;
    border-right: 1px solid #ddd;
}

.payslip-explainer-wrapper .pe-employee-data > div:last-child {
    border-right: none;
}

/* Payments and Deductions grid */
.payslip-explainer-wrapper .pe-pay-ded-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid #999;
}

.payslip-explainer-wrapper .pe-payments-section {
    border-right: 1px solid #999;
}

/* Section headers for Payments/Deductions */
.payslip-explainer-wrapper .pe-section-header-payments {
    background: linear-gradient(180deg, #e8792a 0%, #d4691f 100%);
    color: white;
    padding: 6px;
    font-weight: bold;
    font-size: 11px;
    text-align: center;
    letter-spacing: 1px;
}

/* Payment/Deduction tables */
.payslip-explainer-wrapper .pe-pay-table {
    width: 100%;
    border-collapse: collapse;
}

.payslip-explainer-wrapper .pe-pay-table th {
    background: linear-gradient(180deg, #e8792a 0%, #d4691f 100%);
    color: white;
    padding: 4px 6px;
    font-size: 9px;
    font-weight: bold;
    border-bottom: 1px solid #c55a1a;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.payslip-explainer-wrapper .pe-pay-table th:last-child {
    border-right: none;
}

.payslip-explainer-wrapper .pe-pay-table td {
    padding: 4px 6px;
    font-size: 10px;
    border-bottom: 1px solid #eee;
}

.payslip-explainer-wrapper .pe-pay-table .pe-amount {
    text-align: right;
}

.payslip-explainer-wrapper .pe-pay-table .pe-center {
    text-align: center;
}

.payslip-explainer-wrapper .pe-pay-table .pe-text-left {
    text-align: left;
}

.payslip-explainer-wrapper .pe-total-row {
    background: #f8f8f8;
    border-top: 2px solid #999;
}

.payslip-explainer-wrapper .pe-total-row td {
    padding: 6px;
    font-weight: bold;
    border-bottom: none;
}

.payslip-explainer-wrapper .pe-spacer-row td {
    height: 20px;
    border-bottom: 1px solid #eee;
}

/* Bottom three columns */
.payslip-explainer-wrapper .pe-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-bottom: 1px solid #999;
}

.payslip-explainer-wrapper .pe-bottom-col {
    border-right: 1px solid #999;
}

.payslip-explainer-wrapper .pe-bottom-col:last-child {
    border-right: none;
}

.payslip-explainer-wrapper .pe-bottom-table {
    width: 100%;
    border-collapse: collapse;
}

.payslip-explainer-wrapper .pe-bottom-table td {
    padding: 3px 8px;
    font-size: 10px;
    border-bottom: 1px solid #eee;
}

.payslip-explainer-wrapper .pe-bottom-table td:last-child {
    text-align: right;
}

/* Total payment highlight box */
.payslip-explainer-wrapper .pe-total-payment-box {
    background: #f5f5f5;
    border-top: 2px solid #1e4a6d;
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    font-weight: bold;
    font-size: 11px;
}

/* Address and Message */
.payslip-explainer-wrapper .pe-addr-msg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid #999;
}

.payslip-explainer-wrapper .pe-addr-box,
.payslip-explainer-wrapper .pe-msg-box {
    padding: 8px 10px;
}

.payslip-explainer-wrapper .pe-addr-box {
    border-right: 1px solid #999;
}

.payslip-explainer-wrapper .pe-addr-box h4,
.payslip-explainer-wrapper .pe-msg-box h4 {
    font-size: 10px;
    font-weight: bold;
    margin: 0 0 5px 0;
    padding-bottom: 3px;
    border-bottom: 1px solid #ddd;
}

.payslip-explainer-wrapper .pe-addr-box p,
.payslip-explainer-wrapper .pe-msg-box p {
    font-size: 10px;
    line-height: 1.4;
    margin: 0;
}

/* Footers */
.payslip-explainer-wrapper .pe-footer-dark {
    background: #1e4a6d;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 10px;
}

.payslip-explainer-wrapper .pe-footer-orange {
    background: #e8792a;
    color: white;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 8px 15px;
    font-size: 10px;
    font-weight: bold;
}

.payslip-explainer-wrapper .pe-footer-orange span:nth-child(2) {
    text-align: center;
}

.payslip-explainer-wrapper .pe-footer-orange span:nth-child(3) {
    text-align: right;
}

/* Tooltip */
.payslip-explainer-wrapper .pe-tooltip {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.25);
    max-width: 360px;
    z-index: 10000;
    display: none;
    overflow: hidden;
}

.payslip-explainer-wrapper .pe-tooltip.visible {
    display: block;
}

.payslip-explainer-wrapper .pe-tooltip-header {
    background: linear-gradient(135deg, #1e4a6d, #2a5f8a);
    color: white;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 14px;
}

.payslip-explainer-wrapper .pe-tooltip-content {
    padding: 16px 18px;
    font-size: 13px;
    line-height: 1.65;
    color: #333;
}

/* Mobile bottom sheet */
.payslip-explainer-wrapper .pe-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.payslip-explainer-wrapper .pe-mobile-overlay.visible {
    display: flex;
    align-items: flex-end;
}

.payslip-explainer-wrapper .pe-mobile-sheet {
    width: 100%;
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 65vh;
    overflow-y: auto;
}

.payslip-explainer-wrapper .pe-mobile-sheet-header {
    background: linear-gradient(135deg, #1e4a6d, #2a5f8a);
    color: white;
    padding: 18px 20px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.payslip-explainer-wrapper .pe-mobile-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payslip-explainer-wrapper .pe-mobile-sheet-content {
    padding: 20px;
    font-size: 15px;
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 650px) {
    .payslip-explainer-wrapper .pe-top-grid {
        grid-template-columns: 1fr;
    }

    .payslip-explainer-wrapper .pe-company-income {
        border-right: none;
        border-bottom: 1px solid #999;
    }

    .payslip-explainer-wrapper .pe-pay-ded-grid {
        grid-template-columns: 1fr;
    }

    .payslip-explainer-wrapper .pe-payments-section {
        border-right: none;
        border-bottom: 1px solid #999;
    }

    .payslip-explainer-wrapper .pe-bottom-grid {
        grid-template-columns: 1fr;
    }

    .payslip-explainer-wrapper .pe-bottom-col {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .payslip-explainer-wrapper .pe-bottom-col:last-child {
        border-bottom: none;
    }

    .payslip-explainer-wrapper .pe-employee-header,
    .payslip-explainer-wrapper .pe-employee-data {
        grid-template-columns: repeat(3, 1fr);
        font-size: 9px;
    }

    .payslip-explainer-wrapper .pe-addr-msg-grid {
        grid-template-columns: 1fr;
    }

    .payslip-explainer-wrapper .pe-addr-box {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .payslip-explainer-wrapper .pe-footer-orange {
        grid-template-columns: 1fr;
        text-align: center !important;
        gap: 5px;
    }

    .payslip-explainer-wrapper .pe-footer-orange span {
        text-align: center !important;
    }
}

/* =====================================================
   WALKTHROUGH CONTROLS
   ===================================================== */

.payslip-explainer-wrapper .pe-walkthrough-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.payslip-explainer-wrapper .pe-walkthrough-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #e8792a 0%, #d35400 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.4);
}

.payslip-explainer-wrapper .pe-walkthrough-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.5);
}

.payslip-explainer-wrapper .pe-walkthrough-btn.active {
    display: none;
}

.payslip-explainer-wrapper .pe-walkthrough-icon {
    font-size: 14px;
}

/* Navigation controls */
.payslip-explainer-wrapper .pe-walkthrough-nav {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: white;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.payslip-explainer-wrapper .pe-walkthrough-nav.active {
    display: flex;
}

.payslip-explainer-wrapper .pe-nav-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #1e4a6d;
    background: #f0f4f8;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.payslip-explainer-wrapper .pe-nav-btn:hover {
    background: #1e4a6d;
    color: white;
}

.payslip-explainer-wrapper .pe-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.payslip-explainer-wrapper .pe-nav-btn:disabled:hover {
    background: #f0f4f8;
    color: #1e4a6d;
}

.payslip-explainer-wrapper .pe-step-counter {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    min-width: 60px;
    text-align: center;
}

.payslip-explainer-wrapper .pe-exit-btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #c0392b;
    background: #fdeaea;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.payslip-explainer-wrapper .pe-exit-btn:hover {
    background: #c0392b;
    color: white;
}

/* Walkthrough highlight state */
.payslip-explainer-wrapper .pe-hotspot.pe-walkthrough-active {
    background-color: rgba(230, 126, 34, 0.35) !important;
    outline: 3px solid #e67e22;
    outline-offset: -1px;
    animation: pe-pulse-highlight 1.5s ease-in-out infinite;
    position: relative;
    z-index: 100;
}

@keyframes pe-pulse-highlight {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(230, 126, 34, 0.6);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(230, 126, 34, 0);
    }
}

/* Dim non-active hotspots during walkthrough */
.payslip-explainer-wrapper.pe-walkthrough-mode .pe-hotspot:not(.pe-walkthrough-active) {
    opacity: 0.5;
}

.payslip-explainer-wrapper.pe-walkthrough-mode .pe-hotspot:not(.pe-walkthrough-active):hover {
    background-color: transparent !important;
    outline: none;
}

/* =====================================================
   FIREWORKS ANIMATION
   ===================================================== */

.payslip-explainer-wrapper .pe-fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10001;
    overflow: hidden;
    display: none;
}

.payslip-explainer-wrapper .pe-fireworks.active {
    display: block;
}

.payslip-explainer-wrapper .pe-firework {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pe-firework-explode 1.2s ease-out forwards;
}

@keyframes pe-firework-explode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.payslip-explainer-wrapper .pe-firework-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pe-particle-fly 1.5s ease-out forwards;
}

@keyframes pe-particle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Celebration overlay */
.payslip-explainer-wrapper .pe-celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px 60px;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 10002;
    animation: pe-celebration-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

@keyframes pe-celebration-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.payslip-explainer-wrapper .pe-celebration h2 {
    font-size: 28px;
    color: #1e4a6d;
    margin: 0 0 10px 0;
}

.payslip-explainer-wrapper .pe-celebration p {
    font-size: 18px;
    color: #666;
    margin: 0 0 25px 0;
}

.payslip-explainer-wrapper .pe-celebration-amount {
    font-size: 32px;
    font-weight: bold;
    color: #27ae60;
    margin: 0 0 25px 0;
    padding: 15px 25px;
    background: #e8f5e9;
    border-radius: 10px;
    display: inline-block;
}

.payslip-explainer-wrapper .pe-celebration-btn {
    padding: 14px 35px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.payslip-explainer-wrapper .pe-celebration-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

/* Confetti pieces */
.payslip-explainer-wrapper .pe-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: pe-confetti-fall linear forwards;
}

@keyframes pe-confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .payslip-explainer-wrapper .pe-hotspot {
        transition: none;
    }

    .payslip-explainer-wrapper .pe-hotspot.pe-walkthrough-active {
        animation: none;
    }

    .payslip-explainer-wrapper .pe-firework,
    .payslip-explainer-wrapper .pe-firework-particle,
    .payslip-explainer-wrapper .pe-confetti {
        animation: none;
    }
}

/* Print styles - hide interactive elements */
@media print {
    .payslip-explainer-wrapper .pe-tooltip,
    .payslip-explainer-wrapper .pe-mobile-overlay {
        display: none !important;
    }

    .payslip-explainer-wrapper .pe-hotspot:hover {
        background-color: transparent !important;
        outline: none;
    }
}
