/* custom.css */

:root {
    --surface-bg: #1e1e1e;
    --surface-muted: #252525;
    --surface-border: #333;
    --surface-border-strong: #444;
    --site-row-selected: rgba(255,255,255,0.06);
    --site-row-hover: rgba(255,255,255,0.03);
}

/* Base Styles */
body {
    background-color: #121212 !important; /* Dark background */
    color: #e0e0e0 !important;            /* Light text */
    font-family: "Figtree", sans-serif;
    font-size: 0.875rem; /* Downscale base font size */
    margin: 0; /* Remove default margin */
    padding: 0; /* Remove default padding */
}

/* Links */
a {
    color: #bb86fc;
}
a:hover {
    color: #9a67ea;
}

/* Navigation Bar */
.navbar, .navbar-dark {
    background-color: #1f1f1f !important;
    width: 100%; /* Ensure navbar extends to full width */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Add shadow for depth */
}
.navbar-brand {
    color: #e0e0e0 !important;
    font-weight: bold; /* Make logo text bold */
}
.navbar-toggler {
    border-color: #e0e0e0 !important;
}
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba%28255, 255, 255, 0.5%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E") !important;
}
.nav-link {
    color: #e0e0e0 !important;
    font-size: 0.875rem; /* Ensure consistent font size */
    padding: 0.5rem 1rem; /* Ensure consistent padding */
    display: flex;
    align-items: center; /* Align items vertically */
    transition: color 0.3s ease; /* Smooth color transition */
}
.nav-link:hover {
    color: #bb86fc !important;
}
.dropdown-menu {
    background-color: #1f1f1f !important;
    border-color: #333 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Add shadow for depth */
}
.dropdown-item {
    color: #e0e0e0 !important;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
}
.dropdown-item:hover {
    background-color: #2c2c2c !important;
    color: #bb86fc !important;
}
.dropdown-divider {
    border-color: #444 !important;
}

/* Containers */
.container, .card, .modal-content, .bg-white {
    background-color: #1e1e1e !important;
    border: 1px solid #333;
    color: #e0e0e0;
    margin-left: 1px !important;
    margin-right: 1px !important;
    padding-left: 1px !important;
    padding-right: 1px !important;
    width: calc(100% - 2px) !important; /* Ensure container is 1px from both sides */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

/* Card Component */
.card {
    border-radius: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Buttons */
.btn-primary {
    background-color: #bb86fc;
    border-color: #bb86fc;
    color: #121212;
}
.btn-primary:hover, 
.btn-primary:focus {
    background-color: #9a67ea;
    border-color: #9a67ea;
}

/* Form Inputs */
.form-control {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
    font-size: 0.875rem; /* Downscale form input font size */
}
.form-select {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
    font-size: 0.875rem;
}
.form-select option[value=""] {
    color: #9e9e9e !important;
}
.form-select option {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
}
.form-select:focus {
    border-color: #bb86fc !important;
    box-shadow: none !important;
}
.form-control:focus {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border-color: #bb86fc;
}
/* Disabled form elements (dark theme) */
.form-control:disabled, .form-control[readonly], .form-select:disabled {
    background-color: #2c2c2c !important;
    color: #9e9e9e !important;
    border-color: #444 !important;
    opacity: 1 !important; /* prevent Bootstrap from lowering opacity */
}
.form-control:disabled::placeholder { color: #7d7d7d !important; }
#customers-table input[disabled], #customers-table select[disabled] {
    background-color: #2c2c2c !important;
    color: #9e9e9e !important;
    border-color: #444 !important;
}
.btn-outline-light {
    color: #e0e0e0;
    border-color: #e0e0e0;
}
.btn-outline-light:hover {
    color: #bb86fc;
    border-color: #bb86fc;
}

/* Select2 */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background-color: #2c2c2c !important;
    border: 1px solid #444 !important;
    color: #e0e0e0 !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #e0e0e0 !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9e9e9e !important;
}
.select2-dropdown {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
}
.select2-container--default .select2-results__option {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
}
.select2-container--default .select2-results__option--highlighted {
    background-color: #3a3a3a !important;
    color: #ffffff !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #252525 !important;
    border: 1px solid #444 !important;
    color: #e0e0e0 !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #444;
    border: 1px solid #444;
    color: #e0e0e0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #e0e0e0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #bb86fc;
}

/* Headings */
h1 {
    font-size: 1.75rem; /* Downscale heading font sizes */
}
h2 {
    font-size: 1.5rem;
}
h3 {
    font-size: 1.25rem;
}
h4 {
    font-size: 1rem;
}
h5 {
    font-size: 0.875rem;
}
h6 {
    font-size: 0.75rem;
}

/* Footer (if applicable) */
.footer {
    background-color: #1f1f1f;
    color: #888;
}

/* Utility Classes */
.bg-dark-custom {
    background-color: #121212 !important;
}
.text-light-custom {
    color: #e0e0e0 !important;
}

/* Table */
.table {
    color: #e0e0e0; /* Ensure table text is white */
    border-collapse: separate;
    border-spacing: 0 0.5rem; /* Add spacing between rows */
    font-size: 0.8rem; /* Significantly smaller font size for table */
}
.table th {
    background-color: #2c2c2c; /* Darker background for header */
    text-transform: uppercase; /* Uppercase text */
    font-weight: bold; /* Bold text */
    font-size: 0.8rem; /* Slightly larger font size for table headings */
}
.table td {
    font-size: 0.8rem; /* Significantly smaller font size for table line items */
}
.table th, .table td {
    border-color: #444; /* Darker border color */
    padding: 0.75rem; /* Add padding */
    vertical-align: middle; /* Center align vertically */
}
.table-hover tbody tr:hover {
    background-color: #2c2c2c !important; /* Darker background on hover */
    color: #e0e0e0 !important; /* Ensure text remains white on hover */
}
.table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
    color: #e0e0e0 !important; /* Ensure text remains white on hover */
}
.table-striped tbody tr:nth-of-type(odd) {
    background-color: #1a1a1a; /* Add striping effect */
}
.table-striped tbody tr:nth-of-type(even) {
    background-color: #1e1e1e; /* Add striping effect */
}
.table-bordered {
    border: 1px solid #444; /* Add border to table */
}
.table-bordered th, .table-bordered td {
    border: 1px solid #444; /* Add border to cells */
}

/* Tab Navigation */
.nav-tabs .nav-link {
    background-color: #1f1f1f !important;
    border: 1px solid #333 !important;
    color: #e0e0e0 !important;
}
.nav-tabs .nav-link.active {
    background-color: #2c2c2c !important;
    border-color: #444 !important;
    color: #bb86fc !important;
}
.nav-tabs .nav-link:hover {
    background-color: #2c2c2c !important;
    color: #bb86fc !important;
}

/* Email Replies */
.email-item {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

/* Comments */
.comment-item {
    background-color: #4b4b00;
    color: #e0e0e0;
}

/* List Group Items - Theme Support */
.list-group-item {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

/* Highlighted site row */
.site-row.selected {
    background-color: var(--site-row-selected) !important;
}

.list-group-item:hover {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
}

.list-group-item-action:hover {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
}

.list-group-item strong {
    color: #e0e0e0 !important;
}

.list-group-item .text-muted {
    color: #b0b0b0 !important;
}

.list-group-item .small {
    color: #b0b0b0 !important;
}

/* Billing section label styling for dark mode */
.form-label {
    color: #e0e0e0 !important;
}

.form-label.text-muted {
    color: #b0b0b0 !important;
}

/* General text-muted styling for dark mode */
.text-muted {
    color: #b0b0b0 !important;
}

/* Ensure billing summary labels are visible */
#billingSummary .form-label,
#recentInvoices .form-label,
#paymentHistory .form-label {
    color: #b0b0b0 !important;
}

/* Ensure "no data" messages are visible */
#billingSummary p.text-muted,
#recentInvoices p.text-muted,
#paymentHistory p.text-muted {
    color: #b0b0b0 !important;
}

.bg-gradient-primary {
    background: linear-gradient(45deg, #1a1a1a, #2d2d2d);
}

.logo-brand {
    height: 32px;
    transition: transform 0.3s ease;
}

.hover-underline {
    position: relative;
    padding-bottom: 3px;
}

.hover-underline::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: rgba(255, 255, 255, 0.8);
    transition: width 0.3s ease;
}

.hover-underline:hover::after {
    width: 100%;
}

.dropdown-menu-dark {
    background-color: #2a2a2a;
    border: 1px solid #404040;
}

.user-menu {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.4rem 1rem;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: #4a90e2;
    border-color: #4a90e2;
}

.infrastructure-nav {
    width: 250px; /* Fixed width for the navigation */
    background-color: #1f1f1f; /* Dark background */
    color: #e0e0e0; /* Light text */
    border-right: 1px solid #333; /* Border to separate the nav */
    overflow-y: auto; /* Enable scrolling if content overflows */
    height: calc(100vh - 56px); /* Full height minus header */
    position: fixed; /* Fix to the left side */
    top: 56px; /* Adjust for header height */
    left: 0;
    z-index: 1030; /* Ensure it stays above other content */
}

.infrastructure-nav .nav-link {
    color: #e0e0e0; /* Light text color for links */
    padding: 0.75rem 1rem; /* Add padding for better spacing */
    font-size: 0.875rem; /* Consistent font size */
    display: flex;
    align-items: center; /* Align items vertically */
    transition: color 0.3s ease; /* Smooth color transition */
}

.infrastructure-nav .nav-link:hover {
    color: #bb86fc; /* Highlight color on hover */
}

.infrastructure-nav .navbar-brand {
    font-size: 1.25rem; /* Slightly larger font size for branding */
    font-weight: bold; /* Bold text for branding */
    color: #e0e0e0; /* Light text color */
    padding: 1rem; /* Add padding for spacing */
    border-bottom: 1px solid #333; /* Add a border below the branding */
}

.bg-gradient-infrastructure {
    background: linear-gradient(45deg, #1a1a1a, #2d2d2d); /* Gradient background */
}

.ticket-header-bar {
    background-color: #1f1f1f;
    color: #e0e0e0;
    border-bottom: 1px solid var(--surface-border);
}

.ticket-header-bar h4,
.ticket-header-bar .text-white {
    color: #e0e0e0 !important;
}

.btn-ticket-outline {
    color: #e0e0e0;
    border-color: #e0e0e0;
    background-color: transparent;
    transition: all 0.2s ease;
}

.btn-ticket-outline:hover,
.btn-ticket-outline:focus {
    color: #bb86fc;
    border-color: #bb86fc;
    background-color: rgba(187, 134, 252, 0.1);
}

.btn-ticket-primary {
    background-color: #bb86fc;
    border-color: #bb86fc;
    color: #121212;
}

.btn-ticket-primary:hover,
.btn-ticket-primary:focus {
    background-color: #9a67ea;
    border-color: #9a67ea;
    color: #121212;
}

.ticket-stat-card {
    background-color: var(--surface-muted) !important;
    color: #e0e0e0 !important;
    border: 1px solid var(--surface-border);
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ticket-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.ticket-stat-card--primary { border-left: 4px solid #bb86fc; }
.ticket-stat-card--success { border-left: 4px solid #4caf50; }
.ticket-stat-card--muted { border-left: 4px solid #9e9e9e; }
.ticket-stat-card--danger { border-left: 4px solid #ef5350; }
.ticket-stat-card--warning { border-left: 4px solid #ffc107; }
.ticket-stat-card--info { border-left: 4px solid #4fc3f7; }

.ticket-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.ticket-stat-label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    color: #b0b0b0;
}

.ticket-stat-icon {
    font-size: 2.2rem;
    opacity: 0.5;
}


.ticket-nav-pill-stack {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

.ticket-nav-pill {
    min-width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5rem;
    text-align: center;
    padding: 0 0.35rem;
    color: #fff;
    box-shadow: 0 0.35rem 0.85rem rgba(0, 0, 0, 0.35);
}

.ticket-nav-pill--info {
    background: linear-gradient(135deg, #3294ff, #1f6feb);
}

.ticket-nav-pill--danger {
    background: linear-gradient(135deg, #ff6b6b, #c92a2a);
}

.role-matrix-panel {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--surface-border);
    border-radius: 0.75rem;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.75rem;
}

.role-checkbox-grid {
    display: grid;
    gap: 0.75rem;
}

.role-checkbox-block {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.65rem;
    padding: 0.75rem;
}

.role-checkbox-group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.65);
}

.role-checkbox-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.role-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.35rem;
    border-radius: 0.45rem;
}

.role-checkbox-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.role-user-card .card-header {
    background-color: rgba(255, 255, 255, 0.02);
}

@media (min-width: 768px) {
    .tickets-container {
        min-height: calc(100vh - 140px);
        display: flex;
        flex-direction: column;
    }

    .tickets-stack {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .ticket-list-card {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
}

.ticket-table-body {
    overflow-y: visible !important;
}

.ticket-table-responsive {
    overflow: visible;
}

@media (max-width: 767.98px) {
    .ticket-table-responsive {
        overflow-x: auto;
    }
}
.ticket-html-frame {
    width: 100%;
    min-height: 200px;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    background: var(--surface-bg);
}

.ticket-html-frame--compact {
    min-height: 150px;
}

.ticket-preview-frame {
    width: 100%;
    height: 500px;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    background: var(--surface-bg);
}

.bg-gray {
    background-color: var(--surface-muted) !important;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    color: inherit;
}

/* ApexCharts tooltip styling for dark theme */
.apexcharts-tooltip {
    background-color: #2c2c2c !important;
    border: 1px solid #444 !important;
    color: #e0e0e0 !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45) !important;
}

.apexcharts-tooltip-title {
    background-color: #262626 !important;
    border-bottom: 1px solid #444 !important;
    color: #e0e0e0 !important;
}

/* Toasts and small UI polish (dark) */
#toastContainer {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 0.55rem 0.85rem;
    border-radius: 6px;
    color: #f8fafc;
    font-weight: 600;
    box-shadow: 0 10px 28px rgba(2,6,23,0.6);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transition: opacity .22s ease, transform .22s ease;
}
.toast.visible { opacity: 1; transform: translateY(0) scale(1); }
.toast-success { background: #22c55e; color: #06140a; }
.toast-error { background: #ef4444; color: #1b0404; }
.toast-info { background: #06b6d4; color: #042e33; }

.fade-out { transition: opacity .32s ease, transform .32s ease, height .32s ease, margin .32s ease, padding .32s ease; opacity: 0 !important; transform: translateX(-6px) scale(.98); height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: hidden; }
.fade-in { animation: _fw_fadeIn .28s ease both; }
@keyframes _fw_fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.site-row { transition: box-shadow .18s ease, transform .12s ease; border-radius: 6px; }
.site-row:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.45); }
.site-row.selected { box-shadow: 0 14px 36px rgba(0,0,0,0.55); }

