/* InfaNeer - Host Inventory Styles */

/* Page Layout */
.inventory-content {
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title h1 {
    margin: 0 0 4px 0;
    font-size: 24px;
    font-weight: 600;
}

.page-title p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Filters Section */
.filters-section {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-color);
    border-radius: 8px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    min-width: 180px;
    background: white;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-stats {
    margin-left: auto;
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.filter-stats span {
    padding: 4px 12px;
    background: var(--bg-color);
    border-radius: 20px;
}

/* Hosts Table */
.hosts-table-container {
    background: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.hosts-table th,
.hosts-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.hosts-table th {
    background: var(--background-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.hosts-table tbody tr {
    background: var(--surface-color);
}

.hosts-table tbody tr:hover {
    background: var(--surface-hover);
}

.hosts-table tbody tr:last-child td {
    border-bottom: none;
}

.hostname-cell strong {
    color: var(--text-primary);
}

.hostname-cell .visible-name {
    color: var(--text-secondary);
    font-size: 12px;
}

.groups-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-left: 8px;
}

.actions-cell .btn:first-child {
    margin-left: 0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-neutral {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
}

.status-indicator.enabled::before {
    background: #22c55e;
}

.status-indicator.disabled::before {
    background: #ef4444;
}

/* Loading State */
.loading-row td {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-row td {
    text-align: center;
    padding: 40px;
}

.error-text {
    color: var(--error-color);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.empty-state svg {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
}

/* Modal Enhancements */
.modal-large {
    max-width: 800px;
    width: 95%;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.form-section-description {
    margin: -8px 0 16px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-item label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item span {
    font-size: 14px;
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Alerts Summary */
.alerts-summary {
    background: var(--surface-color);
    border-radius: 6px;
    padding: 12px;
}

.alerts-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.alert-total {
    font-weight: 500;
    margin-right: 8px;
}

.alert-severity {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.alert-severity.warning { background: #fef3c7; color: #92400e; }
.alert-severity.average { background: #fed7aa; color: #c2410c; }
.alert-severity.high { background: #fecaca; color: #991b1b; }
.alert-severity.disaster { background: #fca5a5; color: #7f1d1d; }
.alert-severity.information { background: #dbeafe; color: #1e40af; }

.recent-problems ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.recent-problems li {
    margin: 4px 0;
    font-size: 13px;
}

.recent-problems small {
    color: var(--text-secondary);
}

.no-alerts {
    color: var(--text-secondary);
    font-style: italic;
}

/* Context View */
.context-view {
    padding: 8px 0;
}

.context-section {
    margin-bottom: 24px;
}

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

.context-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.context-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.context-item.full-width {
    grid-column: 1 / -1;
}

.context-item label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.context-item span {
    font-size: 14px;
    color: var(--text-primary);
}

.context-item .notes-text {
    white-space: pre-wrap;
    background: var(--surface-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.criticality-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.criticality-badge.critical {
    background: #fee2e2;
    color: #991b1b;
}

.criticality-badge.high {
    background: #fed7aa;
    color: #c2410c;
}

.criticality-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.criticality-badge.low {
    background: #dcfce7;
    color: #166534;
}

/* Alerts List in Context View */
.alerts-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

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

.alert-item.problem {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.alert-item.resolved {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.alert-name {
    flex: 1;
    font-weight: 500;
}

.alert-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.alert-meta .severity {
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--surface-color);
}

.alert-meta .status {
    font-weight: 500;
}

.alert-item.problem .alert-meta .status {
    color: #dc2626;
}

.alert-item.resolved .alert-meta .status {
    color: #16a34a;
}

/* Toast Styles */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    background: #1f2937;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: #059669;
}

.toast-error {
    background: #dc2626;
}

.toast-info {
    background: #2563eb;
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Sync Status */
.status.syncing {
    color: var(--primary-color);
}

.status.syncing::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

.status.success {
    color: #16a34a;
}

.status.error {
    color: #dc2626;
}

/* Button Enhancements */
.btn svg {
    vertical-align: middle;
    margin-right: 6px;
}

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

/* Scheduler Section */
.scheduler-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

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

.scheduler-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.scheduler-title svg {
    color: var(--text-secondary);
}

.scheduler-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.scheduler-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
}

.scheduler-status .status-dot.enabled {
    background: #22c55e;
    animation: pulse 2s infinite;
}

.scheduler-status .status-dot.disabled {
    background: #9ca3af;
}

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

.scheduler-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.scheduler-config {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.scheduler-config select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.scheduler-info {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.scheduler-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.scheduler-buttons .btn-small {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Activity Log Section */
.activity-log-section {
    margin-top: 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

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

.log-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.log-title svg {
    color: var(--text-secondary);
}

.log-count {
    font-weight: normal;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--surface-hover);
    padding: 2px 8px;
    border-radius: 10px;
}

.log-actions {
    display: flex;
    gap: 8px;
}

.log-container {
    max-height: 200px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.log-container.expanded {
    max-height: 500px;
}

.log-entries {
    padding: 8px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
}

.log-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

.log-entry {
    display: flex;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
    background: var(--background-color);
}

.log-entry:hover {
    background: var(--surface-hover);
}

.log-time {
    color: var(--text-muted);
    flex-shrink: 0;
    width: 80px;
}

.log-level {
    flex-shrink: 0;
    width: 50px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
}

.log-level.info {
    color: #60a5fa;
}

.log-level.success {
    color: #34d399;
}

.log-level.warning {
    color: #fbbf24;
}

.log-level.error {
    color: #f87171;
}

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

.log-details {
    color: var(--text-secondary);
    font-size: 11px;
    margin-left: 138px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-top: 4px;
    margin-bottom: 8px;
}

/* Credentials Cell */
.creds-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-tiny {
    padding: 4px 6px;
    font-size: 11px;
    line-height: 1;
}

.btn-tiny svg {
    margin-right: 0;
}

/* Credentials Modal Styles */
.cred-host-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--background-color);
    border-radius: 8px;
    margin-bottom: 20px;
}

.cred-hostname {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.cred-ip {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 4px 10px;
    background: var(--surface-hover);
    border-radius: 4px;
}

/* Credentials Status */
.cred-status-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: var(--text-secondary);
}

.cred-status-error {
    padding: 16px;
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

.cred-status-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cred-status-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cred-status-item.has-cred {
    border-color: rgba(34, 197, 94, 0.3);
}

.cred-type-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    border-radius: 8px;
}

.cred-type-icon svg {
    color: var(--text-secondary);
}

.cred-status-item.has-cred .cred-type-icon {
    background: rgba(34, 197, 94, 0.15);
}

.cred-status-item.has-cred .cred-type-icon svg {
    color: #4ade80;
}

.cred-type-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cred-type-info strong {
    font-size: 14px;
    color: var(--text-primary);
}

.cred-user {
    font-size: 12px;
    color: var(--text-secondary);
}

.no-cred-text {
    font-size: 12px;
    color: var(--text-muted);
}

.cred-status-badge {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
}

.cred-status-badge.exists {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.cred-status-badge.missing {
    background: var(--surface-hover);
    color: var(--text-muted);
}

/* Credential Tabs */
.cred-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.cred-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-color);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

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

.cred-tab svg {
    width: 16px;
    height: 16px;
}

/* Credential Forms */
.cred-form {
    background: var(--background-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cred-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.password-input-group {
    display: flex;
    gap: 8px;
}

.password-input-group input {
    flex: 1;
}

/* Test Results */
.test-results {
    margin-top: 16px;
    background: var(--background-color);
    border-radius: 8px;
    padding: 16px;
}

.test-results h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.test-result {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.test-result:last-child {
    margin-bottom: 0;
}

.test-result svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.test-result.test-success {
    background: rgba(34, 197, 94, 0.1);
}

.test-result.test-success svg {
    color: #4ade80;
}

.test-result.test-fail {
    background: rgba(239, 68, 68, 0.1);
}

.test-result.test-fail svg {
    color: #f87171;
}

.test-result.test-warning {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.test-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.test-info strong {
    font-size: 13px;
    color: var(--text-primary);
}

.test-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.test-info small {
    font-size: 11px;
    color: var(--text-muted);
}

/* Delete Button */
.btn-danger {
    color: var(--error-color);
    border-color: var(--error-color);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Loading Spinner Small */
.loading-spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
    }

    .filters-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group input,
    .filter-group select {
        min-width: 100%;
    }

    .filter-stats {
        margin-left: 0;
        margin-top: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .context-grid {
        grid-template-columns: 1fr;
    }

    .hosts-table {
        font-size: 13px;
    }

    .hosts-table th,
    .hosts-table td {
        padding: 8px;
    }
}
