/* InfaNeer Health Dashboard - Styles */

/* Dashboard Container */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.nav-tabs {
    display: flex;
    gap: 8px;
}

.nav-tab {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-tab:hover {
    background: var(--surface-color);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--primary-color);
    color: white;
}

/* Dashboard Content */
.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* Network Diagram Section */
.diagram-section {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border-color);
}

.diagram-section h2 {
    margin-bottom: 30px;
    text-align: center;
}

.network-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
}

/* Diagram Rows */
.diagram-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    width: 100%;
}

.diagram-row.services {
    gap: 30px;
}

.diagram-row.targets {
    margin-top: 10px;
}

/* Service Nodes */
.service-node {
    background: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    min-width: 140px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.service-node:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
}

.service-node.primary {
    min-width: 200px;
    padding: 25px;
    border-width: 3px;
    background: linear-gradient(135deg, var(--background-color) 0%, rgba(37, 99, 235, 0.1) 100%);
}

.service-node.connected {
    border-color: var(--success-color);
}

.service-node.error {
    border-color: var(--error-color);
}

.service-node.warning {
    border-color: var(--warning-color);
}

.node-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background: var(--surface-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.node-icon svg {
    width: 100%;
    height: 100%;
    color: var(--primary-color);
}

.node-icon.ai-icon svg {
    color: #a855f7;
}

.service-node.connected .node-icon {
    background: rgba(16, 185, 129, 0.2);
}

.service-node.connected .node-icon svg {
    color: var(--success-color);
}

.service-node.error .node-icon {
    background: rgba(239, 68, 68, 0.2);
}

.service-node.error .node-icon svg {
    color: var(--error-color);
}

.node-label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

.node-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.service-node.connected .status-dot {
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.service-node.error .status-dot {
    background: var(--error-color);
    box-shadow: 0 0 8px var(--error-color);
}

.service-node.warning .status-dot {
    background: var(--warning-color);
    box-shadow: 0 0 8px var(--warning-color);
}

.node-details {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Connection Lines */
.connection-line {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.connection-line.vertical {
    width: 3px;
    height: 40px;
    background: linear-gradient(to bottom, var(--border-color), var(--primary-color), var(--border-color));
}

.connection-line.servers-line {
    height: 30px;
    margin-top: 10px;
}

.connection-group {
    display: flex;
    justify-content: center;
    gap: 80px;
    width: 100%;
    height: 50px;
    position: relative;
}

.connection-group .connection-line {
    width: 3px;
    height: 50px;
    background: linear-gradient(to bottom, var(--primary-color), var(--border-color));
}

.line-pulse {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse-flow 2s infinite;
}

@keyframes pulse-flow {
    0% { top: 0; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.line-label {
    position: absolute;
    left: 12px;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    background: var(--surface-color);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Server Groups */
.server-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--background-color);
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 14px;
}

.server-icon {
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: 8px;
}

.server-icon.linux {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.server-icon.windows {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.server-icon svg {
    width: 100%;
    height: 100%;
}

/* Status Cards Section */
.status-section {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border-color);
}

.status-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.status-card {
    background: var(--background-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.status-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--surface-hover);
}

.card-status.connected {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.card-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.card-status.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.card-body {
    padding: 16px 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.card-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--surface-hover);
    border-color: var(--primary-color);
}

.btn-small.btn-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-small.btn-edit {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-small.btn-edit:hover {
    background: var(--primary-color);
    color: white;
}

/* Activity Section */
.activity-section {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border-color);
}

.section-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-header-actions .btn-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.last-updated {
    font-size: 13px;
    color: var(--text-muted);
}

.activity-log {
    max-height: 300px;
    overflow-y: auto;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item.success {
    border-left: 3px solid var(--success-color);
}

.activity-item.error {
    border-left: 3px solid var(--error-color);
}

.activity-item.warning {
    border-left: 3px solid var(--warning-color);
}

.activity-item.info {
    border-left: 3px solid var(--primary-color);
}

.activity-time {
    color: var(--text-muted);
    min-width: 60px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

.activity-action {
    color: var(--primary-color);
    font-weight: 500;
    min-width: 120px;
}

.activity-message {
    color: var(--text-primary);
    flex: 1;
}

/* Footer */
.dashboard-footer {
    margin-top: auto;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-body ol {
    margin: 15px 0;
    padding-left: 20px;
}

.modal-body li {
    margin: 8px 0;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* Wide and Large Modal Variants */
.modal-content.modal-wide {
    max-width: 600px;
}

.modal-content.modal-large {
    max-width: 900px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-large .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Form Groups in Modals */
.modal .form-group {
    margin-bottom: 16px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal .form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 14px;
}

.modal .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.modal .form-group .hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.form-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

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

/* Live Logs Container */
.live-logs-container {
    flex: 1;
    overflow-y: auto;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.error {
    background: rgba(239, 68, 68, 0.1);
}

.log-entry.warning {
    background: rgba(245, 158, 11, 0.1);
}

.log-time {
    color: var(--text-muted);
    min-width: 75px;
}

.log-level {
    min-width: 55px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-entry.info .log-level {
    color: var(--primary-color);
}

.log-entry.success .log-level {
    color: var(--success-color);
}

.log-entry.warning .log-level {
    color: var(--warning-color);
}

.log-entry.error .log-level {
    color: var(--error-color);
}

.log-action {
    color: var(--text-secondary);
    min-width: 150px;
    font-weight: 500;
}

.log-message {
    color: var(--text-primary);
    flex: 1;
    word-break: break-word;
}

.log-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-muted);
}

.modal-large .modal-footer {
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 1024px) {
    .diagram-row.services {
        flex-wrap: wrap;
    }

    .connection-group {
        display: none;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-tabs {
        width: 100%;
        justify-content: center;
    }

    .service-node {
        min-width: 100px;
        padding: 15px;
    }

    .node-icon {
        width: 36px;
        height: 36px;
    }
}

/* Error Details Modal */
.error-details {
    text-align: left;
}

.error-details h3 {
    margin: 0 0 20px 0;
    color: var(--error-color, #ef4444);
    font-size: 18px;
}

.error-details h4 {
    margin: 20px 0 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error-details p {
    margin: 8px 0;
    font-size: 14px;
}

.error-details .error-text {
    color: var(--error-color, #ef4444);
}

.error-details .dns-info,
.error-details .attempt-info,
.error-details .troubleshooting {
    background: var(--surface-color, #f8f9fa);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.error-details ul,
.error-details ol {
    margin: 0;
    padding-left: 20px;
}

.error-details li {
    font-size: 13px;
    margin: 6px 0;
    line-height: 1.5;
}

.error-details .attempt-info li {
    font-family: var(--font-mono, monospace);
    word-break: break-word;
}

.error-details .troubleshooting li {
    color: var(--text-secondary);
}

/* Setup Required Banner */
.setup-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.banner-content svg {
    flex-shrink: 0;
}

.banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.banner-text strong {
    font-size: 16px;
    font-weight: 600;
}

.banner-text span {
    font-size: 14px;
    opacity: 0.9;
}

.setup-banner .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    flex-shrink: 0;
}

.setup-banner .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-small {
    padding: 6px 12px !important;
    font-size: 13px !important;
}

/* System Card Styles */
.status-card-wide {
    grid-column: span 2;
}

@media (max-width: 1200px) {
    .status-card-wide {
        grid-column: span 1;
    }
}

.system-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .system-columns {
        grid-template-columns: 1fr;
    }
}

.system-column h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.container-list, .volume-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.container-item, .volume-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-color);
    border-radius: 6px;
    font-size: 13px;
}

.container-item.running {
    border-left: 3px solid #22c55e;
}

.container-item.stopped {
    border-left: 3px solid #ef4444;
}

.container-name, .volume-name {
    font-weight: 500;
    flex: 1;
}

.container-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin: 0 8px;
}

.container-item.running .container-status {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.container-item.stopped .container-status {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.container-size, .volume-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.storage-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.storage-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.storage-label {
    color: var(--text-secondary);
}

.storage-value {
    font-weight: 500;
}

.storage-bar {
    height: 8px;
    background: var(--surface-color);
    border-radius: 4px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.storage-percent {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.workflow-count {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.version-badge {
    font-size: 12px;
    padding: 4px 8px;
    background: var(--surface-color);
    border-radius: 4px;
    color: var(--text-secondary);
}

.no-data, .loading-text {
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}
