
.profitloss-container {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(10, 25, 41, 0.12);
    overflow: hidden;
    animation: profitloss-fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 2rem auto;
    max-width: 1600px;
}

@keyframes profitloss-fadeIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.profitloss-header {
    background: linear-gradient(135deg, #0a1929 0%, #1e3a5f 50%, #2c5f8d 100%);
    color: white;
    padding: 3.5rem 3rem 3rem;
    position: relative;
    overflow: hidden;
}

.profitloss-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    /*width: 600px;*/
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.profitloss-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    /*width: 400px;*/
    height: 400px;
    background: radial-gradient(circle, rgba(82, 183, 136, 0.15) 0%, transparent 60%);
    border-radius: 50%;
}

.profitloss-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    letter-spacing: -0.03em;
    position: relative;
    z-index: 1;
}

.profitloss-subtitle {
    font-size: 1.15rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.profitloss-period {
    margin-top: 0.6rem;
    font-size: 1rem;
    opacity: 0.85;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profitloss-period::before {
    content: '';
    width: 4px;
    height: 4px;
    background: #52b788;
    border-radius: 50%;
}

.profitloss-print-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profitloss-print-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

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

.profitloss-print-btn svg {
    flex-shrink: 0;
}

/* Date Filter Bar Styles */
.profitloss-filter-bar {
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    border-bottom: 2px solid #e2e8f0;
    padding: 2rem 3rem;
}

.profitloss-filter-container {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.profitloss-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profitloss-filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e3a5f;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profitloss-date-input {
    padding: 0.75rem 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1a202c;
    background: white;
    transition: all 0.3s ease;
    min-width: 180px;
}

.profitloss-date-input:focus {
    outline: none;
    border-color: #2c5f8d;
    box-shadow: 0 0 0 3px rgba(44, 95, 141, 0.1);
}

.profitloss-date-input:hover {
    border-color: #94a3b8;
}

.profitloss-run-btn {
    background: linear-gradient(135deg, #2c5f8d 0%, #1e3a5f 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(44, 95, 141, 0.3);
    height: 44px;
}

.profitloss-run-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e3a5f 0%, #0a1929 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(44, 95, 141, 0.4);
}

.profitloss-run-btn:active:not(:disabled) {
    transform: translateY(0);
}

.profitloss-run-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profitloss-run-btn svg {
    flex-shrink: 0;
}

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

.profitloss-spinner {
    animation: profitloss-spin 1s linear infinite;
}

.profitloss-table-container {
    padding: 0;
    overflow-x: auto;
}

.profitloss-table-wrapper {
    /*min-width: 100%;*/
    padding: 2.5rem 3rem;
}

.profitloss-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.profitloss-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.profitloss-table thead tr:first-child th {
    padding: 1.2rem 1rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1e3a5f;
    border-bottom: 1px solid #2c5f8d;
}

.profitloss-table thead tr:first-child th:first-child {
    text-align: left;
    /*background: linear-gradient(to right, #0a1929, #1e3a5f);*/
    color: #1e3a5f;
    /*min-width: 200px;*/
}

.profitloss-month-header {
    /*background: linear-gradient(to bottom, #e0f2fe, #bae6fd) !important;*/
    color: #1e3a5f !important;
}

.profitloss-total-header {
    background: linear-gradient(to bottom, #fef3c7, #fde68a) !important;
    color: #92400e !important;
}

.profitloss-ytd-header {
    background: linear-gradient(to bottom, #d1fae5, #a7f3d0) !important;
    color: #065f46 !important;
}

.profitloss-table tbody tr {
    transition: all 0.3s ease;
}

.profitloss-table tbody tr:hover:not(.profitloss-section-header):not(.profitloss-subtotal):not(.profitloss-net-profit) {
    background: linear-gradient(to right, rgba(42, 90, 184, 0.02), transparent);
    transform: translateX(4px);
}

.profitloss-table tbody td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s ease;
}

.profitloss-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
}

.profitloss-section-header {
    animation: profitloss-slideIn 0.5s ease;
}

@keyframes profitloss-slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.profitloss-section-header td {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #0a1929;
    padding-top: 2.5rem;
    padding-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: none;
    background: white;
}

.profitloss-section-header:first-child td {
    padding-top: 0.8rem;
}

.profitloss-line-item td:first-child {
    padding-left: 2.5rem;
    color: #1a202c;
    font-weight: 400;
}

.profitloss-subtotal {
    position: relative;
}

.profitloss-subtotal td {
    font-weight: 700;
    background: linear-gradient(to right, rgba(30, 58, 95, 0.04) 0%, transparent 100%);
    border-top: 2px solid #2c5f8d;
    border-bottom: 2px solid #2c5f8d;
    padding: 1.3rem 1rem;
}

.profitloss-subtotal td:first-child {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: #1e3a5f;
    background: linear-gradient(to right, rgba(30, 58, 95, 0.04), transparent);
}

.profitloss-gross-profit td {
    background: linear-gradient(to right, rgba(82, 183, 136, 0.08) 0%, transparent 100%);
    border-color: #4a90b8;
}

.profitloss-gross-profit td:first-child {
    background: linear-gradient(to right, rgba(82, 183, 136, 0.08), transparent);
}

.profitloss-operating-income td {
    background: linear-gradient(to right, rgba(74, 144, 184, 0.08) 0%, transparent 100%);
    border-color: #4a90b8;
}

.profitloss-operating-income td:first-child {
    background: linear-gradient(to right, rgba(74, 144, 184, 0.08), transparent);
}

.profitloss-net-profit td {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    /*background: linear-gradient(135deg, #0a1929 0%, #1e3a5f 100%);*/
    /*color: white;*/
    border-top: 2px solid #0a1929;
    border-bottom: 2px solid #0a1929;
    padding: 1.8rem 1rem;
}

.profitloss-net-profit td:first-child {
    /*background: linear-gradient(135deg, #0a1929 0%, #1e3a5f 100%);*/
}

.profitloss-month-col {
    background: rgba(224, 242, 254, 0.3);
}

.profitloss-total-col {
    background: rgba(254, 243, 199, 0.3);
    font-weight: 600;
}

.profitloss-ytd-col {
    background: rgba(209, 250, 229, 0.3);
    font-weight: 600;
}

.profitloss-line-item:nth-child(even) td {
    background: rgba(248, 250, 252, 0.5);
}

.profitloss-line-item:nth-child(even) td:first-child {
    background: rgba(248, 250, 252, 0.5);
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .profitloss-container,
    .profitloss-container * {
        visibility: visible;
    }
    
    .profitloss-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        animation: none;
    }

    .profitloss-print-btn,
    .profitloss-filter-bar {
        display: none !important;
    }

    .profitloss-header {
        background: #0a1929 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 2rem !important;
        page-break-after: avoid;
    }

    .profitloss-header::before,
    .profitloss-header::after {
        display: none;
    }

    .profitloss-header h1 {
        font-size: 2rem !important;
    }

    .profitloss-table-wrapper {
        padding: 1.5rem 1rem !important;
    }

    .profitloss-table {
        page-break-inside: auto;
    }

    .profitloss-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .profitloss-table thead {
        display: table-header-group;
    }

    .profitloss-section-header {
        page-break-after: avoid;
    }

    .profitloss-subtotal {
        page-break-before: avoid;
        page-break-after: avoid;
    }

    .profitloss-net-profit {
        page-break-before: avoid;
    }

    .profitloss-table tbody tr {
        animation: none !important;
    }

    .profitloss-table tbody tr:hover {
        background: none !important;
        transform: none !important;
    }

    /* Ensure colors print correctly */
    .profitloss-table thead tr:first-child th {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .profitloss-month-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .profitloss-total-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .profitloss-ytd-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .profitloss-subtotal td,
    .profitloss-gross-profit td,
    .profitloss-operating-income td,
    .profitloss-net-profit td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .profitloss-month-col,
    .profitloss-total-col,
    .profitloss-ytd-col {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    @page {
        size: landscape;
        margin: 1cm;
    }
}

@media (max-width: 1200px) {
    .profitloss-header h1 {
        font-size: 2.2rem;
    }

    .profitloss-filter-bar {
        padding: 1.5rem;
    }

    .profitloss-table-wrapper {
        padding: 2rem 1.5rem;
    }

    .profitloss-table tbody td, .profitloss-table thead th {
        padding: 0.8rem 0.6rem;
        font-size: 0.85rem;
    }

    .profitloss-print-btn {
        top: 1.5rem;
        right: 1.5rem;
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .profitloss-header {
        padding: 2rem 1.5rem;
    }

    .profitloss-header h1 {
        font-size: 1.8rem;
    }

    .profitloss-filter-bar {
        padding: 1.5rem 1rem;
    }

    .profitloss-filter-container {
        flex-direction: column;
        align-items: stretch;
    }

    .profitloss-date-input,
    .profitloss-run-btn {
        width: 100%;
    }

    .profitloss-table-wrapper {
        padding: 1.5rem 1rem;
    }

    .profitloss-table {
        font-size: 0.8rem;
    }

    .profitloss-line-item td:first-child {
        padding-left: 1.5rem;
    }

    .profitloss-print-btn {
        position: static;
        margin-top: 1rem;
        width: 100%;
        justify-content: center;
    }
}