/* Ziggo Zakelijk - Verificatie Agent Styles */

:root {
    --primary: #FF6B00;
    --primary-dark: #E55A00;
    --secondary: #1a1a2e;
    --accent: #00A0D6;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #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;
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--secondary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
}

.logo span {
    font-weight: 600;
    font-size: 16px;
}

.nav-menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-400);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-500);
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.error {
    background: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Pages */
.page {
    display: none;
    padding: 32px;
}

.page.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-icon.blue {
    background: rgba(0, 160, 214, 0.1);
    color: var(--accent);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
}

/* Clickable Stat Cards */
.stat-card.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.stat-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-200);
}

.stat-card.clickable:active {
    transform: translateY(0);
}

.stat-card.clickable.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

/* Filter Badge */
.filter-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Button Link Style */
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    padding: 0;
    font-size: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* Download Buttons */
.download-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.download-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    text-decoration: none;
}

.download-buttons .btn svg {
    flex-shrink: 0;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
}

.table td {
    font-size: 14px;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.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-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* Inputs */
.input,
.select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(0, 160, 214, 0.1);
    color: var(--accent);
}

/* Test Sale Row */
.test-sale-row {
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--warning);
}

.test-sale-row:hover {
    background: rgba(245, 158, 11, 0.1);
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Call Panel */
.call-panel {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-call {
    text-align: center;
    color: var(--gray-400);
}

.no-call svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-call p {
    font-weight: 500;
    margin-bottom: 4px;
}

/* Calls Layout */
.calls-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    height: calc(100vh - var(--header-height) - 64px);
}

/* Active Calls List */
.active-calls-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.active-calls-list {
    flex: 1;
    overflow-y: auto;
}

.no-calls-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--gray-400);
}

.no-calls-message svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-calls-message p {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--gray-500);
}

.no-calls-message span {
    display: block;
    font-size: 13px;
    color: var(--gray-400);
}

/* Transcript Empty State */
.transcript-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    color: var(--gray-400);
    padding: 24px;
}

.transcript-empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
    color: var(--gray-400);
}

.transcript-empty .empty-title,
.transcript-empty p:first-of-type {
    font-weight: 600;
    font-size: 16px;
    color: var(--gray-600);
    margin: 0 0 8px 0;
}

.transcript-empty .empty-subtitle,
.transcript-empty p:last-of-type {
    font-size: 14px;
    color: var(--gray-400);
    margin: 0;
}

/* Loading Dots Animation */
.loading-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingBounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loadingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Active Call Item */
.call-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
}

.call-item:hover {
    background: var(--gray-50);
}

.call-item.active {
    background: rgba(255, 107, 0, 0.1);
    border-left: 3px solid var(--primary);
}

.call-item-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.call-item-avatar.ringing {
    background: var(--warning);
    animation: pulse-ring 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.call-item-avatar svg {
    width: 20px;
    height: 20px;
}

.call-item-info {
    flex: 1;
    min-width: 0;
}

.call-item-number {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.call-item-company {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.call-item-meta {
    text-align: right;
    flex-shrink: 0;
}

.call-item-duration {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.call-item-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--success);
    color: white;
}

.call-item-status.ringing {
    background: var(--warning);
}

/* Call Info Header */
.call-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.call-duration {
    font-family: 'Monaco', monospace;
    font-size: 14px;
    color: var(--gray-600);
}

/* Selected Call Details */
.selected-call-details {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.call-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.call-meta .meta-item {
    display: flex;
    flex-direction: column;
}

.call-meta .label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 2px;
}

.call-meta .value {
    font-weight: 500;
    color: var(--gray-800);
}

/* Connection Stats Grid */
.connection-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.conn-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.conn-stat-card:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.conn-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.conn-stat-icon.blue {
    background: rgba(0, 160, 214, 0.1);
    color: var(--accent);
}

.conn-stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
}

.conn-stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.conn-stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.conn-stat-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.conn-stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.conn-stat-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 2px;
}

.conn-stat-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    color: var(--gray-800);
    white-space: nowrap;
}

.conn-stat-value.good {
    color: var(--success);
}

.conn-stat-value.warning {
    color: var(--warning);
}

.conn-stat-value.bad {
    color: var(--danger);
}

@media (max-width: 1200px) {
    .connection-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .connection-stats-grid {
        grid-template-columns: 1fr;
    }

    .conn-stat-card {
        padding: 10px 14px;
    }

    .conn-stat-icon {
        width: 36px;
        height: 36px;
    }

    .conn-stat-value {
        font-size: 16px;
    }
}

.call-transcript-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.call-transcript-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.call-transcript-card .transcript {
    flex: 1;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: 8px;
    min-height: 300px;
}

.transcript {
    height: 400px;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: 8px;
    padding: 16px;
}

.transcript-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.transcript-entry {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
}

.transcript-entry.agent {
    background: var(--primary);
    color: white;
    margin-right: 40px;
}

.transcript-entry.customer {
    background: white;
    border: 1px solid var(--gray-200);
    margin-left: 40px;
}

.transcript-entry .speaker {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.8;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.config-status {
    margin-bottom: 20px;
}

.config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-200);
}

.config-item:last-child {
    border-bottom: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Call Info */
.call-info {
    text-align: center;
    margin-bottom: 24px;
}

.call-info h4 {
    font-size: 20px;
    margin-bottom: 4px;
}

.call-info p {
    color: var(--gray-500);
}

.call-status {
    text-align: center;
    padding: 24px;
}

.call-animation {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.call-animation span {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out both;
}

.call-animation span:nth-child(1) { animation-delay: -0.32s; }
.call-animation span:nth-child(2) { animation-delay: -0.16s; }

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.modal-transcript {
    max-height: 300px;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray-500);
}

.link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

/* Filter Group */
.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group .select {
    width: auto;
    min-width: 150px;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--secondary);
    color: white;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 101;
}

.hamburger-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-btn:hover {
    background: rgba(255,255,255,0.1);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-logo .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.mobile-logo span {
    font-weight: 600;
    font-size: 14px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: 60px;
    }

    .header {
        padding: 0 16px;
    }

    .header h1 {
        font-size: 18px;
    }

    .header-actions .btn span {
        display: none;
    }

    .page {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .stat-icon svg {
        width: 22px;
        height: 22px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-label {
        font-size: 12px;
    }

    .calls-layout {
        grid-template-columns: 1fr;
    }

    .card-header {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .card-body {
        padding: 16px;
    }

    .card-footer {
        padding: 12px 16px;
    }

    /* Table responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px;
    }

    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Docker controls responsive */
    .docker-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .docker-controls .select {
        min-width: 100px;
    }

    .toggle-label {
        font-size: 12px;
    }

    .docker-stats {
        flex-direction: column;
        gap: 8px;
    }

    /* Chat responsive */
    .chat-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-card {
        height: calc(100vh - 180px);
        min-height: 400px;
    }

    .chat-context-card {
        display: none;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-footer {
        padding: 12px 16px;
    }

    .chat-input-container {
        gap: 8px;
    }

    .chat-input-container .input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Quick actions in chat */
    .quick-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    /* Modal responsive */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 16px;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }

    /* Filter group */
    .filter-group {
        width: 100%;
    }

    .filter-group .select {
        flex: 1;
        min-width: auto;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
    }

    .btn-block {
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        text-align: left;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .settings-grid .card {
        margin-bottom: 16px;
    }
}

/* Chat Page */
.chat-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
    height: calc(100vh - var(--header-height) - 64px);
}

.chat-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.chat-messages {
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.agent {
    align-self: flex-start;
}

.chat-message.system {
    align-self: center;
    max-width: 90%;
}

.chat-message .message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.agent .message-content {
    background: var(--gray-100);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}

.chat-message.system .message-content {
    background: rgba(0, 160, 214, 0.1);
    color: var(--gray-700);
    text-align: center;
}

.chat-message.system ul {
    text-align: left;
    margin: 8px 0 0 20px;
    font-size: 13px;
}

.chat-message.system li {
    margin: 4px 0;
}

.message-hint {
    font-weight: 600;
    margin-top: 12px !important;
}

.chat-message .message-time {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
}

.chat-message.user .message-time {
    text-align: right;
}

.chat-footer {
    padding: 16px 24px;
}

.chat-input-container {
    display: flex;
    gap: 12px;
}

.chat-input-container .input {
    flex: 1;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-500);
}

.chat-context-card {
    height: fit-content;
}

.context-section {
    margin-bottom: 20px;
}

.context-section:last-child {
    margin-bottom: 0;
}

.context-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.context-value {
    font-size: 14px;
    color: var(--gray-800);
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Docker Logs Page */
.docker-logs-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 64px);
}

.docker-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.docker-controls .select {
    width: auto;
    min-width: 120px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.docker-logs-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.docker-logs-container {
    height: 100%;
    overflow: auto;
    background: var(--gray-900);
    border-radius: 0;
}

.docker-logs {
    margin: 0;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--gray-100);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.docker-logs .log-line {
    display: block;
}

.docker-logs .log-timestamp {
    color: var(--gray-500);
}

.docker-logs .log-info {
    color: #60A5FA;
}

.docker-logs .log-warning {
    color: #FBBF24;
}

.docker-logs .log-error {
    color: #F87171;
}

.docker-logs .log-success {
    color: #34D399;
}

.docker-logs-footer {
    padding: 12px 24px;
}

.docker-stats {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: var(--gray-500);
}

.docker-stats strong {
    color: var(--gray-700);
}

/* Loading indicator for chat */
.chat-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--gray-100);
    border-radius: 12px;
    font-size: 14px;
    color: var(--gray-500);
}

.chat-loading .dots {
    display: flex;
    gap: 4px;
}

.chat-loading .dots span {
    width: 6px;
    height: 6px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.chat-loading .dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-loading .dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Script Page */
.script-page-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
    align-items: start;
}

.script-editor-container {
    min-width: 0;
}

.script-versions-panel {
    position: sticky;
    top: 24px;
}

.script-description {
    color: var(--gray-500);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
}

.script-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.version-name-input {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    width: 180px;
    transition: all 0.2s;
}

.version-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.script-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.script-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.script-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.script-section .section-help {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.script-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
    background: var(--gray-50);
}

.script-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
    background: white;
}

.script-textarea::placeholder {
    color: var(--gray-400);
}

/* Agent Settings Grid */
.settings-grid-2col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.settings-group h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.settings-group .form-group {
    margin-bottom: 1rem;
}

.settings-group .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.settings-group .label-hint {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 11px;
}

.settings-group .form-help {
    display: block;
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

.settings-group .input,
.settings-group .select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-group .input:focus,
.settings-group .select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.settings-group .input[type="number"] {
    -moz-appearance: textfield;
}

.settings-group .input[type="number"]::-webkit-inner-spin-button,
.settings-group .input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@media (max-width: 1200px) {
    .settings-grid-2col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .settings-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* Versions Panel */
.versions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 600px;
    overflow-y: auto;
}

.versions-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--gray-400);
}

.versions-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.versions-empty p {
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.versions-empty span {
    font-size: 13px;
}

.version-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.version-item:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.version-item.active {
    border-color: var(--primary);
    background: rgba(255, 107, 0, 0.05);
}

.version-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.version-item.active .version-item-icon {
    background: var(--primary);
    color: white;
}

.version-item-icon svg {
    width: 18px;
    height: 18px;
}

.version-item-info {
    flex: 1;
    min-width: 0;
}

.version-item-name {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.version-item-date {
    font-size: 12px;
    color: var(--gray-500);
}

.version-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.version-item:hover .version-item-actions {
    opacity: 1;
}

.version-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.version-action-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.version-action-btn.delete:hover {
    background: var(--danger);
    color: white;
}

.version-action-btn svg {
    width: 14px;
    height: 14px;
}

.active-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--success);
    color: white;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Script page responsive */
@media (max-width: 1024px) {
    .script-page-layout {
        grid-template-columns: 1fr;
    }

    .script-versions-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .script-actions {
        flex-direction: column;
        width: 100%;
    }

    .version-name-input {
        width: 100%;
    }

    .script-actions .btn {
        width: 100%;
    }

    .script-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Docker logs scrollbar */
.docker-logs-container::-webkit-scrollbar-track {
    background: var(--gray-800);
}

.docker-logs-container::-webkit-scrollbar-thumb {
    background: var(--gray-600);
}

.docker-logs-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Responsive for chat and docker */
@media (max-width: 1200px) {
    .chat-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-card {
        height: 600px;
    }

    .chat-context-card {
        order: -1;
    }

    .docker-logs-card {
        height: 600px;
    }
}

/* ===== SANDBOX TEST ENVIRONMENT ===== */
.sandbox-card {
    display: flex;
    flex-direction: column;
}

.sandbox-card .card-header h3 {
    display: flex;
    align-items: center;
}

.sandbox-description {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.sandbox-customer-data {
    margin-bottom: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    padding: 0;
}

.sandbox-customer-data summary {
    cursor: pointer;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.sandbox-customer-data summary:hover {
    color: var(--primary);
}

.sandbox-customer-data[open] summary {
    border-bottom: 1px solid var(--gray-200);
}

.sandbox-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
}

.sandbox-data-grid .form-group {
    margin-bottom: 0;
}

.sandbox-data-grid label {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 2px;
}

.sandbox-data-grid .input-sm {
    padding: 6px 8px;
    font-size: 12px;
    height: auto;
}

.sandbox-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 8px;
}

.sandbox-chat {
    flex: 1;
    min-height: 250px;
    max-height: 350px;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sandbox-message {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.sandbox-message.user {
    background: var(--primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.sandbox-message.agent {
    background: white;
    border: 1px solid var(--gray-200);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.sandbox-message.system {
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 12px;
    text-align: center;
    max-width: 100%;
    margin: 0 auto;
}

.sandbox-message .message-speaker {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.7;
}

.sandbox-message.user .message-speaker {
    text-align: right;
}

.sandbox-message .message-content {
    word-wrap: break-word;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Status indicator */
.sandbox-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin-top: 8px;
}

.sandbox-status .status-reason {
    font-size: 12px;
    color: var(--gray-600);
}

/* Footer / Input area */
.sandbox-footer {
    padding: 12px;
    border-top: 1px solid var(--gray-200);
}

.sandbox-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.sandbox-input-container .input {
    flex: 1;
}

.sandbox-quick-responses {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sandbox-quick-responses .btn {
    font-size: 11px;
    padding: 4px 8px;
}

/* Scrollbar styling */
.sandbox-chat::-webkit-scrollbar {
    width: 6px;
}

.sandbox-chat::-webkit-scrollbar-track {
    background: transparent;
}

.sandbox-chat::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.sandbox-chat::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Responsive */
@media (max-width: 1400px) {
    .sandbox-data-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sandbox-chat {
        min-height: 200px;
        max-height: 300px;
    }
}

/* ===== BROWSER AGENT PAGE ===== */
.browser-agent-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
}

.browser-config-column {
    min-width: 0;
}

.browser-log-column {
    min-width: 0;
}

.browser-log-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 320px);
    min-height: 400px;
}

.browser-log-card .docker-logs-body {
    flex: 1;
}

.browser-log-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Browser log entry styling (reuses docker-logs patterns) */
.browser-log-entry {
    display: block;
    padding: 2px 0;
}

.browser-log-entry .log-time {
    color: var(--gray-500);
    margin-right: 8px;
}

.browser-log-entry .log-action {
    color: var(--accent);
    font-weight: 500;
    margin-right: 8px;
}

.browser-log-entry .log-status-success {
    color: #34D399;
}

.browser-log-entry .log-status-error {
    color: #F87171;
}

.browser-log-entry .log-status-info {
    color: #60A5FA;
}

.browser-log-entry .log-details {
    color: var(--gray-300);
}

/* Selectors viewer */
.browser-selectors-details summary {
    cursor: pointer;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.browser-selectors-details summary:hover {
    color: var(--primary);
}

.browser-selectors-json {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-900);
    color: var(--gray-100);
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    line-height: 1.5;
    overflow: auto;
    max-height: 300px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Screenshots Gallery */
.browser-screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.browser-screenshot-item {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.browser-screenshot-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.browser-screenshot-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.browser-screenshot-item .screenshot-info {
    padding: 8px 12px;
    font-size: 12px;
}

.browser-screenshot-item .screenshot-name {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-screenshot-item .screenshot-date {
    color: var(--gray-500);
    font-size: 11px;
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow-lg);
}

.notification-toast.success {
    background: var(--success);
    color: white;
}

.notification-toast.error {
    background: var(--danger);
    color: white;
}

.notification-toast.info {
    background: var(--accent);
    color: white;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Browser Agent Page Responsive */
@media (max-width: 1200px) {
    .browser-agent-layout {
        grid-template-columns: 1fr;
    }

    .browser-log-card {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .browser-log-card {
        height: 400px;
        min-height: 300px;
    }

    .browser-log-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .browser-screenshots-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
