/* ==============================================
   ALTERNATOR & ENGINE SIZING TOOL - TOOL-SPECIFIC STYLES
   Requires: ../css/shared.css and ../css/components.css
   ============================================== */

/* ==============================================
   LAYOUT - TOOL SPECIFIC
   ============================================== */

.data-source-indicator {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: var(--color-accent-teal);
    color: white;
    border-radius: var(--border-radius-sm);
    font-size: 0.95em;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ==============================================
   STEPS & SECTIONS
   ============================================== */

.step {
    background: var(--color-bg-blue-light);
    padding: 15px 15px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 10px;
    border-left: 3px solid var(--color-primary-medium);
}

.step-title {
    color: var(--color-accent-orange);
    font-size: 1.35em;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==============================================
   FORMS - TOOL OVERRIDES
   ============================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 0;
}

.unit {
    color: var(--color-neutral-gray);
    font-size: 0.93em;
}

/* ==============================================
   BUTTONS - TOOL SPECIFIC
   ============================================== */

.btn-back2 {
    position: fixed;
    bottom: 30px;
    left: 180px;
    background: linear-gradient(120deg, var(--color-primary-medium) 60%, var(--color-primary-dark) 100%);
    color: var(--color-bg-white);
    border: none;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    box-shadow: 0 6px 20px #1a2732;
    z-index: 1001;
    transition: all 0.3s;
    width: auto;
}

.btn-back2:hover {
    background: linear-gradient(135deg, var(--color-accent-orange) 0%, var(--color-accent-yellow) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px #1a2732;
}

.clear-all-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(120deg, var(--color-primary-medium) 60%, var(--color-primary-dark) 100%);
    color: var(--color-bg-white);
    border: none;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    box-shadow: 0 6px 20px #1a2732;
    z-index: 1000;
    transition: all 0.3s;
}

.clear-all-btn:hover {
    background: linear-gradient(135deg, var(--color-accent-orange) 0%, #ffcb4f 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px #1a2732;
}

/* Fixed bottom button group (Print + Clear All) */
.fixed-bottom-btns {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 1000;
}

.fixed-bottom-btns .clear-all-btn {
    position: static;
}

.fixed-print-btn {
    background: linear-gradient(120deg, var(--color-primary-medium) 60%, var(--color-primary-dark) 100%);
    color: var(--color-bg-white);
    border: none;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    box-shadow: 0 6px 20px #1a2732;
    transition: all 0.3s;
}

.fixed-print-btn:hover {
    background: linear-gradient(135deg, var(--color-accent-orange) 0%, #ffcb4f 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px #1a2732;
}

.fixed-scroll-btn {
    background: linear-gradient(120deg, var(--color-accent-teal) 60%, #35c4b5 100%);
    color: var(--color-bg-white);
    border: none;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    box-shadow: 0 6px 20px #1a2732;
    transition: all 0.3s;
}

.fixed-scroll-btn:hover {
    background: linear-gradient(135deg, var(--color-accent-orange) 0%, #ffcb4f 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px #1a2732;
}

/* ==============================================
   PDF UPLOAD INTERFACE
   ============================================== */

.pdf-upload-container {
    margin-top: 25px;
    padding: 20px;
    background: var(--color-bg-white);
    border-radius: var(--border-radius-md);
    border: 2px dashed var(--color-neutral-gray);
}

.upload-zone {
    text-align: center;
    padding: 40px 20px;
    border: 3px dashed var(--color-accent-teal);
    border-radius: var(--border-radius-md);
    background: var(--color-bg-blue-light);
    transition: all 0.3s;
    cursor: pointer;
}

.upload-zone:hover {
    background: var(--color-bg-green-light);
    border-color: var(--color-primary-dark);
    transform: translateY(-2px);
}

.upload-zone.dragover {
    background: var(--color-bg-green-light);
    border-color: var(--color-primary-dark);
    box-shadow: var(--shadow-lg);
}

.upload-zone h3 {
    color: var(--color-primary-dark);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.upload-zone p {
    color: var(--color-medium-text);
    margin-bottom: 20px;
    font-size: 1.05em;
}

.uploaded-files-list {
    margin-top: 20px;
    padding: 15px;
    background: var(--color-bg-gray-light);
    border-radius: var(--border-radius-md);
}

.uploaded-files-list h4 {
    color: var(--color-primary-dark);
    margin-bottom: 15px;
    font-size: 1.15em;
}

#filesContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--color-bg-white);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--color-accent-teal);
    box-shadow: var(--shadow-sm);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--color-dark-text);
    margin-bottom: 3px;
}

.file-size {
    font-size: 0.85em;
    color: var(--color-neutral-gray);
}

.file-remove {
    background: var(--color-accent-orange);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.file-remove:hover {
    background: #e85a2e;
    transform: scale(1.05);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-accent-teal) 0%, var(--color-teal-dark) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#processingStatus {
    margin-top: 20px;
}

#statusMessages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.status-message {
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-message.success {
    background: var(--color-bg-green-light);
    border-left: 4px solid var(--color-accent-teal);
    color: var(--color-teal-dark);
}

.status-message.error {
    background: #fff0f0;
    border-left: 4px solid var(--color-accent-orange);
    color: #c53030;
}

.status-message.info {
    background: var(--color-bg-blue-light);
    border-left: 4px solid var(--color-primary-medium);
    color: var(--color-primary-dark);
}

/* ==============================================
   RESULTS & BOXES
   ============================================== */

.results-box {
    background: var(--color-bg-gray-light);
    padding: 15px;
    border-radius: var(--border-radius-md);
    margin-top: 15px;
    border-left: 4px solid var(--color-blue-deep);
    color: var(--color-dark-text);
}

.suggested-alternator {
    background: var(--color-bg-white);
    padding: 15px;
    border-radius: 11px;
    margin: 18px 0;
    box-shadow: var(--shadow-sm);
}

.alt-title {
    font-size: 1.17em;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 11px;
}

.alt-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid rgba(137, 150, 160, 0.3);
}

.spec-label {
    font-weight: 600;
    color: var(--color-medium-text);
}

.spec-value {
    color: var(--color-accent-teal);
    font-weight: 700;
}

.engine-results {
    background: var(--color-bg-green-light);
    border-left: 4px solid var(--color-accent-teal);
    padding: 21px;
    border-radius: var(--border-radius-md);
    margin-top: 19px;
    color: var(--color-teal-dark);
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 73, 144, 0.09);
    font-size: 1.1em;
}

.result-row:last-child {
    border-bottom: none;
    font-size: 1.29em;
    font-weight: 700;
    color: var(--color-blue-deep);
}

.warning {
    background: var(--color-bg-yellow-light);
    border-left: 4px solid var(--color-accent-yellow);
    padding: 13px;
    border-radius: var(--border-radius-sm);
    margin-top: 13px;
    color: var(--color-medium-text);
}

.conversion-box {
    background: var(--color-bg-blue-light);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    text-align: center;
    color: var(--color-primary-medium);
    font-weight: 600;
}

/* ==============================================
   CHARTS
   ============================================== */

.efficiency-chart {
    margin: 18px 0;
    padding: 19px;
    background: var(--color-bg-light);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(137, 150, 160, 0.3);
    box-shadow: 0 2px 10px rgba(0, 73, 144, 0.05);
}

.efficiency-chart canvas {
    cursor: zoom-in;
    transition: opacity .15s;
}
.efficiency-chart canvas:hover { opacity: .88; }

.chart-zoom-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 24px;
    animation: czo-in .15s ease;
}
@keyframes czo-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.chart-zoom-overlay img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 24px 64px rgba(0,0,0,.55);
}

.chart-title {
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--color-dark-text);
    font-size: 1.4em;
}

canvas {
    max-width: 100%;
    width: 100%;
    height: auto;
}

/* ==============================================
   TABLES
   ============================================== */

table {
    font-size: 0.95em;
    width: 100%;
    border-collapse: collapse;
}

table th {
    font-weight: 600;
    text-align: left;
    padding: 10px;
}

table td {
    text-align: center;
    padding: 10px;
}

/* ==============================================
   RESPONSIVE - TOOL SPECIFIC
   ============================================== */

@media (max-width: 800px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.85em;
    }

    table th, table td {
        padding: 8px 4px !important;
    }
}

@media (max-width: 1200px) {
    #step1e > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

.waveform-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 30px;
}

.waveform-grid h4 {
    font-size: 1.5em;
}

@media (max-width: 1400px) {
    .waveform-grid {
        grid-template-columns: 1fr;
    }
}

/* ==============================================
   ADDITIONAL STYLES
   ============================================== */

/* Modal per password */
.password-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.password-modal.active {
    display: flex;
}

.password-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.password-content h2 {
    color: #004990;
    margin-bottom: 10px;
    font-size: 1.8em;
}

.password-content p {
    color: #394a58;
    margin-bottom: 25px;
}

.password-input-container {
    position: relative;
    margin-bottom: 20px;
}

.password-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #8996a0;
    border-radius: 8px;
    font-size: 1.1em;
    transition: border-color 0.3s;
}

.password-input:focus {
    outline: none;
    border-color: #004990;
}

.password-error {
    color: #ff6d42;
    font-size: 0.9em;
    margin-top: 8px;
    display: none;
}

.password-error.show {
    display: block;
}

.password-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.password-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.password-btn-submit {
    background: linear-gradient(120deg, #005a8b, #004990);
    color: white;
}

.password-btn-submit:hover {
    background: linear-gradient(120deg, #35c4b5, #006d68);
    transform: translateY(-2px);
}

.password-btn-cancel {
    background: #e7f3ff;
    color: #004990;
}

.password-btn-cancel:hover {
    background: #dae3ea;
}

/* Access Choice Buttons */
.access-choice-btn {
    flex: 1;
    padding: 30px 20px;
    border: 3px solid transparent;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
    color: #394a58;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

.access-choice-public:hover {
    border-color: #35c4b5;
    background: #e7fff8;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(53, 196, 181, 0.3);
}

.access-choice-restricted:hover {
    border-color: #005a8b;
    background: #e7f3ff;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 90, 139, 0.3);
}


/* Stili per la stampa */
@media print {
    .back-to-top,
    .help-nav,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        padding: 0;
    }

    .help-chapter {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
    }

    .chapter-title {
        page-break-after: avoid;
    }

    .help-container {
        max-width: 100%;
    }

    /* Mantieni i colori per i box informativi */
    .info-box,
    .warning-box,
    .success-box,
    .example-box {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Responsive per mobile */
@media (max-width: 768px) {
    /* Step title */
    .step-title {
        font-size: 1em;
        letter-spacing: 0.5px;
    }

    /* Suggested alternator specs — single column */
    .alt-specs {
        grid-template-columns: 1fr;
    }

    /* Result rows — stack label above value */
    .result-row {
        flex-direction: column;
        gap: 2px;
        font-size: 0.95em;
    }

    .result-row span:last-child {
        font-weight: 700;
        color: var(--color-accent-teal);
    }

    /* Engine results panel */
    .engine-results {
        padding: 14px;
    }

    /* Applied load form */
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Efficiency chart — scrollable on mobile */
    .efficiency-chart {
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Suggested alternator box */
    .suggested-alternator {
        padding: 12px;
    }

    /* Mode selector cards */
    .mode-selector {
        flex-direction: column;
    }

    .mode-card {
        min-width: 100%;
    }

    /* Parallel / unbalanced result tables — horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* DDS modal */
    .dds-modal-content {
        width: 94vw;
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .step-title {
        font-size: 0.88em;
    }

    .result-row {
        font-size: 0.9em;
    }

    .result-row:last-child {
        font-size: 1em;
    }

    input, select {
        font-size: 1em; /* prevent iOS auto-zoom */
    }

    .content {
        padding: 10px;
    }
}

/* ==============================================
   INPUT VALIDATION STYLES
   ============================================== */

/* Input field with validation error */
input.validation-error {
    border: 2px solid var(--color-accent-orange) !important;
    background-color: #fff5f5 !important;
    animation: shake 0.3s ease;
}

input.validation-error:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 109, 66, 0.2);
}

/* Validation error message */
.validation-error-message {
    color: var(--color-accent-orange);
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: validationFadeIn 0.3s ease;
}

.validation-error-message::before {
    content: "\26A0";
    font-size: 1.1em;
}

/* Shake animation for error */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Validation fade in animation */
@keyframes validationFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Valid input indicator */
input.validation-success {
    border-color: var(--color-accent-teal) !important;
}

/* Disabled button when validation fails */
button:disabled.validation-blocked {
    background: var(--color-neutral-gray) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

button:disabled.validation-blocked:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ==============================================
   HELP DESK STYLES
   ============================================== */

.help-container {
    max-width: 100%;
    margin: 0 auto;
}

.help-nav {
    background: var(--color-bg-white);
    padding: 25px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--color-accent-teal);
    position: sticky;
    top: 20px;
    z-index: 100;
}

.help-nav h2 {
    color: var(--color-primary-dark);
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--color-accent-teal);
    padding-bottom: 10px;
}

.help-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.help-nav-item {
    padding: 12px 18px;
    background: linear-gradient(120deg, var(--color-bg-blue-light) 0%, var(--color-bg-light) 100%);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    font-weight: 600;
    color: var(--color-primary-dark);
    text-align: center;
}

.help-nav-item:hover {
    border-color: var(--color-primary-dark);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(120deg, var(--color-primary-dark) 0%, var(--color-primary-medium) 100%);
    color: var(--color-bg-white);
}

.help-chapter {
    background: var(--color-bg-white);
    padding: 35px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    scroll-margin-top: 100px;
    display: none;
}

.help-chapter.active {
    display: block !important;
}

/* #intro visibility is controlled by .active class, same as all other chapters */

/* === PF = 0 WARNING === */
.pf-zero-warning {
    margin-top: 6px;
    padding: 8px 12px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 0.85em;
    font-weight: 500;
    display: none;
}

/* === PUBLIC MODE: RESTRICTED SECTION PLACEHOLDER === */
.restricted-placeholder {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    margin: 12px 0;
    background: #f8f9fa;
    border: 1.5px dashed #c0c8d0;
    border-radius: 8px;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.5;
}

.restricted-placeholder .restricted-icon {
    font-size: 1.3em;
    flex-shrink: 0;
}

.restricted-placeholder strong {
    color: #004990;
}

/* ── Print chapter selection modal ── */
#printChaptersModal { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:3000; align-items:center; justify-content:center; }
#printChaptersModal.open { display:flex; }
.pcm-box { background:#fff; border-radius:12px; max-width:500px; width:95%; max-height:82vh; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,.4); }
.pcm-header { background:linear-gradient(90deg,#002f5c,#004a90); color:#fff; padding:16px 20px; border-radius:12px 12px 0 0; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.pcm-header h3 { margin:0; font-size:1em; font-weight:700; }
.pcm-header button { background:none; border:none; color:#fff; font-size:1.5em; cursor:pointer; line-height:1; opacity:.8; }
.pcm-header button:hover { opacity:1; }
.pcm-toolbar { padding:10px 20px 6px; display:flex; gap:8px; border-bottom:1px solid #e0e7ef; flex-shrink:0; }
.pcm-toolbar button { font-size:.8em; padding:4px 12px; border-radius:6px; border:1px solid #c0cdd8; background:#f5f8fc; cursor:pointer; font-weight:600; color:#334a5e; transition:background .2s; }
.pcm-toolbar button:hover { background:#e0eaf5; }
.pcm-list { overflow-y:auto; padding:12px 20px; flex:1; }
.pcm-item { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:7px; cursor:pointer; margin-bottom:2px; font-size:.95em; color:#2c3e50; transition:background .15s; }
.pcm-item:hover { background:#f0f4fa; }
.pcm-item input[type="checkbox"] { width:15px; height:15px; accent-color:#004a90; cursor:pointer; flex-shrink:0; }
.pcm-footer { padding:14px 20px; border-top:1px solid #e0e7ef; display:flex; gap:10px; justify-content:flex-end; flex-shrink:0; }
.pcm-btn-print { background:linear-gradient(135deg,#004a90,#006d68); color:#fff; border:none; padding:10px 24px; border-radius:8px; font-size:.95em; font-weight:700; cursor:pointer; transition:opacity .2s; }
.pcm-btn-print:hover { opacity:.88; }
.pcm-btn-cancel { background:#f0f4fa; color:#334a5e; border:1px solid #c0cdd8; padding:10px 20px; border-radius:8px; font-size:.95em; font-weight:600; cursor:pointer; transition:background .2s; }
.pcm-btn-cancel:hover { background:#e0eaf5; }

/* Help print header/footer — hidden on screen, shown only in @media print */
#helpPrintHeader,
#helpPrintFooter {
    display: none;
}

.help-nav-item.active {
    background: linear-gradient(120deg, var(--color-accent-orange), var(--color-accent-yellow));
    color: var(--color-bg-white);
    border-color: var(--color-accent-orange);
}

.chapter-title {
    color: var(--color-accent-orange);
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 3px solid var(--color-accent-orange);
    padding-bottom: 15px;
}

.chapter-section {
    margin-bottom: 35px;
}

.section-title {
    color: var(--color-primary-dark);
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
}

.section-title:hover {
    color: var(--color-primary-medium);
}

.section-title::before {
    content: '\25B8';
    color: var(--color-accent-teal);
    font-size: 1.3em;
    transition: transform 0.3s ease;
    display: inline-block;
    transform: rotate(90deg);
}

.section-title.collapsed::before {
    transform: rotate(0deg);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    max-height: 5000px;
    opacity: 1;
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.subsection-title {
    color: var(--color-primary-medium);
    font-size: 1.2em;
    font-weight: 600;
    margin: 20px 0 12px 0;
    padding-left: 15px;
    border-left: 3px solid var(--color-accent-teal);
}

.help-text {
    line-height: 1.8;
    color: var(--color-medium-text);
    margin-bottom: 15px;
    font-size: 1.05em;
}

.help-list {
    margin-left: 30px;
    margin-bottom: 20px;
}

.help-list li {
    margin-bottom: 12px;
    line-height: 1.7;
    color: var(--color-medium-text);
    position: relative;
    padding-left: 10px;
}

.help-list li::marker {
    color: var(--color-accent-teal);
    font-weight: bold;
}

.info-box {
    background: var(--color-bg-blue-light);
    border-left: 4px solid var(--color-primary-dark);
    padding: 20px;
    border-radius: var(--border-radius-md);
    margin: 20px 0;
}

.info-box-title {
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: 1.15em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box-title::before {
    content: '\2139';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: var(--color-primary-dark);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
}

/* Help desk warning-box override (yellow, not red like terms) */
.help-chapter .warning-box {
    background: var(--color-bg-yellow-light);
    border-left: 4px solid var(--color-accent-yellow);
    padding: 20px;
    border-radius: var(--border-radius-md);
    margin: 20px 0;
    color: inherit;
}

.warning-box-title {
    color: var(--color-accent-orange);
    font-weight: 700;
    font-size: 1.15em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warning-box-title::before {
    content: '\26A0';
    font-size: 1.3em;
}

.success-box {
    background: var(--color-bg-green-light);
    border-left: 4px solid var(--color-accent-teal);
    padding: 20px;
    border-radius: var(--border-radius-md);
    margin: 20px 0;
}

.success-box-title {
    color: var(--color-teal-dark);
    font-weight: 700;
    font-size: 1.15em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-box-title::before {
    content: '\2713';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: var(--color-accent-teal);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
}

.formula-box {
    background: var(--color-bg-white);
    border: 2px solid var(--color-neutral-gray);
    padding: 20px;
    border-radius: var(--border-radius-md);
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    text-align: center;
    font-size: 1.1em;
    color: var(--color-dark-text);
}

.example-box {
    background: var(--color-bg-gray-light);
    border-left: 4px solid var(--color-blue-deep);
    padding: 20px;
    border-radius: var(--border-radius-md);
    margin: 20px 0;
}

.example-title {
    color: var(--color-blue-deep);
    font-weight: 700;
    font-size: 1.15em;
    margin-bottom: 12px;
}

.param-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--color-bg-white);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.param-table th {
    background: var(--color-primary-dark);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.param-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(137, 150, 160, 0.2);
    text-align: left;
}

.param-table tr:nth-child(even) {
    background: var(--color-bg-light);
}

.param-table tr:hover {
    background: var(--color-bg-blue-light);
}

.param-name {
    font-weight: 600;
    color: var(--color-primary-dark);
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, var(--color-accent-teal), var(--color-teal-dark));
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 1000;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, var(--color-accent-orange), var(--color-accent-yellow));
}

code {
    background: var(--color-bg-light);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--color-primary-dark);
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
}

strong {
    color: var(--color-primary-dark);
}

/* ===== HELP DESK PRINT STYLES ===== */
@media print {
    .help-nav,
    .back-to-top,
    .request-help-btn,
    .btn-back,
    footer {
        display: none !important;
    }

    .help-container {
        max-width: 100%;
        margin: 0;
    }

    .header,
    .logo-container {
        display: none !important;
    }

    /* Print cover header — same style as print-preview .header */
    #helpPrintHeader {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        background: #004990 !important;
        padding: 15px 20px;
        margin-bottom: 15px;
        border-radius: 0;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    #helpPrintHeader h1 {
        color: white !important;
        margin: 0 0 5px 0;
        font-size: 20px;
        font-weight: 700;
        border: none;
        padding: 0;
    }

    #helpPrintHeader .help-print-stepname {
        color: rgba(255, 255, 255, 0.85) !important;
        font-size: 13px;
        margin-bottom: 3px;
    }

    #helpPrintHeader .help-print-chapter {
        color: white !important;
        font-size: 15px;
        font-weight: bold;
    }

    #helpPrintHeader .help-print-date {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.9) !important;
        margin-top: 5px;
    }

    #helpPrintHeader img {
        max-width: 100px;
        height: auto;
        filter: brightness(0) invert(1);
    }

    /* Hide all chapters in print; only the active one is printed */
    .help-chapter {
        display: none !important;
    }

    .help-chapter.active {
        display: block !important;
        background: white;
        padding: 25px;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
    }

    /* Each section (after the first) starts on a new page */
    .chapter-section + .chapter-section {
        break-before: page !important;
        page-break-before: always !important;
    }

    /* Never cut content blocks in the middle */
    .section-content,
    .info-box, .warning-box, .success-box, .example-box, .formula-box,
    .param-table, .help-list, .help-text, .chapter-section {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* Keep titles attached to their content */
    .section-title, .subsection-title, .chapter-title {
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    /* Hide the screen footer div — @page margin boxes handle print footer */
    #helpPrintFooter {
        display: none !important;
    }

    .chapter-title { page-break-after: avoid; margin-top: 0; }
    .chapter-section { page-break-inside: avoid; margin-bottom: 20px; }
    .section-title { page-break-after: avoid; }
    .subsection-title { page-break-after: avoid; }

    .info-box, .warning-box, .success-box, .example-box, .formula-box {
        page-break-inside: avoid;
        margin: 15px 0;
        padding: 15px;
    }

    .param-table { page-break-inside: avoid; margin: 15px 0; }
    .help-list { page-break-inside: avoid; }
    .help-text { page-break-inside: avoid; }

    * { box-shadow: none !important; border-radius: 0 !important; }

    @page {
        margin: 8mm 8mm 22mm 8mm;
        size: auto;

        @bottom-left {
            content: "Alternator & Engine Sizing Tool  |  Mecc Alte S.p.A.\A The information and results generated by this selection tool are provided for guidance purposes only.\A Final specification must be confirmed through verification and validation based on the specific application requirements.";
            font-family: Arial, sans-serif;
            font-size: 6.5pt;
            color: #6c757d;
            white-space: pre-line;
            border-top: 2px solid #35c4b5;
            padding-top: 4px;
            vertical-align: top;
            width: 80%;
        }

        @bottom-right {
            content: "Page " counter(page) " of " counter(pages);
            font-family: Arial, sans-serif;
            font-size: 7pt;
            font-weight: bold;
            color: #004990;
            border-top: 2px solid #35c4b5;
            padding-top: 4px;
            vertical-align: top;
        }
    }
}

/* Request Help Button Styles */
.request-help-btn {
    position: fixed;
    top: 30px;
    right: 30px;
    background: linear-gradient(135deg, #35c4b5 0%, #2a9d8f 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.request-help-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #2a9d8f 0%, #238276 100%);
}

/* Help Modal Styles */
.help-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: helpModalFadeIn 0.3s ease;
}

.help-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal-content {
    background-color: #fff;
    margin: auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: helpModalSlideIn 0.3s ease;
}

.help-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #8996a0;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.help-modal-close:hover {
    color: #004990;
}

@keyframes helpModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes helpModalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==============================================
   SHORTCIRCUIT TOOL STYLES
   ============================================== */

.shortcircuit-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    margin-top: 20px;
}

.shortcircuit-sidebar {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f8ff 100%);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #35c4b5;
    height: fit-content;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.shortcircuit-param-group {
    margin-bottom: 15px;
}

.shortcircuit-param-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #394a58;
    font-size: 0.95em;
}

.shortcircuit-param-group input,
.shortcircuit-param-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #8996a0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: white;
}

.shortcircuit-param-group input:focus,
.shortcircuit-param-group select:focus {
    outline: none;
    border-color: #004990;
    box-shadow: 0 0 0 3px rgba(0, 73, 144, 0.08);
}

.shortcircuit-main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.shortcircuit-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #35c4b5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.shortcircuit-result-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #004990;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.shortcircuit-result-label {
    font-size: 0.85em;
    color: #394a58;
    margin-bottom: 5px;
    font-weight: 600;
}

.shortcircuit-result-value {
    font-size: 1.3em;
    color: #004990;
    font-weight: bold;
}

.shortcircuit-unit {
    font-size: 0.85em;
    color: #8996a0;
    margin-left: 3px;
}

.shortcircuit-category {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e0e7f0;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.shortcircuit-category-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #004990;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #35c4b5;
}

.shortcircuit-chart-container {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #35c4b5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    height: 600px;
    position: relative;
}

.shortcircuit-table-container {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #35c4b5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.shortcircuit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.shortcircuit-table th {
    background: linear-gradient(135deg, #004990 0%, #005a8b 100%);
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 600;
}

.shortcircuit-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #dae3ea;
}

.shortcircuit-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.shortcircuit-table tr:hover {
    background: #e7f3ff;
}

.shortcircuit-table tr.highlighted {
    background: #ffeb99 !important;
    box-shadow: 0 0 0 2px #ffcb4f inset;
}

.shortcircuit-section-title {
    color: #004990;
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid #35c4b5;
}

@media (max-width: 1200px) {
    .shortcircuit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .shortcircuit-results-grid {
        grid-template-columns: 1fr;
    }

    .shortcircuit-table {
        font-size: 0.85em;
    }

    .shortcircuit-table th,
    .shortcircuit-table td {
        padding: 8px 4px;
    }
}

/* ==============================================
   DDS BUTTON & MODAL
   ============================================== */

.dds-button {
    position: fixed;
    top: 30px;
    right: 140px;
    background: var(--color-bg-white);
    border: 3px solid var(--color-accent-teal);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(53, 196, 181, 0.4);
    z-index: 999;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
}

.dds-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(53, 196, 181, 0.6);
    border-color: var(--color-primary-dark);
}

.dds-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dds-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.dds-modal-content {
    position: relative;
    background: white;
    margin: 5% auto;
    padding: 40px;
    width: 90%;
    max-width: 700px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    animation: ddsSlideDown 0.3s ease-out;
}

.dds-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    color: var(--color-neutral-gray);
    cursor: pointer;
    transition: color 0.2s;
}

.dds-modal-close:hover {
    color: var(--color-accent-orange);
}

.dds-modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--color-accent-teal);
}

.dds-modal-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.dds-modal-title {
    color: var(--color-primary-dark);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.dds-modal-description {
    color: var(--color-medium-text);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 25px;
}

.dds-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary-medium) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 73, 144, 0.3);
}

.dds-modal-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 73, 144, 0.4);
}

@keyframes ddsSlideDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}
