/* ==========================================================================
   AI Hardware Advisor
   Portal-native styling built on the existing dark-theme.css design tokens,
   matching the AI System Optimizer's restrained look.
   ========================================================================== */

.aha {
    max-width: 960px;
    margin: 0 auto;
}

.aha-head {
    margin-bottom: 1.25rem;
}

.aha-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    letter-spacing: -0.01em;
}

.aha-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    max-width: 70ch;
}

.aha-muted {
    color: var(--text-muted);
}

/* ---- disclaimer ---------------------------------------------------------- */

.aha-disclaimer-banner {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem 1rem 1rem;
    border-radius: 0.55rem;
    border: 1px solid rgba(90, 140, 185, 0.45);
    border-left: 4px solid rgba(110, 165, 210, 0.85);
    background: linear-gradient(135deg, rgba(35, 58, 78, 0.55) 0%, rgba(28, 38, 52, 0.78) 100%);
    box-shadow: var(--shadow-sm);
}

.aha-disclaimer-banner-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.65rem;
}

.aha-disclaimer-banner-title i {
    color: rgba(130, 185, 230, 0.95);
    margin-right: 0.45rem;
}

.aha-disclaimer-banner-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.55;
}

.aha-disclaimer-banner-list li {
    margin-bottom: 0.45rem;
}

.aha-disclaimer-banner-list li:last-child {
    margin-bottom: 0;
}

.aha-disclaimer-banner-list strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---- section headings ---------------------------------------------------- */

.aha-picker-head {
    margin-bottom: 1.1rem;
}

.aha-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.3rem;
}

.aha-section-title i {
    color: var(--si-yellow);
    margin-right: 0.5rem;
}

.aha-section-sub {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 0;
}

/* ---- persistent category bar --------------------------------------------- */

.aha-catbar-wrap {
    margin-bottom: 1.25rem;
}

.aha-catbar-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.aha-catbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.aha-cat-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.aha-cat-tab:hover {
    color: var(--text-primary);
    border-color: rgba(225, 184, 79, 0.5);
    transform: translateY(-1px);
}

.aha-cat-tab-icon {
    font-size: 1rem;
    opacity: 0.85;
    color: var(--text-muted);
}

.aha-cat-tab.active {
    background: rgba(225, 184, 79, 0.14);
    border-color: var(--si-yellow);
    color: var(--si-yellow-light);
    box-shadow: 0 0 0 1px rgba(225, 184, 79, 0.35);
}

.aha-cat-tab.active .aha-cat-tab-icon {
    color: var(--si-yellow);
    opacity: 1;
}

/* Small dot indicating this category already has saved results */
.aha-cat-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success-green);
    flex-shrink: 0;
}

/* ---- empty state (no category chosen yet) -------------------------------- */

.aha-empty {
    text-align: center;
    padding: 1.5rem 1rem 2rem;
    border: 1px dashed var(--border-color);
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.015);
}

.aha-empty-arrow {
    color: var(--si-yellow);
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
    display: block;
    animation: aha-bob 1.6s ease-in-out infinite;
}

@keyframes aha-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.aha-empty .aha-section-title {
    justify-content: center;
}

/* ---- cards --------------------------------------------------------------- */

.aha-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    margin-bottom: 1.1rem;
    overflow: hidden;
}

.aha-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.aha-card-head-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.aha-card-head-title i {
    color: var(--si-yellow);
    margin-right: 0.5rem;
}

.aha-card-head-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.aha-card-body {
    padding: 1.1rem;
}

/* Category header card */
.aha-card-cat {
    background: linear-gradient(160deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--si-yellow-dark);
    box-shadow: var(--shadow-sm);
}

.aha-cat-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
}

.aha-cat-head-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    background: rgba(225, 184, 79, 0.12);
    border: 1px solid rgba(225, 184, 79, 0.35);
    color: var(--si-yellow);
    font-size: 1.4rem;
}

.aha-cat-head-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.2rem;
}

.aha-cat-head-blurb {
    font-size: 0.86rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    max-width: 75ch;
}

/* Preferences card */
.aha-card-preferences {
    background: linear-gradient(165deg, var(--bg-secondary) 0%, rgba(26, 26, 26, 0.85) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(150, 168, 198, 0.65);
    box-shadow: var(--shadow-sm);
}

.aha-card-preferences .aha-card-head {
    background: rgba(0, 0, 0, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.aha-card-preferences .aha-card-body {
    background: transparent;
}

/* ---- questionnaire form -------------------------------------------------- */

.aha-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.4rem;
}

.aha-field {
    display: flex;
    flex-direction: column;
}

.aha-field:has(.aha-textarea) {
    grid-column: 1 / -1;
}

.aha-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.aha-req {
    color: var(--warning-orange);
    margin-left: 0.2rem;
}

.aha-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
    line-height: 1.35;
}

.aha-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.45rem;
    color: var(--text-primary);
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aha-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23d0d0d0'%3E%3Cpath d='M4.5 6l3.5 3.5L11.5 6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    background-size: 1rem;
    padding-right: 2rem;
    cursor: pointer;
}

.aha-input:focus {
    outline: none;
    border-color: var(--si-yellow);
    box-shadow: 0 0 0 2px rgba(225, 184, 79, 0.2);
}

.aha-textarea {
    resize: vertical;
    min-height: 2.6rem;
    font-family: inherit;
}

.aha-form-error {
    margin-top: 0.9rem;
    color: var(--warning-orange);
    font-size: 0.85rem;
}

.aha-form-error i {
    margin-right: 0.35rem;
}

.aha-actions {
    margin-top: 1.25rem;
    display: flex;
    justify-content: flex-end;
}

.aha-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    padding: 0.6rem 1.15rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.aha-btn-primary {
    background: var(--si-yellow);
    color: #1a1a1a;
}

.aha-btn-primary:hover:not(:disabled) {
    background: var(--si-yellow-light);
}

.aha-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ---- generating state ---------------------------------------------------- */

.aha-generating-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.aha-generating .spinner-border {
    color: var(--si-yellow);
    flex-shrink: 0;
}

.aha-generating-title {
    font-weight: 600;
    color: var(--text-primary);
}

.aha-generating-sub {
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.aha-progress {
    margin-top: 1rem;
    height: 8px;
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}

.aha-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--si-yellow-dark), var(--si-yellow));
    transition: width 0.5s linear;
}

.aha-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.aha-progress-meta #ahaProgressPct {
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---- results ------------------------------------------------------------- */

.aha-results-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.75rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.aha-results-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.aha-results-title i {
    color: var(--si-yellow);
    margin-right: 0.5rem;
}

.aha-results-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.aha-summary .aha-summary-text {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

.aha-advice {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
}

.aha-advice-label {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.aha-advice-label i {
    color: var(--si-yellow);
    margin-right: 0.35rem;
}

/* ---- product cards ------------------------------------------------------- */

.aha-product-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.aha-product {
    display: flex;
    gap: 1.15rem;
    align-items: flex-start;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--si-yellow-dark);
    border-radius: 0.6rem;
    background: var(--bg-card);
    padding: 1.1rem 1.15rem;
    box-shadow: var(--shadow-sm);
}

.aha-product-main {
    flex: 1;
    min-width: 0;
}

/* Fixed thumbnail column — always present so every row aligns. */
.aha-product-thumb {
    position: relative;
    flex-shrink: 0;
    width: 128px;
    height: 128px;
    display: block;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #fff;
}

.aha-product-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #fff;
}

/* Placeholder sits behind the image; revealed when no/broken image. */
.aha-product-thumb-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: var(--text-muted);
    font-size: 2.4rem;
    opacity: 0.55;
}

.aha-product-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.aha-product-rank {
    flex-shrink: 0;
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(225, 184, 79, 0.14);
    border: 1px solid rgba(225, 184, 79, 0.4);
    color: var(--si-yellow-light);
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.aha-product-name {
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.aha-product-tier {
    flex-shrink: 0;
}

/* Price + best-for share their own full-width line under the title. */
.aha-product-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.8rem;
    margin-top: 0.5rem;
    padding-left: 2.55rem; /* align under title, past the rank badge */
}

.aha-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--si-yellow-light);
}

.aha-product-bestfor {
    font-size: 0.84rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
}

.aha-product-why {
    margin: 0.75rem 0 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.aha-proscons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.95rem;
}

.aha-proscons-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.aha-pros .aha-proscons-label {
    color: var(--success-green);
}

.aha-pros .aha-proscons-label i {
    margin-right: 0.3rem;
}

.aha-cons .aha-proscons-label {
    color: var(--warning-orange);
}

.aha-cons .aha-proscons-label i {
    margin-right: 0.3rem;
}

.aha-proscons ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.aha-proscons li {
    margin-bottom: 0.3rem;
}

.aha-proscons li:last-child {
    margin-bottom: 0;
}

.aha-product-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 0.9rem;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.aha-find-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    border-radius: 0.45rem;
    border: 1px solid var(--si-yellow-dark);
    background: rgba(225, 184, 79, 0.1);
    color: var(--si-yellow-light);
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.aha-find-btn:hover {
    background: rgba(225, 184, 79, 0.2);
    color: var(--si-yellow-light);
}

.aha-find-note {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* tier badges */
.aha-badge {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 0.3rem;
    padding: 0.1rem 0.5rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.aha-tier-budget {
    color: #8ee8d8;
    border-color: rgba(45, 165, 150, 0.45);
    background: rgba(45, 165, 150, 0.12);
}

.aha-tier-mid {
    color: #9ecfff;
    border-color: rgba(56, 140, 210, 0.45);
    background: rgba(56, 140, 210, 0.12);
}

.aha-tier-premium {
    color: var(--si-yellow-light);
    border-color: rgba(225, 184, 79, 0.4);
    background: rgba(225, 184, 79, 0.1);
}

.aha-tier-enthusiast {
    color: #d4cff0;
    border-color: rgba(130, 120, 165, 0.45);
    background: rgba(130, 120, 165, 0.14);
}

/* notes / warnings */
.aha-bullets {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-secondary);
}

.aha-bullets li {
    margin-bottom: 0.4rem;
    line-height: 1.5;
    font-size: 0.88rem;
}

.aha-bullets li:last-child {
    margin-bottom: 0;
}

.aha-warnings .aha-card-head-title i {
    color: var(--warning-orange);
}

.aha-disclaimer {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin: 1.25rem 0 0.5rem;
    line-height: 1.5;
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
}

/* ---- alerts -------------------------------------------------------------- */

.aha-alert {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1.1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    border: 1px solid var(--border-color);
}

.aha-alert i {
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.aha-alert-error {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.4);
    color: var(--text-secondary);
}

.aha-alert-error i {
    color: #e57373;
}

.aha-loading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
    padding: 1.5rem 0;
}

/* ---- responsive ---------------------------------------------------------- */

@media (max-width: 768px) {
    .aha-form {
        grid-template-columns: 1fr;
    }

    .aha-cat-grid {
        grid-template-columns: 1fr;
    }

    .aha-proscons {
        grid-template-columns: 1fr;
    }

    .aha-product {
        flex-direction: column;
    }

    .aha-product-thumb {
        width: 100%;
        height: 190px;
    }

    .aha-product-meta {
        padding-left: 0;
    }
}
