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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f3f4f6;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    animation: fadeInDown 0.6s ease;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 20px;
    color: var(--dark);
    font-size: 1.5rem;
}

/* Configuration Card */
.config-card {
    margin-bottom: 25px;
}

.config-card h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
}

.config-content {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.config-content .form-group {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

/* Navigation Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.tab.active {
    background: var(--primary);
    color: white;
}

.tab-icon {
    font-size: 1.2rem;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
}

input, textarea, select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--gray);
    border: 2px solid #e5e7eb;
}

.btn-outline:hover {
    background: var(--light);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Status Indicator */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #9ca3af;
    display: inline-block;
}

.status-indicator.connected {
    background: var(--success);
    animation: pulse 2s infinite;
}

/* Result Box */
.result-box {
    margin-top: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    display: none;
}

.result-box.show {
    display: block;
    animation: slideIn 0.4s ease;
}

.result-box h3 {
    margin-bottom: 15px;
    color: var(--dark);
}

.result-box pre {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
}

/* Product Items (Batch) */
.product-item {
    background: #f9fafb;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.product-item:hover {
    border-color: var(--primary-light);
}

.product-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.product-number {
    background: var(--primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.product-fields {
    display: grid;
    gap: 15px;
}

/* Batch Actions */
.batch-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--light);
    flex-wrap: wrap;
}

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

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

.status-pending {
    background: #fed7aa;
    color: #92400e;
}

.status-processing {
    background: #ddd6fe;
    color: #5b21b6;
}

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

/* Progress Bar */
.progress-bar {
    margin: 15px 0;
}

.progress-bar-bg {
    background: #e5e7eb;
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    background: var(--primary);
    height: 100%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 5px;
    color: var(--gray);
    font-size: 0.9rem;
}

/* Description Display */
.description-display {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    margin-top: 15px;
}

.description-section {
    margin-bottom: 25px;
}

.description-section:last-child {
    margin-bottom: 0;
}

.description-section h4 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--light);
    padding-bottom: 8px;
}

.description-text {
    color: #4b5563;
    line-height: 1.8;
}

.features-list {
    list-style: none;
    padding: 0;
}

.features-list li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
    color: #4b5563;
    line-height: 1.6;
}

.features-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Summary Stats */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid #e5e7eb;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 5px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header p {
        font-size: 1rem;
    }

    .card {
        padding: 20px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .tab-text {
        display: none;
    }

    .config-content {
        flex-direction: column;
    }

    .config-content .form-group {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .batch-actions {
        flex-direction: column;
    }

    .batch-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .description-display {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .card h2 {
        font-size: 1.2rem;
    }

    .summary-stats {
        grid-template-columns: 1fr;
    }
}