/* Dashboard Interactive Styles */

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #1a1f2e;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-content.large {
    max-width: 1200px;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #f87171;
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.stat-card h3 {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #e1e8ed;
    margin-bottom: 8px;
}

.stat-change {
    color: #10b981;
    font-size: 14px;
}

/* Iterations Grid */
.iterations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.iteration-card {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.iteration-card:hover {
    transform: translateY(-4px);
}

.iteration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.complete {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-badge.in-progress {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.iteration-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.iteration-stats .stat {
    display: flex;
    flex-direction: column;
}

.iteration-stats .label {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 4px;
}

.iteration-stats .value {
    color: #e1e8ed;
    font-size: 16px;
    font-weight: 600;
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
    transition: width 1s ease;
}

.progress-bar.error .progress-fill {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Agent Cards */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.agent-card {
    cursor: pointer;
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.active {
    background: #10b981;
}

.status-indicator.idle {
    background: #fbbf24;
}

.status-indicator.stopped {
    background: #ef4444;
}

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

.agent-info .role {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 12px;
}

.agent-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* Knowledge Base */
.kb-search {
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e1e8ed;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.kb-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.kb-section h3 {
    margin-bottom: 16px;
    color: #e1e8ed;
}

.kb-categories {
    display: grid;
    gap: 12px;
}

.kb-category {
    cursor: pointer;
    padding: 16px;
    transition: transform 0.3s ease;
}

.kb-category:hover {
    transform: translateX(4px);
}

.category-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.category-name {
    color: #e1e8ed;
    font-weight: 500;
}

.category-count {
    color: #3b82f6;
    font-weight: 600;
}

.category-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

/* Entity Viewer */
.entity-viewer {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

.entity-list {
    max-height: 500px;
    overflow-y: auto;
}

.entity-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.entity-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.entity-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.entity-id {
    color: #3b82f6;
    font-size: 12px;
    font-weight: 600;
}

.entity-type {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.entity-content h4 {
    color: #e1e8ed;
    margin-bottom: 4px;
}

.entity-content p {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 8px;
}

.entity-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #64748b;
}

.entity-detail {
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.detail-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-tabs .tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s ease;
}

.detail-tabs .tab.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.code-block {
    background: #0a0e1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    color: #10b981;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    overflow-x: auto;
}

/* S3 Browser */
.s3-browser {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 20px;
}

.s3-path {
    background: #0a0e1a;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    color: #3b82f6;
    font-family: monospace;
}

.s3-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.s3-folder {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.s3-folder:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.folder-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.folder-name {
    color: #e1e8ed;
    font-weight: 500;
    margin-bottom: 4px;
}

.folder-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #64748b;
}

.file-grid {
    display: grid;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.file-icon {
    font-size: 24px;
}

.file-name {
    flex: 1;
    color: #e1e8ed;
    font-weight: 500;
}

.file-size {
    color: #94a3b8;
    font-size: 13px;
}

/* Log Viewer */
.log-viewer {
    background: #0a0e1a;
    border-radius: 8px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
}

.log-entry {
    padding: 4px 0;
    border-left: 3px solid;
    padding-left: 12px;
    margin-bottom: 4px;
}

.log-entry.info {
    border-color: #3b82f6;
    color: #93c5fd;
}

.log-entry.success {
    border-color: #10b981;
    color: #86efac;
}

.log-entry.warning {
    border-color: #fbbf24;
    color: #fde68a;
}

.log-entry.error {
    border-color: #ef4444;
    color: #fca5a5;
}

/* Activity List */
.recent-activity {
    margin-top: 32px;
}

.activity-list {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 16px;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-left: 3px solid;
    margin-bottom: 8px;
}

.activity-item.info {
    border-color: #3b82f6;
}

.activity-item.success {
    border-color: #10b981;
}

.activity-item.warning {
    border-color: #fbbf24;
}

.activity-item.error {
    border-color: #ef4444;
}

.activity-time {
    color: #64748b;
    font-size: 12px;
}

.activity-action {
    color: #e1e8ed;
}

/* Pipeline Flow */
.pipeline-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.pipeline-stage {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
}

.pipeline-arrow {
    color: #64748b;
    font-size: 20px;
}

/* Button Variations */
.btn-modern.small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-modern.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.btn-modern.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #e1e8ed;
}

/* Config Grid */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.config-item {
    display: flex;
    flex-direction: column;
}

.config-item label {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 4px;
}

.config-item input,
.config-item select {
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e1e8ed;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.metric-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.metric-label {
    display: block;
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 8px;
}

.metric-value {
    display: block;
    color: #e1e8ed;
    font-size: 24px;
    font-weight: 700;
}

/* Chart Container */
.chart-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.chart-section h2 {
    margin-bottom: 20px;
    color: #e1e8ed;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}