/**
 * FEATURE-022-A: Browser Simulator & Proxy
 * 
 * Styles for the browser simulator UI.
 */

/* CSS Variables - Theme Integration */
:root {
    --uiux-slate-50: #f8fafc;
    --uiux-slate-100: #f1f5f9;
    --uiux-slate-200: #e2e8f0;
    --uiux-slate-300: #cbd5e1;
    --uiux-slate-400: #94a3b8;
    --uiux-slate-500: #64748b;
    --uiux-slate-600: #475569;
    --uiux-slate-700: #334155;
    --uiux-slate-800: #1e293b;
    --uiux-slate-900: #0f172a;
    
    --uiux-accent: #10b981;
    --uiux-accent-dark: #059669;
    --uiux-accent-light: #d1fae5;
    
    --uiux-radius-sm: 4px;
    --uiux-radius-md: 8px;
    --uiux-radius-lg: 12px;
    
    --uiux-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Override content-body padding for browser simulator page */
.content-body:has(.uiux-container) {
    padding: 0;
}

/* Main Layout */
.uiux-container {
    display: flex;
    flex-direction: row;
    height: calc(93vh - 56px);
    background: var(--uiux-slate-200);
    position: relative;
    overflow: hidden;
}

/* Browser Main Area (left side) */
.browser-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-right: 32px; /* Space for collapsed feedback tab */
}

/* Browser Chrome */
.browser-chrome {
    background: var(--uiux-slate-800);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.browser-dots {
    display: flex;
    gap: 6px;
}

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

.browser-dot.red { background: #ff5f57; }
.browser-dot.yellow { background: #febc2e; }
.browser-dot.green { background: #28c840; }

/* URL Bar */
.url-bar {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--uiux-slate-700);
    border-radius: var(--uiux-radius-md);
    overflow: hidden;
}

.url-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 14px;
    color: white;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}

.url-input::placeholder {
    color: var(--uiux-slate-500);
}

.url-input:focus {
    outline: none;
}

.go-btn {
    background: var(--uiux-accent);
    color: white;
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.go-btn:hover:not(:disabled) {
    background: var(--uiux-accent-dark);
}

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

/* Browser Viewport */
.browser-viewport-container {
    flex: 1;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.browser-viewport {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: var(--uiux-radius-lg);
    box-shadow: var(--uiux-shadow-lg);
    overflow: hidden;
    position: relative;
}

.viewport-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--uiux-slate-200);
    border-top-color: var(--uiux-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    color: var(--uiux-slate-600);
    font-size: 14px;
    font-weight: 500;
}

/* Error Overlay */
.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
    cursor: pointer;
}

.error-icon {
    width: 64px;
    height: 64px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-icon i {
    font-size: 32px;
    color: #ef4444;
}

.error-message {
    color: var(--uiux-slate-700);
    font-size: 14px;
    text-align: center;
    max-width: 400px;
    padding: 0 20px;
}

.error-hint {
    color: var(--uiux-slate-500);
    font-size: 12px;
}

/* Status Bar */
.browser-status {
    background: var(--uiux-slate-100);
    padding: 8px 16px;
    border-top: 1px solid var(--uiux-slate-300);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--uiux-accent);
    border-radius: 50%;
}

.status-text {
    font-size: 12px;
    color: var(--uiux-slate-600);
    font-family: 'JetBrains Mono', monospace;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--uiux-slate-500);
    text-align: center;
    padding: 40px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--uiux-slate-400);
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--uiux-slate-700);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    max-width: 300px;
}

/* =========================================
   FEATURE-022-B: Browser Toolbar & Inspector
   ========================================= */

/* Toolbar */
.browser-toolbar {
    background: var(--uiux-slate-100);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--uiux-slate-200);
    flex-shrink: 0;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--uiux-slate-300);
    border-radius: var(--uiux-radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--uiux-slate-600);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-btn:hover {
    background: var(--uiux-slate-200);
    border-color: var(--uiux-slate-400);
}

.toolbar-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.toolbar-btn.active:hover {
    background: #2563eb;
    border-color: #2563eb;
}

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

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

.toolbar-btn-primary:hover {
    background: var(--uiux-accent-dark);
    border-color: var(--uiux-accent-dark);
}

.toolbar-btn i {
    font-size: 14px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--uiux-slate-300);
    margin: 0 4px;
}

.toolbar-info {
    font-size: 12px;
    color: var(--uiux-slate-500);
    margin-left: auto;
}

/* Inspector Highlight Overlay */
.inspector-highlight {
    position: absolute;
    pointer-events: none;
    border: 2px solid #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 4px;
    z-index: 1000;
    transition: all 0.05s ease;
}

.inspector-highlight.selected {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

/* Inspector Tooltip */
.inspector-tooltip {
    position: absolute;
    background: #3b82f6;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
}

/* ========================================
   FEATURE-022-C: Context Menu & Feedback Panel
   ======================================== */

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    background: white;
    border-radius: var(--uiux-radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 2000;
    padding: 4px 0;
    border: 1px solid var(--uiux-slate-200);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--uiux-slate-700);
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--uiux-slate-100);
}

.context-menu-item i {
    font-size: 16px;
    color: var(--uiux-slate-500);
}

.context-menu-divider {
    height: 1px;
    background: var(--uiux-slate-200);
    margin: 4px 0;
}

/* Feedback Panel */
.feedback-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 570px;
    background: white;
    border-left: 1px solid var(--uiux-slate-200);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1500;
    transition: transform 0.3s ease, width 0.3s ease;
}

/* Collapsed state */
.feedback-panel.collapsed {
    transform: translateX(calc(100% - 28px));
    cursor: pointer;
}

.feedback-panel.collapsed:hover {
    transform: translateX(calc(100% - 32px));
}

/* Collapsed tab indicator */
.panel-collapse-tab {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 100px;
    background: var(--uiux-accent);
    border-radius: 6px 0 0 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    transition: width 0.2s ease, background 0.2s ease;
}

.panel-collapse-tab:hover {
    width: 32px;
    background: var(--uiux-accent-dark);
}

.panel-collapse-tab i {
    color: white;
    font-size: 14px;
}

.panel-collapse-tab .tab-badge {
    background: white;
    color: var(--uiux-accent-dark);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

/* Hide tab when expanded */
.feedback-panel:not(.collapsed) .panel-collapse-tab {
    display: none;
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--uiux-slate-200);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--uiux-slate-50);
    cursor: pointer;
    transition: background 0.2s ease;
}

.panel-header:hover {
    background: var(--uiux-slate-100);
}

/* Collapse button in header */
.panel-collapse-btn {
    background: none;
    border: none;
    color: var(--uiux-slate-400);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.panel-collapse-btn:hover {
    background: var(--uiux-slate-200);
    color: var(--uiux-slate-600);
}

.panel-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--uiux-slate-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title i {
    color: var(--uiux-accent);
}

.panel-subtitle {
    font-size: 12px;
    color: var(--uiux-slate-500);
    margin-top: 2px;
}

.panel-badge {
    background: var(--uiux-accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.panel-header-right {
    display: flex;
    align-items: center;
}

/* Feedback List */
.feedback-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.empty-feedback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--uiux-slate-400);
}

.empty-feedback i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-feedback p {
    margin: 0 0 8px 0;
    font-weight: 500;
    color: var(--uiux-slate-500);
}

.empty-feedback small {
    font-size: 12px;
}

/* Feedback Entry */
.feedback-entry {
    background: var(--uiux-slate-50);
    border: 1px solid var(--uiux-slate-200);
    border-radius: var(--uiux-radius-md);
    margin-bottom: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.feedback-entry:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.feedback-entry.expanded {
    border-color: var(--uiux-accent);
}

.feedback-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    background: white;
}

.feedback-entry-header:hover {
    background: var(--uiux-slate-50);
}

.entry-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.entry-chevron {
    font-size: 12px;
    color: var(--uiux-slate-400);
    transition: transform 0.2s;
}

.feedback-entry.expanded .entry-chevron {
    transform: rotate(0deg);
}

.entry-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--uiux-slate-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.entry-action-btn {
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--uiux-slate-400);
    transition: all 0.15s;
}

.entry-action-btn:hover {
    background: var(--uiux-slate-100);
    color: var(--uiux-slate-600);
}

.entry-action-btn.delete-entry:hover {
    color: #ef4444;
    background: #fef2f2;
}

.entry-action-btn.copy-path:hover {
    color: var(--uiux-accent-dark);
    background: var(--uiux-accent-light);
}

/* Entry Body */
.feedback-entry-body {
    padding: 12px;
    border-top: 1px solid var(--uiux-slate-200);
    background: white;
}

.entry-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--uiux-slate-500);
    margin-bottom: 12px;
}

.entry-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.entry-screenshot {
    margin-bottom: 12px;
    border-radius: var(--uiux-radius-sm);
    overflow: hidden;
    border: 1px solid var(--uiux-slate-200);
}

.entry-screenshot img {
    width: 100%;
    height: auto;
    display: block;
}

.entry-url {
    font-size: 12px;
    color: var(--uiux-slate-500);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    padding: 8px;
    background: var(--uiux-slate-50);
    border-radius: var(--uiux-radius-sm);
    word-break: break-all;
}

.entry-selectors {
    font-size: 12px;
    margin-bottom: 12px;
}

.entry-selectors strong {
    color: var(--uiux-slate-600);
    display: block;
    margin-bottom: 6px;
}

.entry-selectors ul {
    margin: 0;
    padding-left: 16px;
}

.entry-selectors li {
    margin-bottom: 4px;
    line-height: 1.6;
}

.entry-selectors code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    background: var(--uiux-slate-100);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--uiux-slate-700);
}

.entry-selectors code.selected-el {
    background: var(--uiux-accent-light);
    color: var(--uiux-accent-dark);
    font-weight: 600;
}

.entry-selectors .parent-chain {
    color: var(--uiux-slate-400);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
}

.entry-description {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.entry-description label {
    font-size: 12px;
    font-weight: 500;
    color: var(--uiux-slate-600);
}

.entry-description-input {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--uiux-slate-200);
    border-radius: var(--uiux-radius-sm);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.entry-description-input:focus {
    outline: none;
    border-color: var(--uiux-accent);
}

.entry-description-input::placeholder {
    color: var(--uiux-slate-400);
}


/* ========================================
   FEATURE-022-D: Entry Status & Submit
   ======================================== */

/* Entry Status Badge */
.entry-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-draft .entry-status {
    background: var(--uiux-slate-100);
    color: var(--uiux-slate-500);
}

.status-submitting .entry-status {
    background: #dbeafe;
    color: #3b82f6;
}

.status-submitted .entry-status {
    background: #dcfce7;
    color: #16a34a;
}

.status-failed .entry-status {
    background: #fee2e2;
    color: #dc2626;
}

/* Spin animation for submitting */
.spin {
    animation: spin 1s linear infinite;
}

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

/* Entry Error Message */
.entry-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 8px 12px;
    border-radius: var(--uiux-radius-sm);
    margin-bottom: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Entry Actions Footer */
.entry-actions-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--uiux-slate-100);
}

/* Submit Button */
.btn-submit {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--uiux-accent);
    color: white;
    border: none;
    border-radius: var(--uiux-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover:not(:disabled) {
    background: var(--uiux-accent-dark);
}

.btn-submit:disabled {
    background: var(--uiux-slate-300);
    cursor: not-allowed;
}

/* Copilot Button */
.btn-copilot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #6e40c9;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-copilot:hover:not(:disabled) {
    background: #553098;
}

.btn-copilot:disabled {
    background: var(--uiux-slate-300);
    cursor: not-allowed;
}

.btn-copilot i {
    font-size: 14px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--uiux-radius-md);
    color: white;
    font-size: 14px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

.toast-info {
    background: #3b82f6;
}

