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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card.warning {
    border-left: 4px solid #f39c12;
}

.card h2 {
    font-size: 1.25rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.card h2 .count {
    font-weight: normal;
    color: #95a5a6;
}

.switchboard {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.switchboard label {
    font-weight: 600;
    color: #2c3e50;
}

.client-dropdown {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.client-dropdown:hover {
    border-color: #3498db;
}

.client-dropdown:focus {
    outline: none;
    border-color: #3498db;
}

.secrets-list {
    list-style: none;
}

.secrets-list li {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.secrets-list li.configured {
    background: #e8f8f0;
}

.secrets-list li.missing {
    background: #fef3e6;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.configured .status-dot {
    background: #27ae60;
}

.missing .status-dot {
    background: #e74c3c;
}

.check {
    margin-left: auto;
    color: #27ae60;
    font-size: 0.875rem;
}

.x {
    margin-left: auto;
    color: #e74c3c;
    font-size: 0.875rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.status-panel {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#statusMessage {
    color: #7f8c8d;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-idle {
    background: #ecf0f1;
    color: #7f8c8d;
}

.badge-running {
    background: #3498db;
    color: white;
    animation: pulse 1.5s infinite;
}

.badge-completed {
    background: #27ae60;
    color: white;
}

.badge-failed {
    background: #e74c3c;
    color: white;
}

.badge-pending {
    background: #f39c12;
    color: white;
}

.badge-processing {
    background: #3498db;
    color: white;
    animation: pulse 1.5s infinite;
}

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

.progress-section {
    margin-top: 1rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

#progressPercent {
    color: #3498db;
}

.progress-bar-large {
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill-animated {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 50%, #27ae60 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #bdc3c7;
    font-weight: 500;
    transition: color 0.3s;
}

.step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s;
}

.step.active {
    color: #3498db;
}

.step.active .step-icon {
    background: #3498db;
    color: white;
    animation: pulse 1.5s infinite;
}

.step.completed {
    color: #27ae60;
}

.step.completed .step-icon {
    background: #27ae60;
    color: white;
}

.task-progress-text {
    text-align: center;
    color: #7f8c8d;
    font-size: 0.875rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid #ecf0f1;
}

th {
    font-weight: 600;
    color: #7f8c8d;
    font-size: 0.875rem;
    text-transform: uppercase;
    background: #f8f9fa;
}

tbody tr:hover {
    background: #f8f9fa;
}

.keyword-cell {
    font-weight: 500;
    color: #2c3e50;
}

.step-cell {
    color: #7f8c8d;
    font-size: 0.875rem;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.empty {
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.preview-container {
    border: 2px solid #3498db;
    border-radius: 8px;
    overflow: hidden;
}

.preview-header {
    background: #3498db;
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-label {
    font-weight: 600;
}

.preview-keyword {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.preview-title-bar {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.preview-title-bar h3 {
    color: #2c3e50;
    font-size: 1.25rem;
}

.preview-content {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    background: white;
}

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content h2, .preview-content h3 {
    margin: 1.5rem 0 0.75rem;
    color: #2c3e50;
}

.preview-placeholder {
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.logs-container {
    max-height: 250px;
    overflow-y: auto;
    background: #2c3e50;
    border-radius: 8px;
    padding: 1rem;
}

.logs {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
}

.log-entry {
    color: #ecf0f1;
    padding: 0.25rem 0;
    border-bottom: 1px solid #34495e;
}

.results-summary {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.result-stat {
    flex: 1;
    text-align: center;
    padding: 1.5rem;
    border-radius: 8px;
}

.result-stat.success {
    background: #e8f8f0;
}

.result-stat.error {
    background: #fef3e6;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
}

.result-stat.success .stat-number {
    color: #27ae60;
}

.result-stat.error .stat-number {
    color: #e74c3c;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: #ffffff;
    padding: 0.75rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    justify-content: center;
    border: 1px solid #f1f5f9;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.nav-link svg {
    opacity: 0.8;
    transition: transform 0.4s ease;
}

.nav-link:hover {
    color: #2563eb !important;
    background: #eff6ff;
    border-color: #3b82f6;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.1);
    text-decoration: none !important;
}

.nav-link:hover svg {
    transform: rotate(5deg) scale(1.1);
}

.nav-link.active {
    color: white !important;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    box-shadow: 0 6px 12px -3px rgba(59, 130, 246, 0.4);
    border: none;
}

.nav-link.active svg {
    opacity: 1;
}

.history-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-box.success {
    background: #e8f8f0;
}

.stat-box.success .stat-number {
    color: #27ae60;
}

.stat-box.error {
    background: #fef3e6;
}

.stat-box.error .stat-number {
    color: #e74c3c;
}

.history-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #ecf0f1;
    background: white;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.filter-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .switchboard {
        flex-direction: column;
        align-items: stretch;
    }
    
    .client-dropdown {
        width: 100%;
    }
    
    .progress-steps {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .results-summary {
        flex-direction: column;
        gap: 1rem;
    }
}
