/* WaaS Self-Service Portal - Custom Styles */

/* Root variables */
:root {
    --waas-primary: #0d6efd;
    --waas-sidebar-bg: #212529;
    --waas-sidebar-width: 260px;
}

/* Body */
body {
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* Main content offset for fixed-top navbar */
.main-content {
    padding-top: 70px;
}

/* Navbar */
.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.2s ease;
}

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

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.table td {
    vertical-align: middle;
}

/* Dashboard stat cards */
.card .display-4 {
    font-size: 2.5rem;
}

/* Login page */
.login-container {
    max-width: 420px;
    margin: 0 auto;
}

/* Flash messages */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* Code blocks in tables */
td code, th code {
    background-color: #f1f3f5;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.85em;
}

/* Badge adjustments */
.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Collapsible raw data sections */
pre code {
    font-size: 0.8rem;
    color: #333;
}

/* Responsive adjustments */
@media (max-width: 575.98px) {
    .card .display-4 {
        font-size: 1.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .table-responsive {
        font-size: 0.8rem;
    }

    .table td, .table th {
        padding: 0.35rem 0.5rem;
    }

    .btn, .form-control, .form-select {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 38px;
    }

    h2 {
        font-size: 1.4rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .card .display-4 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Filter input widths (responsive replacement for inline styles) */
.filter-ip-input {
    width: 160px;
}

.filter-perpage-select {
    width: 80px;
}

@media (max-width: 575.98px) {
    .filter-ip-input,
    .filter-perpage-select {
        width: 100%;
    }
}

/* Footer spacing */
body > .container {
    padding-bottom: 2rem;
}

/* Breadcrumbs */
.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

/* Smooth transitions */
a, .btn {
    transition: all 0.15s ease-in-out;
}

/* Toast Notifications */
.toast-container .toast {
    min-width: 300px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
}

.toast-success {
    background-color: #198754 !important;
    color: #fff;
}

.toast-danger {
    background-color: #dc3545 !important;
    color: #fff;
}

.toast-warning {
    background-color: #ffc107 !important;
    color: #212529;
}

.toast-warning .btn-close-white {
    filter: none;
}

.toast-info {
    background-color: #0dcaf0 !important;
    color: #212529;
}

.toast-info .btn-close-white {
    filter: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-overlay.d-none {
    display: none !important;
}

/* Diff Preview */
.diff-preview {
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.82rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.diff-preview > div {
    padding: 2px 6px;
    border-radius: 2px;
    margin-bottom: 1px;
}

.diff-added {
    background-color: #d4edda;
}

.diff-modified {
    background-color: #fff3cd;
}

.diff-removed {
    background-color: #f8d7da;
}

/* Inline Edit Fields (Phase 8) */
.inline-edit-field {
    display: inline-block;
    width: 120px;
    padding: 0.15rem 0.4rem;
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    background: #fff;
    transition: border-color 0.15s ease;
}

.inline-edit-field:focus {
    border-color: var(--waas-primary);
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

.field-status {
    display: inline-block;
    min-width: 20px;
    font-size: 0.85rem;
    vertical-align: middle;
}

.field-status .spinner-border-sm {
    width: 0.85rem;
    height: 0.85rem;
}

/* Text truncation utility */
.text-truncate-custom {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

/* ===== Dark Mode Overrides ===== */
[data-bs-theme="dark"] body {
    background-color: #1a1d21;
}

[data-bs-theme="dark"] .card-header {
    background-color: #2b3035;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .table th {
    color: #adb5bd;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #2b3035;
    --bs-table-border-color: #373b3e;
    color: #dee2e6;
}

[data-bs-theme="dark"] td code,
[data-bs-theme="dark"] th code {
    background-color: #2b3035;
    color: #e9ecef;
}

[data-bs-theme="dark"] pre code {
    color: #e9ecef;
}

[data-bs-theme="dark"] pre.bg-light {
    background-color: #212529 !important;
    color: #e9ecef;
    border: 1px solid #373b3e;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #2b3035 !important;
}

[data-bs-theme="dark"] .diff-added {
    background-color: #1e3a2f;
    color: #a3d9a5;
}

[data-bs-theme="dark"] .diff-modified {
    background-color: #3a351e;
    color: #ffe08a;
}

[data-bs-theme="dark"] .diff-removed {
    background-color: #3a1e1e;
    color: #f5a5a5;
}

[data-bs-theme="dark"] .diff-preview {
    border-color: #373b3e;
}

[data-bs-theme="dark"] .inline-edit-field {
    background: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .footer,
[data-bs-theme="dark"] footer.bg-light {
    background-color: #212529 !important;
    border-top-color: #373b3e !important;
}

[data-bs-theme="dark"] .card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(0, 0, 0, 0.7);
}