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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #000; /* Changed to black for all text */
    line-height: 1.4;
    overflow-x: hidden;
}

/* Main container with responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

/* Responsive height for new tab */
@media (min-height: 600px) {
    .container {
        height: 90vh;
        padding: 20px;
        gap: 15px;
    }
}

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

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

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

.given-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
}

/* Increased font size for given values labels */
.given-item .label {
    font-size: 15px; /* Increased from 13px */
    color: #000; /* Changed to black */
    margin-bottom: 4px;
}

/* Increased font size for given values */
.given-item .value {
    font-weight: bold;
    font-size: 18px; /* Increased from 16px */
    color: #000; /* Changed to black */
}

/* Controls section */
.controls {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 140px;
    flex: 1;
}

/* Increased font size for control labels */
.control-group label {
    font-size: 16px; /* Increased from 14px */
    font-weight: 600;
    color: #000; /* Changed to black */
}

/* Increased font size for dropdown options */
.dropdown {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 17px; /* Increased from 15px */
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 36px;
    color: #000; /* Changed to black */
}

.dropdown:hover {
    border-color: #3498db;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.2);
}

.dropdown:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Increased font size for checkbox label */
.checkbox-group label {
    font-size: 16px; /* Increased from 14px */
    cursor: pointer;
    user-select: none;
    color: #000; /* Changed to black */
}

/* Results section */
.results {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.statement-section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3498db;
}

/* Increased font size for section titles */
.section-title {
    font-size: 18px; /* Increased from 16px */
    font-weight: bold;
    color: #000; /* Changed to black */
    margin-bottom: 10px;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 2px solid #ecf0f1;
}

.subsection {
    margin-top: 10px;
}

/* Increased font size for subsection titles */
.subsection-title {
    font-size: 16px; /* Increased from 14px */
    font-weight: 600;
    color: #000; /* Changed to black */
    margin-bottom: 8px;
    text-decoration: underline;
}

.line-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f8f9fa;
    min-height: 32px;
}

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

.net-line {
    border-top: 2px solid #34495e;
    font-weight: normal; /* Removed bold from net trade receivables */
    background: #f8f9fa;
    margin-top: 5px;
    padding: 8px 0;
}

/* Increased font size for item labels */
.item-label {
    font-size: 16px; /* Increased from 14px */
    color: #000; /* Changed to black */
    flex: 1;
    padding-right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-label-text {
    /* Text portion of the label */
}

/* Increased font size for item values */
.item-value {
    font-size: 16px; /* Increased from 14px */
    font-weight: 600;
    color: #000; /* Changed to black */
    text-align: right;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Increased font size for working calculations */
.working {
    font-size: 14px; /* Increased from 12px */
    color: #000; /* Changed to black */
    font-style: italic;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #e9ecef;
    white-space: nowrap;
}

/* Special styling for reversal - only this should remain with special color */
.reversal {
    font-weight: bold !important;
    font-style: italic !important;
    color: #e74c3c !important; /* Only reversal keeps the red color */
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 10px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .control-group {
        min-width: auto;
    }
    
    .checkbox-group {
        margin-left: 0;
        justify-content: center;
    }
    
    .given-values {
        flex-direction: column;
        gap: 8px;
    }
    
    .given-item {
        flex-direction: row;
        justify-content: space-between;
        min-width: auto;
    }
    
    .line-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .item-value {
        align-self: flex-end;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
}

/* Touch targets for mobile - Increased font size for mobile */
@media (pointer: coarse) {
    .dropdown {
        min-height: 44px;
        font-size: 18px; /* Increased from 16px - Prevents zoom on iOS */
    }
    
    .checkbox {
        width: 24px;
        height: 24px;
    }
}

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

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