/* Custom styles for Newsbase Manager */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --secondary-color: #6c757d;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

/* General layout improvements */
body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

/* Card enhancements */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Stats cards */
.card.bg-primary,
.card.bg-success,
.card.bg-warning,
.card.bg-danger {
    border: none;
}

/* System Health Warnings */
.alert {
    border-radius: 0.75rem;
    border: none;
}

.alert.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.alert.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* Orphaned Containers Modal */
.modal-lg {
    max-width: 900px;
}

.table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Container status badges */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

/* Button improvements */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-group-sm > .btn,
.btn-sm {
    border-radius: 0.375rem;
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.775rem;
    border-radius: 0.375rem;
}

.btn-outline-success:hover {
    color: #fff;
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-outline-danger:hover {
    color: #fff;
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

/* Table improvements */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
    background-color: var(--light-color);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

/* Modal improvements */
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.75rem 0.75rem 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* Modal table overflow handling */
.modal-body .table {
    table-layout: fixed;
    word-wrap: break-word;
}

.modal-body .table td {
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: break-word;
}

.modal-body .table td:first-child {
    width: 30%;
    font-weight: 600;
}

.modal-body .table td:last-child {
    width: 70%;
}

/* Specific handling for long content */
.text-breakable {
    word-break: break-all;
    overflow-wrap: break-word;
}

.container-id {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    background-color: var(--light-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
}

.url-link {
    word-break: break-all;
    overflow-wrap: break-word;
}

/* Configuration display */
.config-display {
    max-height: 300px;
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
    font-size: 0.875rem;
    background-color: var(--light-color);
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.status-active::before {
    background-color: var(--success-color);
}

.status-indicator.status-inactive::before {
    background-color: var(--secondary-color);
}

.status-indicator.status-deploying::before {
    background-color: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-indicator.status-error::before {
    background-color: var(--danger-color);
}

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

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Alert improvements */
.alert {
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

/* Logs display */
.logs-container {
    max-height: 500px;
    overflow-y: auto;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 4px;
}

.logs-container pre {
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0;
}

#logsContent {
    background-color: #1e1e1e !important;
    color: #f8f9fa !important;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
    padding: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: none;
}

/* Ensure logs modal has proper contrast */
#logsModal .modal-body {
    padding: 0;
}

#logsModal .modal-body > .mb-3 {
    padding: 15px 15px 0 15px;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-group-sm > .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
}

@media (max-width: 576px) {
    .modal-footer .btn-group {
        width: 100%;
    }
    
    .modal-footer .btn-group .btn {
        flex: 1;
        min-width: 0;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Utility classes */
.text-nowrap {
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.border-radius-lg {
    border-radius: 0.75rem !important;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* General overflow safety for long content */
.text-truncate-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Ensure buttons don't overflow in modals */
.modal-footer .btn-group {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Code elements styling */
code {
    background-color: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

/* Health status indicators */
.health-status-good {
    color: var(--success-color);
}

.health-status-warning {
    color: var(--warning-color);
}

.health-status-error {
    color: var(--danger-color);
}
