/*
 * ODR-DabMux Configuration Editor CSS
 * Professional styling for the DAB multiplexer configuration interface
 */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Body and layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
}

.navbar-nav .nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background-color: #fff;
    border-radius: 50%;
}

/* Main content sections */
.config-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.config-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section headers */
.section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    color: var(--dark-color);
    font-weight: 600;
    margin: 0;
}

.section-header p {
    color: var(--secondary-color);
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem var(--shadow-color);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--dark-color);
}

/* Statistics cards */
.stat-card {
    height: 100%;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.stat-card .card-subtitle {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.7;
}

/* Service, subchannel, and component cards */
.service-card,
.subchannel-card,
.component-card {
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.service-card:hover,
.subchannel-card:hover,
.component-card:hover {
    border-left-color: var(--success-color);
}

.service-card .card-header,
.subchannel-card .card-header,
.component-card .card-header {
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
}

/* Enhanced service card styling */
.service-card-enhanced {
    border-left: 4px solid #0d6efd;
    transition: all 0.3s ease;
}

.service-card-enhanced:hover {
    border-left-color: #198754;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.service-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* Technical info styling */
.service-technical-info {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-top: 1rem;
}

.technical-param {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid #dee2e6;
}

.technical-param:last-child {
    border-bottom: none;
}

.param-label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.875rem;
}

.param-value {
    font-weight: 600;
    color: #212529;
    font-size: 0.875rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Form controls */
.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-control.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.8-.8-.8-.8-1.4.7-1.1-1.4L0 4.3l1.1 1.4 1.2.03z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4M8.2 4.6l-2.4 2.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.form-text {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #146c43 100%);
    box-shadow: 0 2px 4px rgba(25, 135, 84, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(25, 135, 84, 0.4);
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-danger {
    border-width: 2px;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Configuration preview */
.config-preview {
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    border-radius: 0.5rem;
    padding: 1.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.config-preview::-webkit-scrollbar {
    width: 8px;
}

.config-preview::-webkit-scrollbar-track {
    background: #2d2d30;
    border-radius: 4px;
}

.config-preview::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.config-preview::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Modals */
.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    background-color: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 1rem 1rem 0 0;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--dark-color);
}

/* Toast notifications */
.toast {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.toast-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.5rem 0.5rem 0 0;
}

.toast.bg-danger .toast-header {
    background-color: var(--danger-color);
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
    
    .config-preview {
        font-size: 0.75rem;
        max-height: 300px;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
    
    .btn-group .btn {
        padding: 0.375rem 0.5rem;
    }
    
    /* Additional responsive styles from editor2.txt */
    .service-technical-info {
        padding: 0.75rem;
    }
    
    .technical-param {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
        padding-bottom: 0.5rem;
    }
    
    .stat-card .card-body {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .modal,
    .toast-container {
        display: none !important;
    }
    
    .config-section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        break-inside: avoid;
    }
    
    .config-preview {
        background: white;
        color: black;
        border: 1px solid var(--border-color);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--dark-color);
    }
    
    .btn-outline-primary,
    .btn-outline-success,
    .btn-outline-danger {
        border-width: 3px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #2d3748;
        --dark-color: #f7fafc;
        --border-color: #4a5568;
        --shadow-color: rgba(0, 0, 0, 0.3);
    }
    
    body {
        background-color: #1a202c;
        color: var(--dark-color);
    }
    
    .card {
        background-color: var(--light-color);
        color: var(--dark-color);
    }
    
    .config-preview {
        background: #0d1117;
        color: #c9d1d9;
    }
}

/* CDSP Badge Styling */
.badge.bg-warning {
    background-color: #ff8c00 !important;
    color: #000;
    font-weight: 600;
    border: 1px solid #cc7000;
}

.badge.bg-warning:hover {
    background-color: #cc7000 !important;
    color: #fff;
}

/* Service status badges alignment */
.service-status {
    white-space: nowrap;
}

/* Enhanced badge spacing */
.service-card-enhanced .card-header .badge {
    margin-left: 0.25rem;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}