/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Container Layout */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.logo {
    padding: 0 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: #60a5fa;
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.header h2 {
    font-size: 28px;
    color: #1f2937;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Filters */
.filters {
    margin-bottom: 20px;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.data-table th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table .loading {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
}

/* Status Badges */
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status.active {
    background: #d1fae5;
    color: #065f46;
}

.status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Method Badges */
.method {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: monospace;
}

.method.GET {
    background: #dbeafe;
    color: #1e40af;
}

.method.POST {
    background: #dcfce7;
    color: #166534;
}

.method.PUT {
    background: #fef3c7;
    color: #92400e;
}

.method.PATCH {
    background: #e0e7ff;
    color: #3730a3;
}

.method.DELETE {
    background: #fee2e2;
    color: #991b1b;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-bottom: 24px;
    color: #1f2937;
    font-size: 24px;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    color: #9ca3af;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #4b5563;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Chat Interface */
.chat-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-config {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 16px 16px 0 0;
}

.chat-config .form-control {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-config .form-control:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.chat-welcome {
    text-align: center;
    color: #9ca3af;
    padding: 60px 20px;
    font-size: 16px;
    background: white;
    border-radius: 12px;
    border: 2px dashed #e5e7eb;
}

.chat-message {
    max-width: 75%;
    padding: 16px 20px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.chat-message.assistant {
    background: white;
    color: #1f2937;
    align-self: flex-start;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 6px;
}

.chat-message.system {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    align-self: center;
    font-size: 13px;
    max-width: 90%;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 12px 16px;
}

/* Enhanced message content styling */
.message-content {
    line-height: 1.6;
}

.message-content strong {
    color: #1f2937;
    font-weight: 600;
}

.message-content em {
    color: #6b7280;
    font-style: italic;
}

.list-item {
    background: #f8fafc;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    border-left: 4px solid #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.image-container {
    margin: 12px 0;
    text-align: center;
}

.product-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.product-image:hover {
    transform: scale(1.05);
}

.image-caption {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

.external-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.external-link:hover {
    border-bottom-color: #2563eb;
}

.price-tag {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    margin: 0 4px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

/* Product information styling */
.product-info {
    background: #f8fafc;
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    font-size: 14px;
}

.stock-info {
    background: #f0f9ff;
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 4px;
    border-left: 3px solid #0ea5e9;
    font-size: 13px;
}

.stock-count {
    color: #059669;
    font-weight: 600;
}

.category-info {
    background: #fef3c7;
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 4px;
    border-left: 3px solid #f59e0b;
    font-size: 13px;
}

.category-tag {
    background: #f59e0b;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brand-info {
    background: #f3e8ff;
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 4px;
    border-left: 3px solid #8b5cf6;
    font-size: 13px;
}

.brand-tag {
    background: #8b5cf6;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.api-calls {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #1f2937;
    color: #10b981;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid #374151;
    margin-top: 8px;
}

/* Typing indicator */
.typing-indicator {
    opacity: 0.7;
    animation: none !important;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    margin-right: 8px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typingDot {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-text {
    color: #6b7280;
    font-style: italic;
    font-size: 14px;
}

/* Scroll to bottom button */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transition: all 0.2s;
    z-index: 10;
}

.scroll-to-bottom-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4);
}

.chat-container {
    position: relative;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

.chat-input-container .form-control {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.2s;
    resize: none;
}

.chat-input-container .form-control:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-input-container .btn {
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.2s;
}

.chat-input-container .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .chat-message {
        max-width: 85%;
    }
}

/* Action Buttons in Tables */
.action-btns {
    display: flex;
    gap: 8px;
}

/* Product List Styles */
.product-list-view {
    max-height: 80vh;
    overflow-y: auto;
}

.product-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.product-summary h4 {
    margin: 0 0 12px 0;
    color: #1e293b;
}

.product-summary p {
    margin: 4px 0;
    color: #64748b;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.product-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.product-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-card h5 {
    margin: 0 0 8px 0;
    color: #1e293b;
    font-size: 1.1em;
}

.product-description {
    color: #64748b;
    font-size: 0.9em;
    margin: 8px 0;
}

.product-price {
    color: #059669;
    font-size: 1.1em;
    margin: 8px 0;
}

.product-category,
.product-sku,
.product-stock,
.product-brand,
.product-color {
    color: #64748b;
    font-size: 0.85em;
    margin: 4px 0;
}

.product-features {
    margin-top: 12px;
}

.product-features ul {
    margin: 4px 0 0 0;
    padding-left: 16px;
}

.product-features li {
    color: #64748b;
    font-size: 0.85em;
    margin: 2px 0;
}

.product-raw-data {
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

.product-raw-data h4 {
    margin: 0 0 12px 0;
    color: #1e293b;
}

.json-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8em;
    max-height: 300px;
    overflow-y: auto;
    color: #334155;
}

.document-view {
    max-height: 80vh;
    overflow-y: auto;
}

.document-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.document-info p {
    margin: 4px 0;
    color: #64748b;
}

.document-content h4 {
    margin: 0 0 12px 0;
    color: #1e293b;
}

.document-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    max-height: 400px;
    overflow-y: auto;
    color: #334155;
    white-space: pre-wrap;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    color: #dc2626;
}

.error-message h4 {
    margin: 0 0 8px 0;
}

.error-message pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8em;
    max-height: 300px;
    overflow-y: auto;
    color: #334155;
    white-space: pre-wrap;
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

/* Form text styles */
.form-text {
    font-size: 0.875em;
    color: #6b7280;
    margin-top: 4px;
}

.text-success {
    color: #059669;
}