/* --- Global Container & Typography --- */
#aipc-container {
    width: 100%;
    max-width: 1000px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
    line-height: 1.6;
}

/* --- Reusable Card Style --- */
.aipc-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

/* --- Landing Page & Disclaimer --- */
#aipc-intro {
    text-align: center;
}

.aipc-header h2 {
    margin-top: 0;
    color: #1d2327;
    font-size: 24px;
}

.aipc-disclaimer-box {
    background: #fff8e1;
    border-left: 5px solid #ffb300;
    padding: 20px;
    border-radius: 6px;
    margin-top: 30px;
    text-align: left;
}

.disclaimer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #856404;
}

/* --- Mode Selection --- */
.mode-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.mode-btn {
    padding: 25px;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mode-btn:hover {
    border-color: #007cba;
    background: #f0f9ff;
    transform: translateY(-2px);
}

.mode-icon { font-size: 32px; margin-bottom: 10px; }
.mode-label { font-weight: bold; font-size: 18px; display: block; }
.mode-btn small { color: #777; margin-top: 5px; }

/* --- Chat Interface Area --- */
#aipc-chat-area {
    display: flex;
    flex-direction: column;
    height: 700px;
    padding: 0; /* Override card padding for internal layout */
    overflow: hidden;
}

#aipc-chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fafafa;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
}
.status-indicator.online { background: #4caf50; box-shadow: 0 0 5px #4caf50; }

#aipc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- Chat Bubbles --- */
.message {
    padding: 12px 18px;
    border-radius: 15px;
    max-width: 80%;
    font-size: 15px;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    background: #007cba;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message.ai {
    background: #f1f3f5;
    color: #2c3338;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

/* --- Progress & Loading States --- */
#aipc-status-container {
    padding: 10px 20px;
    background: #fff;
}

.progress-wrapper {
    background: #eee;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

#aipc-bar {
    background: #007cba;
    width: 0%;
    height: 100%;
    transition: width 0.4s ease;
}

#aipc-status-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    text-align: center;
}

#aipc-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    color: #007cba;
    padding: 10px;
}

/* --- Product Recommendation Layout --- */
.product-result-list {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-top: 10px;
    overflow: hidden;
}

.product-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #eee;
    gap: 15px;
    align-items: center;
}

.product-item:last-child { border-bottom: none; }

.product-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.product-info h5 { margin: 0; font-size: 15px; }
.product-info .price { color: #2e7d32; font-weight: bold; }

/* --- Winner / Best Match Card --- */
.winner-card {
    border: 2px solid #ffb300;
    background: #fffdeb;
    padding: 20px;
    border-radius: 10px;
    position: relative;
    margin-top: 20px;
}

.badge {
    position: absolute;
    top: -12px;
    left: 15px;
    background: #ffb300;
    color: #000;
    padding: 2px 12px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 20px;
    text-transform: uppercase;
}

/* --- Input Area --- */
.aipc-input-area {
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
}

#user-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
}

#user-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.aipc-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.btn-primary { background: #007cba; color: #fff; }
.btn-primary:hover { background: #006799; }

#voice-visualizer .dashicons-microphone {
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- AIPC Product Display Layout --- */
.aipc-product-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 15px 0;
}

.aipc-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.aipc-card.top-choice {
    border: 2px solid #ff4500; /* Rebel Orange/Red */
    background: #fffcfb;
}

.expert-tag {
    position: absolute;
    top: -10px;
    right: 10px;
    background: #ff4500;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.card-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-thumb {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
    background: #f9f9f9;
}

.card-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-weight: 700;
    font-size: 14px;
    color: #222;
    margin-bottom: 4px;
    line-height: 1.2;
}

.card-price {
    color: #ff4500;
    font-weight: 800;
    font-size: 16px;
}

/* --- Custom Build List (1-8) --- */
.custom-build-container {
    background: #1a1a1a;
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
}

.custom-build-container h3 {
    color: #ff4500;
    font-size: 18px;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.build-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.build-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #2a2a2a;
}

.build-list li:last-child {
    border-bottom: none;
}

.mini-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    background: #fff;
}

/* --- Buttons & Actions --- */
.aipc-add-cart-btn {
    background: #ff4500;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.aipc-add-cart-btn:hover {
    background: #e63e00;
}

.workflow-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-continue {
    background: #28a745 !important;
    flex-grow: 2;
}

.btn-restart {
    background: #6c757d !important;
    flex-grow: 1;
}

/* Typing Indicator Animation */
.typing {
    font-style: italic;
    color: #888;
    padding: 10px;
}

.aipc-thinking-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    color: #555;
}
.aipc-thinking-text { font-size: 14px; font-weight: 600; }
.aipc-dots { display: flex; gap: 4px; }
.aipc-dots span {
    width: 8px;
    height: 8px;
    background-color: #007cba;
    border-radius: 50%;
    display: inline-block;
    animation: aipc-jump 1.4s infinite ease-in-out both;
}
.aipc-dots span:nth-child(1) { animation-delay: -0.32s; }
.aipc-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes aipc-jump {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
}

/* --- Grouped Category Results (PC Build / Single Category) --- */
.aipc-grouped-results {
    margin: 15px 0;
}

.grouped-header {
    background: #1a1a1a;
    color: #fff;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.grouped-header h3 {
    margin: 0 0 5px 0;
    color: #ff4500;
    font-size: 18px;
}

.grouped-header p {
    margin: 0;
    font-size: 13px;
    color: #aaa;
}

.aipc-category-section {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
}

.category-header:hover {
    background: #eef2f7;
}

.category-icon {
    font-size: 20px;
    width: 30px;
    text-align: center;
}

.category-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #222;
    flex-grow: 1;
}

.category-count {
    font-size: 12px;
    color: #666;
    background: #e8e8e8;
    padding: 2px 8px;
    border-radius: 10px;
}

.category-toggle {
    font-size: 12px;
    color: #999;
    transition: transform 0.2s;
}

.category-toggle.collapsed {
    transform: rotate(-90deg);
}

.category-items {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Platform Choice UI --- */
.aipc-platform-choice {
    text-align: center;
    padding: 15px;
}

.aipc-platform-choice h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #222;
}

.aipc-platform-choice p {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: #666;
}

.platform-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.platform-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.platform-btn:hover {
    border-color: #ff4500;
    background: #fff8f5;
    transform: translateY(-2px);
}

.platform-btn strong {
    font-size: 16px;
    color: #222;
}

.platform-btn small {
    font-size: 11px;
    color: #777;
    margin-top: 4px;
}

.platform-btn-either {
    border-color: #ccc;
}

.platform-btn-either:hover {
    border-color: #007cba;
    background: #f0f9ff;
}

/* --- Responsive Adjustments --- */
@media screen and (max-width: 768px) {
    #aipc-container {
        margin: 10px;
        width: auto;
    }

    .aipc-card {
        padding: 15px; /* Smaller padding on mobile */
    }

    /* Adjust Chat Area Height for Mobile */
    #aipc-chat-area {
        height: 80vh; /* Use viewport height so it fits on screen */
    }

    /* Stack the Mode Selection buttons vertically */
    .mode-grid {
        grid-template-columns: 1fr;
    }

    /* Message bubbles should take more width on small screens */
    .message {
        max-width: 90%;
    }

    /* Product Item: Stack image and text vertically */
    .product-item {
        flex-direction: column;
        text-align: center;
    }

    .product-item img {
        width: 100px;
        height: 100px;
    }

    /* Card Content: Allow the product cards to stack better */
    .card-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-thumb {
        width: 60px;
        height: 60px;
        align-self: center;
    }

    /* Input area: Make it stay at the bottom and easy to tap */
    .aipc-input-area {
        padding: 10px;
        gap: 8px;
    }

    #user-input {
        font-size: 16px; /* Prevents iOS from zooming in on focus */
    }

    .aipc-btn {
        padding: 10px 15px;
    }
    
    .btn-text {
        display: none; /* Hide 'Send' text on mobile to save space */
    }
}
@media screen and (max-width: 768px) {
    /* 1. Stack the main card container */
    .card-content {
        flex-direction: column;
        align-items: center; /* Centers the image and text */
        text-align: center;
        gap: 12px;
    }

    /* 2. Make the image prominent at the top */
    .card-thumb {
        width: 120px; /* Larger image for mobile visibility */
        height: 120px;
        margin-bottom: 5px;
    }

    /* 3. Stack the title and price */
    .card-details {
        width: 100%;
        align-items: center;
    }

    .card-title {
        font-size: 16px;
        margin-bottom: 8px;
        order: 1; /* Ensures title is above price */
    }

    .card-price {
        font-size: 18px;
        margin-bottom: 15px;
        order: 2; /* Price stays below title */
    }

    /* 4. Full-width button at the bottom for easy tapping */
    .aipc-add-cart-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        order: 3; /* Forces button to the bottom */
    }
}
