/* compo.css - Stili aggiuntivi per la Ricerca e Verifica Componenti */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Griglia layout specifica per compo */
.search-box-wrapper {
    display: flex;
    gap: 12px;
    width: 100%;
}

.search-input {
    flex: 1;
    background-color: #0a0a0c;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: monospace;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent-cyan);
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.suggestion-chip {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: monospace;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    -webkit-user-select: none;
    user-select: none;
}

.suggestion-chip:hover, .suggestion-chip.active {
    background-color: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.4);
    color: var(--accent-cyan);
}

.delete-chip-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    transition: all 0.2s;
}

.delete-chip-btn:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

/* Visualizzazione del Package dei Componenti (TO-92, TO-220, DIP-8) */
.package-visualizer {
    background: radial-gradient(circle, #1e2235 0%, #0d0e12 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px 24px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    position: relative;
    overflow: visible;
}

/* DIP-8 (e.g. NE555, UA741) */
.dip8-package {
    width: 120px;
    height: 180px;
    background-color: #1e1e1e;
    border: 2px solid #333;
    border-radius: 6px;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 0;
}

.dip8-notch {
    width: 30px;
    height: 15px;
    background-color: var(--bg-color);
    border: 2px solid #333;
    border-top: none;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
}

.dip8-dot {
    width: 8px;
    height: 8px;
    background-color: #555;
    border-radius: 50%;
    position: absolute;
    top: 15px;
    left: 15px;
}

.dip8-pin-left, .dip8-pin-right {
    position: absolute;
    width: 20px;
    height: 12px;
    background-color: #a0aec0;
    border-radius: 2px;
}

/* Posizioni Pin DIP-8 */
.pin-l-1 { top: 25px; left: -20px; }
.pin-l-2 { top: 65px; left: -20px; }
.pin-l-3 { top: 105px; left: -20px; }
.pin-l-4 { top: 145px; left: -20px; }

.pin-r-8 { top: 25px; right: -20px; }
.pin-r-7 { top: 65px; right: -20px; }
.pin-r-6 { top: 105px; right: -20px; }
.pin-r-5 { top: 145px; right: -20px; }

.pin-label-outer {
    position: absolute;
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-family: monospace;
    font-weight: bold;
    white-space: nowrap;
}

.pin-lbl-l-1 { top: 22px; left: -75px; text-align: right; width: 50px; }
.pin-lbl-l-2 { top: 62px; left: -75px; text-align: right; width: 50px; }
.pin-lbl-l-3 { top: 102px; left: -75px; text-align: right; width: 50px; }
.pin-lbl-l-4 { top: 142px; left: -75px; text-align: right; width: 50px; }

.pin-lbl-r-8 { top: 22px; right: -75px; text-align: left; width: 50px; }
.pin-lbl-r-7 { top: 62px; right: -75px; text-align: left; width: 50px; }
.pin-lbl-r-6 { top: 102px; right: -75px; text-align: left; width: 50px; }
.pin-lbl-r-5 { top: 142px; right: -75px; text-align: left; width: 50px; }

/* TO-92 Package (Bipolar Transistors BC547) */
.to92-package {
    width: 100px;
    height: 100px;
    background-color: #222;
    border: 2px solid #333;
    border-top-left-radius: 50px;
    border-top-right-radius: 50px;
    position: relative;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

.to92-flat {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15px;
    background-color: #111;
    border-top: 1px solid #444;
}

.to92-leads {
    display: flex;
    justify-content: space-between;
    width: 70px;
    position: absolute;
    bottom: -50px;
    left: 15px;
}

.to92-lead {
    width: 4px;
    height: 50px;
    background-color: #a0aec0;
    position: relative;
}

.lead-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--accent-cyan);
}

/* TO-220 Package (MOSFETs e Regolatori) */
.to220-package {
    width: 120px;
    height: 140px;
    background-color: #222;
    border: 2px solid #333;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.to220-tab {
    width: 120px;
    height: 45px;
    background-color: #718096;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    position: absolute;
    top: -45px;
    left: -2px;
    border: 2px solid #4a5568;
    display: flex;
    justify-content: center;
    align-items: center;
}

.to220-hole {
    width: 24px;
    height: 24px;
    background-color: var(--bg-color);
    border-radius: 50%;
    border: 2px solid #4a5568;
}

.to220-metal-stripe {
    width: 100%;
    height: 20px;
    background-color: #111;
    margin-top: 20px;
}

.to220-leads {
    display: flex;
    justify-content: space-between;
    width: 90px;
    position: absolute;
    bottom: -60px;
    left: 15px;
}

.to220-lead {
    width: 6px;
    height: 60px;
    background-color: #cbd5e1;
    position: relative;
}

/* Diodo raddrizzatore assiale */
.axial-package {
    width: 180px;
    height: 36px;
    background-color: #1a1a1a;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    border: 1px solid #333;
}

.axial-stripe {
    position: absolute;
    width: 16px;
    height: 100%;
    background-color: #cbd5e1; /* Silver band */
    top: 0;
    right: 25px;
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
}

.axial-leads {
    position: absolute;
    width: 240px;
    height: 4px;
    background-color: #a0aec0;
    top: 16px;
    left: -30px;
    z-index: -1;
}

.axial-lead-label {
    position: absolute;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--text-secondary);
}

.axial-lbl-anode {
    top: 45px;
    left: -15px;
}

.axial-lbl-cathode {
    top: 45px;
    right: -15px;
}

/* Equivalenti ed extra info */
.eq-table {
    width: 100%;
    border-collapse: collapse;
    font-family: monospace;
    font-size: 0.8rem;
    margin-top: 6px;
}

.eq-table th {
    text-align: left;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.eq-table td {
    padding: 8px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    color: var(--text-primary);
}

.eq-badge {
    background-color: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* Download datasheet card */
.datasheet-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-weight: 600;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
}

.datasheet-btn:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.mouser-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.mouser-btn:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.delete-btn-custom {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(220, 38, 38, 0.18) 100%) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    color: #f87171 !important;
    font-weight: 600;
    cursor: pointer;
    text-shadow: none;
}

.delete-btn-custom:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.35) 100%) !important;
    border-color: #ef4444 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
}

/* Verifica Guasti */
.test-box {
    background-color: rgba(0,0,0,0.15);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.test-step-title {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    font-weight: bold;
    text-transform: uppercase;
    font-family: monospace;
}

.test-instructions {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.diagnostic-result {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 8px;
}

.diagnostic-result.good {
    background-color: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.diagnostic-result.bad {
    background-color: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.diagnostic-result-title {
    font-weight: bold;
    font-family: monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.diagnostic-result-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.3;
}

/* Stili Dropdown per Risultati di Ricerca */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: #12141a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    font-family: monospace;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s, color 0.2s;
}

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

.search-result-item:hover {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
}

.search-result-category {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

/* TO-3 Package (transistor di potenza in metallo come BU208A o 2N3055) */
.to3-package-container {
    position: relative;
    width: 200px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.to3-package {
    width: 140px;
    height: 100px;
    background-color: #4a5568; /* Metal color */
    border: 3px solid #2d3748;
    border-radius: 50% / 50%; /* Oval */
    position: relative;
    box-shadow: inset 0 0 15px rgba(255,255,255,0.2), 0 10px 20px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.to3-base {
    position: absolute;
    width: 180px;
    height: 110px;
    background-color: #2d3748;
    border: 2px solid #1a202c;
    border-radius: 50% / 50%;
    z-index: -1;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.to3-screw {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #718096;
    border: 1px solid #1a202c;
    border-radius: 50%;
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.3);
}
.to3-screw::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 2px;
    background: #1a202c;
    top: 4px;
    left: 1px;
    transform: rotate(45deg);
}
.to3-screw-left {
    left: 10px;
    top: calc(50% - 6px);
}
.to3-screw-right {
    right: 10px;
    top: calc(50% - 6px);
}

.to3-pins-container {
    display: flex;
    justify-content: space-around;
    width: 80px;
    position: absolute;
    top: calc(50% - 13px);
}

.to3-pin-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.to3-pin {
    width: 12px;
    height: 12px;
    background-color: #cbd5e1;
    border: 1px solid #1a202c;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.to3-pin-insulator {
    position: absolute;
    width: 22px;
    height: 22px;
    background-color: #0f1115;
    border: 1px solid #2d3748;
    border-radius: 50%;
    z-index: 1;
    top: -5px;
    left: -5px;
}

.to3-pin-label {
    position: absolute;
    bottom: -22px;
    font-size: 0.7rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--accent-cyan);
    white-space: nowrap;
}

/* Stili per il Modal della API Key */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.75);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #0f1115;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 15px 35px rgba(0,0,0,0.8), 0 0 20px rgba(6, 182, 212, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-backdrop.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255,255,255,0.01);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-close-btn:hover {
    color: var(--accent-cyan);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(255,255,255,0.01);
}

/* Stili per i pulsanti di ricerca */
.btn-search-action {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: monospace;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    -webkit-user-select: none;
    user-select: none;
}

.btn-search-action:hover {
    background-color: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-search-ai-gradient {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(14, 116, 144, 0.2) 100%);
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: var(--accent-cyan);
}

.btn-search-ai-gradient:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.35) 0%, rgba(14, 116, 144, 0.35) 100%);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

/* Info badge API Key */
.api-key-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    font-family: monospace;
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.api-key-badge.missing {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.2);
}

.api-key-badge:hover {
    background-color: rgba(255,255,255,0.05);
}
