/* ============================================================================
   Product Sync Dashboard — Modern Dark Theme
   ============================================================================ */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2130;
    --bg-card-hover: #252840;
    --bg-input: #14161e;
    --border: #2a2d3e;
    --border-focus: #14b8a6;
    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #14b8a6;
    --accent-hover: #2dd4bf;
    --accent-glow: rgba(20, 184, 166, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-content {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #5eead4);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-stats {
    display: flex;
    gap: 12px;
}

.stat-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    color: var(--accent);
    font-weight: 600;
}

/* Dashboard Layout */
.dashboard {
    max-width: 1440px;
    margin: 24px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
}

.col-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition);
}

.card:hover {
    border-color: #3a3d50;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}

.btn-close:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* Store List */
.store-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.store-item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all var(--transition);
}

.store-item:hover {
    border-color: #3a3d50;
}

.store-info {
    flex: 1;
}

.store-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
}

.store-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.platform-badge.woocommerce {
    background: rgba(20, 184, 166, 0.15);
    color: #5eead4;
}

.platform-badge.shopify {
    background: rgba(80, 184, 72, 0.15);
    color: #4ade80;
}

.btn-delete-store {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}

.btn-delete-store:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-status {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.upload-status.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.upload-status.error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.upload-status.loading {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* Bot Controls */
.bot-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bot-info {
    display: flex;
    gap: 16px;
}

.bot-stat {
    flex: 1;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}

.bot-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bot-stat-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
    color: var(--text-primary);
}

.bot-actions {
    display: flex;
    gap: 10px;
}

.bot-actions .btn {
    flex: 1;
}

.bot-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-stopped {
    background: var(--text-muted);
}

.dot-running {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Products */
.products-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.select-input {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition);
    min-width: 140px;
}

.select-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table td:first-child,
.data-table th:first-child {
    width: 40px;
    text-align: center;
}

.data-table input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0 0;
}

.pagination button {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.pagination button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Sync Logs */
.sync-logs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.sync-log-item {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.sync-log-info {
    flex: 1;
}

.sync-log-store {
    font-weight: 600;
    margin-bottom: 2px;
}

.sync-log-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.sync-log-stats {
    text-align: right;
    font-size: 12px;
}

.sync-log-stats .success {
    color: var(--success);
}

.sync-log-stats .failed {
    color: var(--danger);
}

.sync-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.sync-status-badge.completed {
    background: var(--success-bg);
    color: var(--success);
}

.sync-status-badge.running {
    background: var(--accent-glow);
    color: var(--accent);
}

.sync-status-badge.failed {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 13px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow);
    animation: slideUp 0.2s ease;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.form-group {
    padding: 0 20px;
    margin-top: 16px;
}

.form-group:first-of-type {
    margin-top: 20px;
}

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

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-actions {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

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

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: slideIn 0.2s ease;
    max-width: 360px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--accent);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

/* Text helpers */
.text-muted {
    color: var(--text-muted);
    font-size: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3d50;
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .header-stats {
        display: none;
    }

    .products-actions {
        flex-wrap: wrap;
    }
}