/**
 * ESP Troubleshooting Page Styles
 *
 * Full-screen troubleshooting chat interface with phase tracking stepper.
 */

/* ============================================
   Page Layout
   ============================================ */

.esp-troubleshooting-body {
    background: #f8fafc;
}

.esp-troubleshooting-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.esp-troubleshooting {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.esp-troubleshooting-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   Hero Section
   ============================================ */

.esp-troubleshooting-hero {
    text-align: center;
    padding: 2rem 1rem 1rem;
}

.esp-troubleshooting-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem;
}

.esp-troubleshooting-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .esp-troubleshooting-hero {
        padding: 3rem 1rem 1.5rem;
    }

    .esp-troubleshooting-title {
        font-size: 2.5rem;
    }

    .esp-troubleshooting-subtitle {
        font-size: 1.125rem;
    }
}

/* ============================================
   Phase Stepper
   ============================================ */

.esp-troubleshooting-phases {
    padding: 1rem;
    margin-bottom: 1rem;
}

.esp-phase-stepper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    max-width: 800px;
    margin: 0 auto;
}

.esp-phase-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 180px;
}

.esp-phase-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    background: #e5e7eb;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.esp-phase-step.is-active .esp-phase-indicator {
    background: #E6AC2C;
    color: #1f2937;
    border-color: #E6AC2C;
    box-shadow: 0 0 0 4px rgba(230, 172, 44, 0.2);
}

.esp-phase-step.is-complete .esp-phase-indicator {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.esp-phase-content {
    margin-top: 0.5rem;
    text-align: center;
}

.esp-phase-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    transition: color 0.3s ease;
}

.esp-phase-step.is-active .esp-phase-label {
    color: #1f2937;
}

.esp-phase-step.is-complete .esp-phase-label {
    color: #10b981;
}

.esp-phase-hint {
    display: block;
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.esp-phase-connector {
    position: absolute;
    top: 18px;
    left: calc(50% + 18px);
    width: calc(100% - 36px);
    height: 2px;
    background: #e5e7eb;
    z-index: 1;
}

.esp-phase-step.is-complete .esp-phase-connector {
    background: #10b981;
}

@media (max-width: 640px) {
    .esp-phase-stepper {
        gap: 0.25rem;
    }

    .esp-phase-indicator {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .esp-phase-label {
        font-size: 0.6875rem;
    }

    .esp-phase-hint {
        display: none;
    }

    .esp-phase-connector {
        top: 14px;
        left: calc(50% + 14px);
        width: calc(100% - 28px);
    }
}

/* ============================================
   Chat Interface
   ============================================ */

.esp-troubleshooting-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    padding: 0 0 2rem;
}

.esp-troubleshooting-chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    overflow: hidden;
}

/* ============================================
   Messages Container
   ============================================ */

.esp-troubleshooting-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 400px;
    max-height: 60vh;
}

@media (min-width: 768px) {
    .esp-troubleshooting-messages {
        padding: 2rem;
        min-height: 450px;
    }
}

/* ============================================
   Welcome Message
   ============================================ */

.esp-troubleshooting-welcome {
    text-align: center;
    padding: 2rem 1rem;
    max-width: 600px;
    margin: auto;
}

.esp-troubleshooting-welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #E6AC2C 0%, #d4a429 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.esp-troubleshooting-welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.75rem;
}

.esp-troubleshooting-welcome-text {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

.esp-troubleshooting-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.esp-troubleshooting-suggestion {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.esp-troubleshooting-suggestion:hover {
    background: #E6AC2C;
    border-color: #E6AC2C;
    color: #1f2937;
}

/* ============================================
   Message Bubbles
   ============================================ */

.esp-troubleshooting-message {
    display: flex;
    animation: esp-message-fade-in 0.3s ease;
}

@keyframes esp-message-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.esp-troubleshooting-message--user {
    justify-content: flex-end;
}

.esp-troubleshooting-message--assistant {
    justify-content: flex-start;
}

.esp-troubleshooting-message-wrapper {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
}

.esp-troubleshooting-message--user .esp-troubleshooting-message-wrapper {
    flex-direction: row-reverse;
}

/* Avatars */
.esp-troubleshooting-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.esp-troubleshooting-avatar svg {
    width: 20px;
    height: 20px;
}

.esp-troubleshooting-avatar--bot {
    background: linear-gradient(135deg, #E6AC2C 0%, #d4a429 100%);
    color: white;
}

.esp-troubleshooting-avatar--user {
    background: #3b82f6;
    color: white;
}

/* Message Content */
.esp-troubleshooting-message-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.esp-troubleshooting-message-text {
    padding: 0.875rem 1.125rem;
    border-radius: 16px;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.esp-troubleshooting-message--assistant .esp-troubleshooting-message-text {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.esp-troubleshooting-message--user .esp-troubleshooting-message-text {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.esp-troubleshooting-message-text strong {
    font-weight: 600;
}

.esp-troubleshooting-message-text ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.esp-troubleshooting-message-text li {
    margin: 0.25rem 0;
}

/* ============================================
   Typing Indicator
   ============================================ */

.esp-troubleshooting-typing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.125rem;
    background: #f3f4f6;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.esp-troubleshooting-typing-text {
    font-size: 0.875rem;
    color: #6b7280;
}

.esp-troubleshooting-typing-dots {
    display: flex;
    gap: 4px;
}

.esp-troubleshooting-typing-dots span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: esp-typing-bounce 1.4s ease-in-out infinite;
}

.esp-troubleshooting-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.esp-troubleshooting-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes esp-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* ============================================
   Product Cards
   ============================================ */

.esp-troubleshooting-products {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.esp-troubleshooting-product-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: box-shadow 0.2s;
}

.esp-troubleshooting-product-card:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.esp-troubleshooting-product-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: #f9fafb;
    flex-shrink: 0;
}

.esp-troubleshooting-product-info {
    flex: 1;
    min-width: 0;
}

.esp-troubleshooting-product-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.esp-troubleshooting-product-name:hover {
    color: #E6AC2C;
}

.esp-troubleshooting-product-sku {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
}

.esp-troubleshooting-product-price {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #10b981;
    margin-top: 0.25rem;
}

.esp-troubleshooting-product-btn {
    padding: 0.5rem 0.75rem;
    background: #E6AC2C;
    color: #1f2937;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

.esp-troubleshooting-product-btn:hover {
    background: #d4a429;
}

@media (max-width: 480px) {
    .esp-troubleshooting-product-card {
        flex-wrap: wrap;
    }

    .esp-troubleshooting-product-btn {
        width: 100%;
        text-align: center;
        margin-top: 0.5rem;
    }
}

/* ============================================
   Input Area
   ============================================ */

.esp-troubleshooting-input-area {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.esp-troubleshooting-form {
    margin: 0;
}

.esp-troubleshooting-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.esp-troubleshooting-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    max-height: 150px;
}

.esp-troubleshooting-input:focus {
    outline: none;
    border-color: #E6AC2C;
    box-shadow: 0 0 0 3px rgba(230, 172, 44, 0.15);
}

.esp-troubleshooting-input::placeholder {
    color: #9ca3af;
}

.esp-troubleshooting-input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.esp-troubleshooting-send-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E6AC2C;
    border: none;
    border-radius: 12px;
    color: #1f2937;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.esp-troubleshooting-send-btn:hover:not(:disabled) {
    background: #d4a429;
    transform: scale(1.05);
}

.esp-troubleshooting-send-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.esp-troubleshooting-disclaimer {
    margin: 0.75rem 0 0;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
}

/* ============================================
   SEO Content Section
   ============================================ */

.esp-troubleshooting-seo {
    padding: 3rem 1rem;
    background: white;
    margin-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.esp-troubleshooting-seo-content {
    max-width: 1200px;
    margin: 0 auto;
}

.esp-troubleshooting-seo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
    margin: 0 0 2rem;
}

.esp-troubleshooting-seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.esp-troubleshooting-seo-card {
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.esp-troubleshooting-seo-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.75rem;
}

.esp-troubleshooting-seo-card p {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

.esp-troubleshooting-messages::-webkit-scrollbar {
    width: 6px;
}

.esp-troubleshooting-messages::-webkit-scrollbar-track {
    background: transparent;
}

.esp-troubleshooting-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.esp-troubleshooting-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .esp-troubleshooting-phases,
    .esp-troubleshooting-input-area,
    .esp-troubleshooting-seo {
        display: none;
    }

    .esp-troubleshooting-messages {
        max-height: none;
        overflow: visible;
    }
}
