/* ============================================
   CORTEX AGENT LOGIN & CAMPAIGN SELECTION
   ============================================ */

:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    max-width: 420px;
    width: 100%;
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 1.5rem;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 15px;
    color: var(--gray-500);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-label i {
    color: var(--primary-color);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    color: var(--gray-600);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.forgot-link {
    font-size: 14px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.forgot-link:hover {
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    margin-top: 1rem;
    padding: 0.875rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connection-status {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: var(--gray-100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
    color: var(--gray-600);
}

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

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

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

.system-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-badge {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-badge i {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

/* ============================================
   CAMPAIGN SELECTION PAGE
   ============================================ */

.campaign-select-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.campaign-container {
    max-width: 1200px;
    width: 100%;
}

.campaign-card {
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.campaign-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--gray-200);
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.welcome-text h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.25rem 0;
}

.welcome-text h2 span {
    color: var(--primary-color);
}

.welcome-text p {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0;
}

.logout-link {
    padding: 0.75rem 1.5rem;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logout-link:hover {
    background: #dc2626;
    color: white;
}

.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.campaign-option {
    background: white;
    border: 3px solid var(--gray-200);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.campaign-option:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.2);
    border-color: var(--primary-color);
}

.campaign-option.loading {
    opacity: 0.6;
    pointer-events: none;
}

.campaign-option.active {
    border-color: var(--success-color);
}

.campaign-option.inactive {
    opacity: 0.7;
}

.campaign-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.campaign-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.campaign-status {
    display: flex;
    gap: 0.5rem;
}

.badge-active {
    padding: 0.25rem 0.75rem;
    background: #d1fae5;
    color: #065f46;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-inactive {
    padding: 0.25rem 0.75rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.campaign-option-body {
    margin-bottom: 1rem;
}

.campaign-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem 0;
}

.campaign-desc {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.campaign-metrics {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
    color: var(--gray-600);
}

.metric i {
    color: var(--primary-color);
}

.campaign-option-footer {
    margin-top: 1rem;
}

.select-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.select-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.empty-state,
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i,
.loading-state i {
    font-size: 64px;
    color: var(--gray-300);
    margin-bottom: 1.5rem;
}

.loading-state i {
    color: var(--primary-color);
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 15px;
    color: var(--gray-500);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .campaign-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .campaigns-grid {
        grid-template-columns: 1fr;
    }
    
    .system-stats {
        flex-direction: column;
    }
}
```
/* ============================================
   WEBRTC SETUP PAGE
   ============================================ */

.webrtc-setup-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.setup-container {
    max-width: 1000px;
    width: 100%;
    display: flex;
    gap: 2rem;
}

.setup-card {
    flex: 1;
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.setup-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.setup-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.setup-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem 0;
}

.setup-header p {
    font-size: 16px;
    color: var(--gray-500);
}

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setup-step {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: 16px;
    border: 2px solid var(--gray-200);
    transition: all 0.3s;
}

.setup-step.disabled {
    opacity: 0.5;
}

.setup-step.active {
    background: #f0f9ff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.setup-step.completed {
    background: #f0fdf4;
    border-color: var(--success-color);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--gray-500);
    flex-shrink: 0;
    transition: all 0.3s;
}

.setup-step.active .step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.setup-step.completed .step-number {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.setup-step.completed .step-number::before {
    content: '✓';
}

.setup-step.completed .step-number::after {
    content: '';
    display: none;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem 0;
}

.step-content p {
    font-size: 14px;
    color: var(--gray-600);
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.setup-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

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

.setup-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.setup-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.setup-btn.success {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.setup-btn.success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

.audio-test {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 2px solid var(--gray-200);
}

.audio-visualizer {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: flex-end;
    height: 80px;
    margin-bottom: 1rem;
}

.audio-bar {
    width: 12px;
    height: 10px;
    background: var(--gray-200);
    border-radius: 6px;
    transition: all 0.1s ease-out;
}

.audio-bar.active {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.audio-bar:nth-child(1).active { height: 20px; }
.audio-bar:nth-child(2).active { height: 40px; }
.audio-bar:nth-child(3).active { height: 60px; }
.audio-bar:nth-child(4).active { height: 40px; }
.audio-bar:nth-child(5).active { height: 20px; }

.audio-status {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--gray-600);
}

.mic-selection {
    margin-top: 1rem;
}

.mic-selection label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.device-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: all 0.3s;
}

.device-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.error-box {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-top: 1.5rem;
}

.error-box i {
    font-size: 48px;
    color: #dc2626;
    margin-bottom: 1rem;
}

.error-box h4 {
    font-size: 18px;
    font-weight: 700;
    color: #991b1b;
    margin: 0 0 0.5rem 0;
}

.error-box p {
    font-size: 14px;
    color: #7f1d1d;
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.retry-btn {
    padding: 0.75rem 1.5rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.retry-btn:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

.skip-setup {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.skip-link {
    font-size: 14px;
    color: var(--gray-500);
    text-decoration: none;
}

.skip-link:hover {
    color: var(--gray-700);
    text-decoration: underline;
}

.campaign-info {
    width: 300px;
    background: white;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.campaign-info h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 1.5rem 0;
}

.campaign-badge {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--gray-200);
}

.campaign-badge .campaign-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.campaign-badge .campaign-description {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.5;
}

.campaign-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.campaign-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.campaign-stats .stat-label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.campaign-stats .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

/* ============================================
   RESPONSIVE - WEBRTC
   ============================================ */

@media (max-width: 968px) {
    .setup-container {
        flex-direction: column;
    }
    
    .campaign-info {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .setup-card {
        padding: 1.5rem;
    }
    
    .setup-step {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .audio-visualizer {
        height: 60px;
    }
}
