/* Passenger Car Equivalent (PCE) Calculator Styles */
/* Preserved exactly from original HTML */

.pce-calculator-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    max-width: 1600px;
    margin: 0 auto;
}

.pce-calculator-wrapper {
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 1;
}

@media (min-width: 1024px) {
    .pce-calculator-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }
}

/* Input Panel */
.pce-input-panel {
    background-color: #E0E0E0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex: 1;
    min-width: 300px;
}

.pce-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 8px;
    border-bottom: 2px solid #4A90E2;
}

.pce-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: #222222;
}

/* Colorblind Toggle */
.pce-colorblind-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pce-toggle-label {
    font-size: 14px;
    color: #222222;
}

.pce-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.pce-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.pce-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.pce-toggle-switch input:checked + .pce-toggle-slider {
    background-color: #4A90E2;
}

.pce-toggle-switch input:checked + .pce-toggle-slider:before {
    transform: translateX(26px);
}

/* Validation Error Container */
.pce-validation-container {
    background-color: #ffebee;
    border: 1px solid #d32f2f;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: none;
}

.pce-validation-container.visible {
    display: block;
}

.pce-validation-title {
    font-size: 16px;
    font-weight: 600;
    color: #d32f2f;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pce-validation-list {
    list-style-type: none;
    padding-left: 8px;
}

.pce-validation-item {
    font-size: 14px;
    color: #222222;
    margin-bottom: 4px;
    padding-left: 8px;
    position: relative;
}

.pce-validation-item::before {
    content: "•";
    color: #d32f2f;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.pce-validation-item a {
    color: #d32f2f;
    text-decoration: underline;
    cursor: pointer;
}

.pce-validation-item a:hover {
    text-decoration: none;
}

/* Error state for inputs */
.pce-form-input.error,
.pce-form-select.error {
    border-color: #d32f2f;
    background-color: #fff5f5;
}

/* Form Grid */
.pce-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 768px) {
    .pce-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.pce-form-group.full-width {
    grid-column: 1 / -1;
}

.pce-form-group.primary {
    border-left: 3px solid #4A90E2;
    padding-left: 8px;
}

.pce-form-group.secondary {
    border-left: 3px solid #FF9500;
    padding-left: 8px;
}

.pce-form-label {
    font-size: 14px;
    font-weight: 500;
    color: #222222;
}

.pce-form-hint {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.pce-form-input, .pce-form-select {
    padding: 10px 12px;
    border: 2px solid #333333;
    border-radius: 4px;
    background-color: #f9f9f9;
    font-size: 16px;
    color: #222222;
    height: 44px;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 44px;
    line-height: 1.5;
}

/* Ensure dropdown text is fully visible */
.pce-form-select {
    padding: 10px 12px;
    height: 44px;
    line-height: 1.5;
    appearance: menulist;
}

/* Ensure input field text is fully visible */
.pce-form-input {
    padding: 10px 12px;
    height: 44px;
    line-height: 1.5;
}

.pce-form-input:focus, .pce-form-select:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.pce-form-input::placeholder {
    color: #999;
}

.pce-range-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pce-range-value {
    min-width: 60px;
    font-size: 14px;
    font-weight: 500;
    color: #4A90E2;
}

/* Buttons */
.pce-button-container {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pce-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.pce-button-primary {
    background-color: #4A90E2;
    color: white;
}

.pce-button-primary:hover {
    background-color: #3a80d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pce-button-secondary {
    background-color: #E0E0E0;
    color: #222222;
    border: 2px solid #333333;
}

.pce-button-secondary:hover {
    background-color: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pce-button-export {
    background-color: #388e3c;
    color: white;
}

.pce-button-export:hover {
    background-color: #2e7d32;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Results Panel */
.pce-results-panel {
    background-color: #E0E0E0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex: 1.5;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pce-results-header {
    font-size: 18px;
    font-weight: 600;
    color: #222222;
    padding-bottom: 8px;
    border-bottom: 2px solid #4A90E2;
}

/* SVG Visualization */
.pce-svg-container {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.pce-svg-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #222222;
}

/* Results Display */
.pce-results-summary {
    margin-bottom: 24px;
}

.pce-results-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.pce-result-item {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid #4A90E2;
}

.pce-result-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.pce-result-value {
    font-size: 20px;
    font-weight: 700;
    color: #222222;
}

.pce-result-unit {
    font-size: 14px;
    color: #666;
    margin-left: 4px;
}

/* Step-by-step */
.pce-step-container {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.pce-step-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #222222;
}

.pce-step-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pce-step-item {
    display: flex;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #ddd;
}

.pce-step-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pce-step-number {
    background-color: #4A90E2;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.pce-step-content {
    flex: 1;
}

.pce-step-description {
    font-size: 14px;
    color: #222222;
    margin-bottom: 4px;
}

.pce-step-calculation {
    font-family: 'Courier New', monospace;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    margin-top: 4px;
    overflow-x: auto;
}

/* Analysis Sections */
.pce-analysis-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pce-analysis-section {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
}

.pce-analysis-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #222222;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pce-analysis-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.pce-analysis-icon.comments {
    background-color: #1976d2;
    color: white;
}

.pce-analysis-icon.interpretation {
    background-color: #4A90E2;
    color: white;
}

.pce-analysis-icon.recommendations {
    background-color: #388e3c;
    color: white;
}

.pce-analysis-content {
    font-size: 14px;
    color: #222222;
    line-height: 1.7;
}

/* Flags */
.pce-flags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    margin-bottom: 24px;
}

.pce-flag {
    background-color: #d32f2f;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Footer */
.pce-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: #666;
    margin-top: 32px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pce-trademark {
    font-weight: 600;
    color: #222222;
}

.pce-disclaimer {
    font-style: italic;
    max-width: 600px;
    text-align: center;
    flex: 1;
}

/* Mobile responsiveness */
@media (max-width: 767px) {
    .pce-calculator-wrapper {
        flex-direction: column;
    }
    
    .pce-form-grid {
        grid-template-columns: 1fr;
    }
    
    .pce-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .pce-button-container {
        flex-direction: column;
    }
    
    .pce-button {
        width: 100%;
    }
    
    .pce-footer {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

/* Colorblind mode */
.pce-colorblind-mode {
    --accent-primary: #1f77b4;
    --accent-secondary: #ff7f0e;
    --warning-color: #2ca02c;
    --success-color: #9467bd;
    --info-color: #8c564b;
    --error-color: #2ca02c;
}

.pce-colorblind-mode .pce-button-primary {
    position: relative;
    overflow: hidden;
}

.pce-colorblind-mode .pce-button-primary::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
}

.pce-colorblind-mode .pce-button-secondary {
    border-style: dashed;
}

.pce-colorblind-mode .pce-button-export {
    position: relative;
    overflow: hidden;
}

.pce-colorblind-mode .pce-button-export::before {
    content: "↓";
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    font-weight: bold;
}

.pce-colorblind-mode .pce-form-group.primary {
    border-left-style: solid;
    border-left-width: 4px;
}

.pce-colorblind-mode .pce-form-group.secondary {
    border-left-style: dotted;
    border-left-width: 4px;
}

.pce-colorblind-mode .pce-result-item {
    border-left-style: double;
    border-left-width: 6px;
}

/* Print styles */
@media print {
    .pce-button-container,
    .pce-colorblind-toggle-container,
    .pce-toggle-label {
        display: none;
    }
    
    .pce-input-panel,
    .pce-results-panel {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Ensure no overlapping */
.pce-form-group {
    margin-bottom: 0;
}

.pce-form-input, .pce-form-select {
    width: 100%;
    box-sizing: border-box;
}

/* Ensure ample gap between last input field and buttons */
.pce-form-grid {
    margin-bottom: 0;
}

.pce-button-container {
    margin-top: 32px;
}

/* Colorblind mode container alignment fix */
.pce-panel-header {
    align-items: center;
}

.pce-panel-title {
    flex-shrink: 0;
}

.pce-colorblind-toggle-container {
    flex-shrink: 0;
}

/* Ensure SVG has proper dimensions */
.pce-svg-container svg {
    width: 100%;
    height: 300px;
    display: block;
}