/* Oracle Redwood Theme for DataCompare Pro */

:root {
    /* Redwood Primary Colors */
    --redwood-red: #c74634;
    --redwood-red-hover: #a93a2b;
    --redwood-red-light: #f7e8e6;
    
    /* Neutral Colors */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f0;
    
    /* Text Colors */
    --text-primary: #161513;
    --text-secondary: #4a4a4a;
    --text-muted: #6b6b6b;
    --text-placeholder: #999999;
    
    /* Status Colors */
    --success: #0d7c3d;
    --success-bg: #e6f4eb;
    --success-border: #b8e0c8;
    --warning: #d97706;
    --warning-bg: #fef3e2;
    --warning-border: #fcd9a8;
    --error: #c74634;
    --error-bg: #f7e8e6;
    --error-border: #f0c5c0;
    --info: #1a73e8;
    --info-bg: #e8f0fe;
    --info-border: #b8d4f8;
    
    /* Borders & Shadows */
    --border: #e0e0e0;
    --border-light: #ebebeb;
    --border-focus: rgba(199, 70, 52, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); }
::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

.app-container { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; display: flex; }

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--redwood-red);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.client-badge {
    padding: 6px 14px;
    background: var(--redwood-red);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 13px;
    border: 1px solid transparent;
}

.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active {
    background: var(--redwood-red-light);
    color: var(--redwood-red);
    border-color: var(--redwood-red);
    font-weight: 600;
}

.nav-icon { width: 18px; height: 18px; }
.content { flex: 1; padding: 24px; overflow-y: auto; }

/* Page Header */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 15px; font-weight: 600; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    position: relative;
    box-shadow: var(--shadow-card);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--redwood-red);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.error::before { background: var(--error); }
.stat-card.info::before { background: var(--info); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.error .stat-value { color: var(--error); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s ease;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--redwood-red); box-shadow: 0 0 0 3px var(--border-focus); }
.form-input::placeholder { color: var(--text-placeholder); }
.form-select { cursor: pointer; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary { background: var(--redwood-red); color: white; border-color: var(--redwood-red); }
.btn-primary:hover { background: var(--redwood-red-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-tertiary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Table */
.table-container { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-secondary); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 12px 14px; text-align: left; font-weight: 600; color: var(--text-secondary); background: var(--bg-tertiary); border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-tertiary); }

/* Badges */
.badge { display: inline-flex; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-error { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }

/* File Upload */
.file-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
}
.file-upload-zone:hover { border-color: var(--redwood-red); background: var(--redwood-red-light); }
.file-upload-icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--redwood-red); }
.file-upload-text { color: var(--text-secondary); }
.file-upload-text strong { color: var(--redwood-red); }

/* Charts */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-card); }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.chart-container { position: relative; height: 240px; }

/* Column Mapper */
.column-mapper { display: flex; gap: 20px; margin-top: 16px; }
.column-list { flex: 1; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; max-height: 280px; overflow-y: auto; }
.column-list-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; }
.column-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; }
.column-item:hover { border-color: var(--redwood-red); background: var(--redwood-red-light); }
.column-checkbox { width: 16px; height: 16px; accent-color: var(--redwood-red); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); width: 100%; max-width: 520px; max-height: 85vh; overflow: hidden; box-shadow: var(--shadow-lg); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--bg-tertiary); }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text-muted); cursor: pointer; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; max-height: calc(85vh - 130px); }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--bg-tertiary); }

/* Tabs */
.tabs { display: flex; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; margin-bottom: 20px; }
.tab { flex: 1; padding: 10px 16px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; }
.tab:hover { color: var(--text-primary); background: var(--bg-secondary); }
.tab.active { background: var(--redwood-red); color: white; }

/* Filter */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Actions */
.action-buttons { display: flex; gap: 6px; }
.action-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-secondary); cursor: pointer; }
.action-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.action-btn.danger:hover { background: var(--error-bg); color: var(--error); border-color: var(--error); }

/* Result rows */
.result-row.match td:first-child { border-left: 3px solid var(--success); }
.result-row.mismatch td:first-child { border-left: 3px solid var(--error); }
.result-row.source-only td:first-child { border-left: 3px solid var(--info); }
.result-row.target-only td:first-child { border-left: 3px solid var(--warning); }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--redwood-red); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state-icon { width: 56px; height: 56px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease forwards; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .column-mapper { flex-direction: column; }
}

/* Fix for Actions column wrapping */
.actions-cell {
    white-space: nowrap !important;
    min-width: 100px;
}
.actions-cell .action-btn {
    display: inline-flex;
    margin-right: 4px;
}
.actions-cell .action-btn:last-child {
    margin-right: 0;
}

/* Ensure table cells don't wrap unexpectedly */
.table td:last-child {
    white-space: nowrap;
}

/* =============================================================================
   AI ASSISTANT STYLES
   ============================================================================= */

/* Floating Action Button */
.ai-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(199, 70, 52, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1000;
}

.ai-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(199, 70, 52, 0.5);
}

/* Main Panel */
.ai-assistant {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* Header */
.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-title {
    font-weight: 600;
    font-size: 14px;
}

.ai-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-primary);
}

.ai-status.online {
    color: var(--success);
}

.ai-status.offline {
    color: var(--error);
}

.ai-status.checking {
    color: var(--warning);
}

.ai-provider-select {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.ai-btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background 0.2s;
}

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

/* Context Bar */
.ai-context {
    padding: 8px 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-context strong {
    color: var(--text-primary);
}

.ai-context-warning {
    color: var(--warning);
}

/* Chat History */
.ai-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

.ai-empty p {
    margin: 8px 0;
}

.ai-empty-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Messages */
.ai-message {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.ai-message-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.ai-message-error {
    align-self: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    font-size: 12px;
}

.ai-message-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ai-message-content p {
    margin: 0 0 8px 0;
}

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

/* Suggestions */
.ai-suggestions {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.ai-suggestions > p {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: var(--text-muted);
}

.ai-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-suggestion-btn {
    padding: 6px 10px;
    font-size: 11px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.ai-suggestion-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* Input Area */
.ai-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.ai-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    resize: none;
    font-family: inherit;
}

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

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

.ai-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

/* Warning */
.ai-warning {
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border-top: 1px solid var(--error);
    text-align: center;
}

.ai-warning p {
    margin: 0;
    font-size: 12px;
    color: var(--error);
}

.ai-warning-hint {
    margin-top: 4px !important;
    font-size: 10px !important;
    color: var(--text-muted) !important;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-assistant {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        bottom: 8px;
        right: 8px;
        border-radius: 12px;
    }
    
    .ai-fab {
        bottom: 16px;
        right: 16px;
    }
}
