/* Worker Dashboard Styles */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --success: #43b581;
    --warning: #faa61a;
    --danger: #f04747;
    --border: #2f3136;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Screens */
.screen {
    min-height: 100vh;
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    text-align: center;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-container h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.login-container p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #1a4a7a;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #3ca374;
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

.btn-warning:hover {
    background: #e09515;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #d63f3f;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

/* Send Message Section */
.send-message-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.auto-send-timer {
    color: var(--warning);
    font-weight: 600;
    font-size: 0.9rem;
}

.ready-pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(67, 181, 129, 0); }
}

/* Dashboard Layout */
#dashboard-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.header-left h1 {
    font-size: 1.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.worker-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
}

/* Main Content */
.dashboard-main {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    padding: 24px;
    flex: 1;
    overflow: hidden;
}

/* Panels */
.panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.panel-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

/* Session Status */
.session-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

.session-status.active .status-dot {
    background: var(--success);
}

/* Target Info */
.target-header {
    margin-bottom: 20px;
}

.target-header h3 {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.target-guild {
    font-size: 14px;
    color: var(--text-secondary);
}

.target-details {
    margin-bottom: 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row.notes {
    flex-direction: column;
    gap: 8px;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.detail-value {
    font-size: 14px;
}

.detail-value.links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-value.links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.detail-value.links a:hover {
    text-decoration: underline;
}

/* Template Section */
.template-section {
    margin-bottom: 24px;
}

.template-section h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.template-content {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
}

/* Target Actions */
.target-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Browser Panel */
.browser-panel {
    min-height: 0;
}

.browser-container {
    flex: 1;
    position: relative;
    background: #000;
}

.vnc-frame {
    width: 100%;
    height: 100%;
    border: none;
}

.vnc-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.vnc-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-primary);
}

.vnc-status.connected {
    background: var(--success);
    color: white;
}

.vnc-status.unavailable {
    background: var(--danger);
    color: white;
}

/* VNC Unavailable State */
.vnc-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    text-align: center;
}

.vnc-unavailable-icon {
    font-size: 48px;
    color: var(--warning);
}

.vnc-unavailable-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.vnc-unavailable-reason {
    font-size: 14px;
    color: var(--text-secondary);
}

.vnc-unavailable-help {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 300px;
    margin: 8px auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* Footer Stats */
.dashboard-footer {
    display: flex;
    justify-content: space-around;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-content textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
    color: white;
}

.toast.error {
    background: var(--danger);
    color: white;
}

.toast.info {
    background: var(--accent);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Automation Status Banner */
.automation-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.automation-status.running {
    background: linear-gradient(135deg, #1e4620 0%, #2d5a30 100%);
}

.automation-status.paused {
    background: linear-gradient(135deg, #4a3c00 0%, #5c4b00 100%);
}

.automation-status.waiting {
    background: linear-gradient(135deg, #4a2c00 0%, #5c3600 100%);
}

.automation-status.error {
    background: linear-gradient(135deg, #4a1c1c 0%, #5c2222 100%);
}

.automation-status-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.automation-state {
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.automation-step {
    font-size: 13px;
    color: var(--text-secondary);
}

.automation-controls {
    display: flex;
    gap: 8px;
}

/* CAPTCHA Alert */
.captcha-alert {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
    border-bottom: 2px solid #cd853f;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(205, 133, 63, 0.3); }
    50% { box-shadow: 0 0 20px rgba(205, 133, 63, 0.6); }
}

.captcha-alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f04747;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    flex-shrink: 0;
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.captcha-alert-content {
    flex: 1;
}

.captcha-alert-content strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.captcha-alert-content span {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
}

.captcha-alert-content p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
}

/* Manual Alert */
.manual-alert {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #4a4a00 0%, #5c5c00 100%);
    border-bottom: 2px solid #faa61a;
}

.manual-alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #faa61a;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    flex-shrink: 0;
}

.manual-alert-content {
    flex: 1;
}

.manual-alert-content strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.manual-alert-content p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* Workflow Progress */
.workflow-progress {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.workflow-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 16px;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.workflow-step.active {
    opacity: 1;
}

.workflow-step.completed {
    opacity: 1;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.workflow-step.active .step-number {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.5);
}

.workflow-step.completed .step-number {
    background: var(--success);
    border-color: var(--success);
}

.workflow-step.completed .step-number::after {
    content: '\2713';
    position: absolute;
}

.step-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
}

.workflow-step.active .step-label {
    color: var(--text-primary);
    font-weight: 600;
}

.workflow-connector {
    width: 40px;
    height: 2px;
    background: var(--border);
    margin: 0 4px;
    margin-bottom: 24px;
    transition: background 0.3s ease;
}

.workflow-step.completed + .workflow-connector {
    background: var(--success);
}

.workflow-state-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 16px;
    background: var(--bg-primary);
    border-radius: 6px;
}

/* Invite Row */
.invite-row {
    background: var(--bg-tertiary);
    margin: -12px -20px 12px -20px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.invite-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.invite-value code {
    font-family: 'Monaco', 'Consolas', monospace;
    background: var(--bg-primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent);
}

/* Tiny Button */
.btn-tiny {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
}

/* Browser Controls */
.browser-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* VNC Placeholder Enhancements */
.vnc-placeholder {
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.vnc-hint {
    font-size: 12px;
    opacity: 0.6;
}

/* Template Actions */
.template-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* AI Button */
.btn-ai {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
}

.btn-ai:disabled {
    background: #666;
    cursor: not-allowed;
}

/* AI Suggestion Panel */
.ai-suggestion-panel {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.ai-suggestion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ai-badge {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.ai-confidence {
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-suggestion-content {
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ai-suggestion-actions {
    display: flex;
    gap: 8px;
}

.ai-talking-points {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.talking-points-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}

.ai-talking-points ul {
    margin: 0;
    padding-left: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-talking-points li {
    margin-bottom: 4px;
}

/* Research Panel */
.research-panel {
    background: rgba(66, 133, 244, 0.1);
    border: 1px solid rgba(66, 133, 244, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}

.research-panel h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: #4285f4;
    margin-bottom: 8px;
}

.research-summary {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.research-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.research-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.research-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.research-value {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.research-value a {
    color: var(--accent);
    text-decoration: none;
}

.research-value a:hover {
    text-decoration: underline;
}

/* System Alert Banner */
.system-alert {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    padding: 12px 20px;
    position: relative;
}

.system-alert.hidden {
    display: none;
}

.system-alert.alert-error {
    background: linear-gradient(135deg, #2d1f1f 0%, #1a1a2e 100%);
    border-bottom-color: var(--danger);
}

.system-alert.alert-warning {
    background: linear-gradient(135deg, #2d2a1f 0%, #1a1a2e 100%);
    border-bottom-color: var(--warning);
}

.system-alert.alert-info {
    background: linear-gradient(135deg, #1f2a2d 0%, #1a1a2e 100%);
    border-bottom-color: var(--accent);
}

.system-alert-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.system-alert-icon {
    font-size: 24px;
    line-height: 1;
}

.system-alert-text {
    flex: 1;
}

.system-alert-text strong {
    display: block;
    margin-bottom: 4px;
}

.system-alert-text ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.system-alert-text li {
    margin: 2px 0;
}

.system-alert-help {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

.system-alert-help code {
    background: rgba(88, 101, 242, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
}

.system-alert-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.system-alert-close:hover {
    color: var(--text-primary);
}

.system-alert-indicators {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}

.system-alert-indicators .indicator {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.system-alert-indicators .indicator.ok {
    background: rgba(67, 181, 129, 0.2);
    color: var(--success);
}

.system-alert-indicators .indicator.fail {
    background: rgba(240, 71, 71, 0.2);
    color: var(--danger);
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-main {
        grid-template-columns: 1fr;
    }

    .browser-panel {
        min-height: 400px;
    }
}
