/**
 * Chatbot Buttons Styles
 * 챗봇 버튼 시스템 스타일
 */

/* Greeting Section */
.chatbot-greeting {
    text-align: center;
    padding: 24px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
    margin-bottom: 20px;
}

.chatbot-greeting h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.chatbot-greeting p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    opacity: 0.95;
}

/* Button Grid */
.chatbot-button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 20px 20px;
}

@media (max-width: 480px) {
    .chatbot-button-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Chatbot Button */
.chatbot-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    text-align: center;
}

.chatbot-button:hover {
    background: #f9fafb;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.chatbot-button:active {
    transform: translateY(0);
}

.chatbot-button.primary {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.chatbot-button.primary:hover {
    background: #5568d3;
    border-color: #5568d3;
}

/* Login Required Icon */
.login-required-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    opacity: 0.6;
}

/* Button Label */
.chatbot-button-label {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.chatbot-button.primary .chatbot-button-label {
    color: #fff;
}

.chatbot-button-description {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.chatbot-button.primary .chatbot-button-description {
    color: rgba(255, 255, 255, 0.8);
}

/* Back Button */
.chatbot-button.back-button {
    grid-column: 1 / -1;
    background: #f3f4f6;
    border-color: #d1d5db;
    min-height: 50px;
    margin-top: 8px;
}

.chatbot-button.back-button:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    transform: none;
    box-shadow: none;
}

.chatbot-button.back-button .chatbot-button-label {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
}

/* Submenu Header */
.submenu-header {
    padding: 20px;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}

.submenu-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    text-align: center;
}

/* Login Required Screen */
.login-required {
    text-align: center;
    padding: 40px 20px;
}

.login-required h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.login-required p {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.login-required .chatbot-button {
    max-width: 300px;
    margin: 0 auto 12px;
}

/* Loading State */
.chatbot-button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.chatbot-button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Disabled State */
.chatbot-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Error / Empty State Message */
.chatbot-error {
    padding: 20px;
    background: #f0f4ff;
    border: 2px solid #c7d2fe;
    border-radius: 8px;
    margin: 20px;
    text-align: center;
}

.chatbot-error p {
    color: #4b5563;
    font-size: 14px;
    margin: 0 0 12px 0;
}

.chatbot-error button {
    padding: 8px 16px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.chatbot-error button:hover {
    background: #5568d3;
}

/* Empty State */
.chatbot-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.chatbot-empty p {
    font-size: 14px;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chatbot-greeting {
        padding: 20px 16px;
    }

    .chatbot-greeting h2 {
        font-size: 18px;
    }

    .chatbot-greeting p {
        font-size: 13px;
    }

    .chatbot-button-grid {
        gap: 10px;
        padding: 0 16px 16px;
    }

    .chatbot-button {
        min-height: 70px;
        padding: 12px 10px;
    }

    .chatbot-button-label {
        font-size: 14px;
    }

    .chatbot-button-description {
        font-size: 10px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .chatbot-button {
        background: #1f2937;
        border-color: #374151;
    }

    .chatbot-button:hover {
        background: #374151;
        border-color: #667eea;
    }

    .chatbot-button-label {
        color: #f9fafb;
    }

    .chatbot-button-description {
        color: #9ca3af;
    }

    .submenu-header {
        background: #111827;
        border-color: #374151;
    }

    .submenu-header h3 {
        color: #f9fafb;
    }

    .chatbot-button.back-button {
        background: #374151;
        border-color: #4b5563;
    }

    .chatbot-button.back-button:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
}

/* API Result Styles */
.api-result {
    padding: 20px;
}

.chatbot-result-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.chatbot-result-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.chatbot-result-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-result-item {
    padding: 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-result-item:hover {
    border-color: #667eea;
    background: #f9fafb;
    transform: translateX(4px);
}

.chatbot-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}

.chatbot-item-date, .chatbot-item-period, .chatbot-item-location {
    font-size: 13px;
    color: #6b7280;
}

.chatbot-item-location {
    margin-top: 4px;
}

.chatbot-empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
}

/* FAQ Styles */
.chatbot-faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-faq-item {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.chatbot-faq-question {
    padding: 14px 16px;
    background: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #1f2937;
    transition: background 0.2s;
}

.chatbot-faq-question:hover {
    background: #f9fafb;
}

.chatbot-faq-toggle {
    font-size: 12px;
    transition: transform 0.3s;
}

.chatbot-faq-question.open .chatbot-faq-toggle {
    transform: rotate(180deg);
}

.chatbot-faq-answer {
    padding: 14px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    line-height: 1.6;
}

.chatbot-faq-answer p {
    margin: 0;
    color: #4b5563;
}

/* Order List Link */
.chatbot-order-list-link {
    margin-bottom: 15px;
    padding: 10px 20px;
}

.chatbot-order-list-link .chatbot-button {
    width: 100%;
    text-align: center;
}

/* Order Accordion */
.chatbot-order-accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-order-item {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.chatbot-order-summary {
    padding: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.chatbot-order-summary:hover {
    background: #f8f8f8;
}

.chatbot-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chatbot-order-number {
    font-weight: 700;
    color: #1f2937;
    font-size: 15px;
}

.chatbot-order-toggle {
    color: #667eea;
    font-size: 14px;
    transition: transform 0.3s;
}

.chatbot-order-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}

.chatbot-order-amount {
    font-size: 17px;
    font-weight: 700;
    color: #667eea;
}

.chatbot-order-details {
    padding: 15px;
    background: #fafafa;
    border-top: 2px solid #e5e7eb;
}

.chatbot-order-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.chatbot-product-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.chatbot-product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.chatbot-product-info {
    flex: 1;
}

.chatbot-product-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    font-size: 14px;
}

.chatbot-product-quantity,
.chatbot-product-price {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

.chatbot-order-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chatbot-order-actions .chatbot-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border: 2px solid;
    transition: all 0.2s;
}

.chatbot-btn-primary {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.chatbot-btn-primary:hover {
    background: #5568d3;
    border-color: #5568d3;
}

.chatbot-btn-info {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.chatbot-btn-info:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.chatbot-btn-warning {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}

.chatbot-btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

/* Delivery List */
.chatbot-delivery-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-delivery-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.chatbot-delivery-item:hover {
    background: #f0f9ff;
    border-color: #3b82f6;
    transform: translateX(5px);
}

.chatbot-delivery-image {
    flex-shrink: 0;
}

.chatbot-delivery-image img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
}

.chatbot-delivery-info {
    flex: 1;
}

.chatbot-delivery-product-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
    font-size: 14px;
}

.chatbot-delivery-order-no,
.chatbot-delivery-carrier,
.chatbot-delivery-tracking {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 3px;
}

.chatbot-delivery-status {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.chatbot-delivery-arrow {
    display: flex;
    align-items: center;
    font-size: 24px;
    color: #cbd5e1;
}

/* Exchange/Return List */
.chatbot-exchange-return-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-exchange-return-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.chatbot-exchange-return-item:hover {
    background: #fffbeb;
    border-color: #f59e0b;
    transform: translateX(5px);
}

.chatbot-er-image {
    flex-shrink: 0;
}

.chatbot-er-image img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
}

.chatbot-er-info {
    flex: 1;
}

.chatbot-er-order-no {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    font-size: 14px;
}

.chatbot-er-date,
.chatbot-er-status {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 3px;
}

.chatbot-er-amount {
    font-size: 13px;
    color: #1f2937;
    font-weight: 500;
    margin-top: 5px;
}

.chatbot-er-arrow {
    display: flex;
    align-items: center;
    font-size: 24px;
    color: #cbd5e1;
}


/* Navigation Buttons (이전으로 + 처음으로) */
.chatbot-navigation-buttons {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
}

.chatbot-navigation-buttons .chatbot-button.back-button {
    flex: 1;
    margin-top: 0;
    grid-column: auto;
}

/* Product Tracking Button (Full Width) */
.chatbot-product-tracking-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: #3b82f6;
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    transition: background 0.2s;
}

.chatbot-product-tracking-btn:hover {
    background: #2563eb;
}

/* Fade Animations */
.fade-in {
    animation: chatbotFadeIn 0.3s ease forwards;
}

.fade-out {
    animation: chatbotFadeOut 0.3s ease forwards;
}

@keyframes chatbotFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes chatbotFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* View Transition */
.view-exit {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.view-enter {
    animation: chatbotFadeIn 0.15s ease;
}

/* Redirect Button (page_redirect) */
.chatbot-button.redirect-button::after {
    content: '\2197';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    color: #9ca3af;
}

/* Navigation Icon */
.nav-icon {
    vertical-align: middle;
    margin-right: 4px;
}

/* Product Link */
.chatbot-product-link {
    flex-shrink: 0;
}

.chatbot-product-name-link {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.chatbot-product-name-link:hover {
    color: #667eea;
    text-decoration: underline;
}

/* Exchange/Return Link Card (using order-item structure) */
a.chatbot-order-item.chatbot-er-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

a.chatbot-order-item.chatbot-er-link:hover {
    border-color: #f59e0b;
    background: #fffbeb;
}

a.chatbot-order-item.chatbot-er-link .chatbot-order-summary {
    cursor: pointer;
}

/* Suggestion Section */
.chatbot-suggestions-section {
    padding: 20px 20px 24px;
}

.chatbot-suggestions-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 12px 0;
}

.chatbot-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chatbot-suggestion-bubble {
    display: inline-block;
    padding: 8px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.chatbot-suggestion-bubble:hover {
    background: #eef2ff;
    border-color: #667eea;
    color: #667eea;
}

/* Result Item Redirect Icon (notices, events, popup stores) */
.chatbot-result-item[data-url] {
    position: relative;
}

.chatbot-result-item[data-url]::after {
    content: '\2197';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    color: #9ca3af;
}
