/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.4;
    /* Modified: Increased base font size from 16px to 18px for better readability */
    font-size: 18px;
}

/* Container with responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    padding: 12px;
    overflow-y: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Adjust height for standalone view */
@media (min-height: 600px) {
    .container {
        height: 90vh;
    }
}

/* Tooltip for header information */
.tooltip {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    /* Modified: Increased tooltip font size from 14px to 16px */
    font-size: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
    max-width: 300px;
    text-align: center;
}

.container:hover .tooltip {
    opacity: 1;
}

/* Given values section */
.given-section {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.given-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.given-item .label {
    font-weight: 600;
    color: #495057;
    /* Modified: Increased given label font size from 16px to 18px */
    font-size: 18px;
}

.given-item .value {
    font-weight: 700;
    color: #007bff;
    /* Modified: Increased given value font size from 18px to 20px */
    font-size: 20px;
}

/* Controls section */
.controls-section {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-weight: 600;
    color: #495057;
    /* Modified: Increased control label font size from 15px to 17px */
    font-size: 17px;
}

/* Dropdown styling */
.dropdown {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    /* Modified: Increased dropdown font size from 16px to 18px */
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px; /* Touch-friendly height */
}

.dropdown:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.dropdown:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Custom checkbox */
.checkbox-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    cursor: pointer;
    /* Modified: Increased checkbox label font size from 16px to 18px */
    font-size: 18px;
    gap: 8px;
    padding: 8px 0;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-container input:checked + .checkmark {
    background-color: #007bff;
    border-color: #007bff;
}

.checkbox-container input:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Results section */
.results-section {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex: 1;
    overflow-y: auto;
}

.statement-section {
    margin-bottom: 16px;
}

.statement-section:last-child {
    margin-bottom: 0;
}

.statement-title {
    /* Modified: Increased statement title font size from 18px to 20px */
    font-size: 20px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #007bff;
}

.subsection {
    margin-left: 12px;
}

.subsection-title {
    /* Modified: Increased subsection title font size from 16px to 18px */
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.line-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f4;
    gap: 8px;
}

.line-item.indent {
    margin-left: 16px;
}

.line-item.total-line {
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    /* Modified: Removed font-weight: 700 to unbold net trade receivables */
    margin-top: 4px;
}

.item-label {
    flex: 1;
    /* Modified: Increased item label font size from 15px to 17px */
    font-size: 17px;
}

.item-value {
    font-weight: 600;
    color: #007bff;
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
    /* Modified: Increased item value font size from 16px to 18px */
    font-size: 18px;
}

/* Modified: Updated working styles to display inline with labels */
.working {
    /* Modified: Increased working font size from 13px to 15px */
    font-size: 15px;
    color: #6c757d;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.3s;
    /* Modified: Removed max-width and text-align to allow inline display */
}

.working.show {
    opacity: 1;
}

/* Negative values styling */
.negative {
    color: #dc3545 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    
    .controls-section {
        grid-template-columns: 1fr;
    }
    
    .given-section {
        flex-direction: column;
        gap: 4px;
    }
    
    .line-item {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .working {
        /* Modified: Allow workings to wrap on mobile */
        flex-basis: auto;
    }
}

/* Touch targets for mobile */
@media (pointer: coarse) {
    .dropdown, .checkbox-container {
        min-height: 48px;
    }
    
    .checkmark {
        width: 24px;
        height: 24px;
    }
}

/* Animation for value changes */
.value-change {
    animation: highlightChange 0.5s ease-in-out;
}

@keyframes highlightChange {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}