/* OnePHP.Ticketing - Custom Styles */

/* === ADDED: Root Color Definitions ===
  This sets your official brand colors for Bootstrap to use.
*/
:root {
    --bs-primary: #004aad;
    --bs-primary-rgb: 0, 74, 173;
    --bs-warning: #fecf5b;
    --bs-warning-rgb: 254, 207, 91;

    /* Generate subtle colors for light mode */
    --bs-primary-text-emphasis: #002c66;
    --bs-primary-bg-subtle: #cfe2ff;
    --bs-primary-border-subtle: #9cc0ff;
    --bs-warning-text-emphasis: #856a20;
    --bs-warning-bg-subtle: #fff7e6;
    --bs-warning-border-subtle: #feedba;
}


/* Base font */
body {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
}

/* Tweak Bootstrap's default dark mode for a deeper black */
[data-bs-theme="dark"] {
    --bs-body-bg: #0d1117; /* A GitHub-like dark */
    --bs-tertiary-bg: #161b22;
    --bs-border-color: #30363d;
    --bs-body-color: #e6edf3; /* <<< FIX: Sets all default text to light gray */
    
    /* === ADDED: Dark Mode Brand Colors === */
    --bs-primary: #3b82f6; /* A brighter blue for dark mode */
    --bs-primary-rgb: 59, 130, 246;
    --bs-warning: #facc15; /* A brighter yellow for dark mode */
    --bs-warning-rgb: 250, 204, 21;

    /* Generate subtle colors for dark mode */
    --bs-primary-text-emphasis: #a9c7fb;
    --bs-primary-bg-subtle: #1e3a8a;
    --bs-primary-border-subtle: #2563eb;
    --bs-warning-text-emphasis: #fde047;
    --bs-warning-bg-subtle: #78350f;
    --bs-warning-border-subtle: #b45309;
}

[data-bs-theme="dark"] .nav-link {
    color: var(--bs-gray-400);
}

[data-bs-theme="dark"] .nav-link.active {
    color: var(--bs-light);
}

[data-bs-theme="dark"] .nav-link:hover {
    color: var(--bs-gray-200);
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: #161b22;
    --bs-table-border-color: #30363d;
    --bs-table-striped-bg: #21262d;
    --bs-table-hover-bg: #21262d;
    /* FIX: Ensure table text color is correct */
    --bs-table-color: var(--bs-body-color);
    --bs-table-striped-color: var(--bs-body-color);
    --bs-table-hover-color: var(--bs-body-color);
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #21262d;
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: #30363d;
}

[data-bs-theme="dark"] thead.table-light th {
    background-color: #21262d !important;
    color: var(--bs-body-color) !important;
    border-color: #30363d !important;
}

/* Sidebar styles */
.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    transition: transform 0.3s ease;
    box-shadow: 0 0 1rem rgba(0, 0, 0, 0.1);
    border-right: 1px solid var(--bs-border-color);
}

.sidebar .nav-link {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    font-weight: 500;
    color: var(--bs-gray-700);
    text-decoration: none;
}

/* === UPDATED: Changed .feather to .fa-solid === */
.sidebar .nav-link .fa-solid {
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
    /* === ADDED: Center icon === */
    text-align: center;
}

.sidebar .nav-link.active {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    border-left: 3px solid var(--bs-primary);
    padding-left: calc(1.5rem - 3px);
}

.sidebar .nav-link:hover {
    background-color: var(--bs-tertiary-bg);
}

/* Sidebar sub-menu items - remove active state styling */
.sidebar .collapse .nav-link {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    font-size: 0.9rem;
    font-weight: 400;
    background-color: transparent !important;
    border: none;
    border-radius: 0;
    color: var(--bs-gray-700);
}

.sidebar .collapse .nav-link:hover {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-primary);
}

/* Don't apply active styling to sub-menu items */
.sidebar .collapse .nav-link.active {
    background-color: transparent !important;
    color: var(--bs-primary);
    border-left: none;
    padding-left: 2.5rem;
    font-weight: 500;
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: var(--bs-gray-400);
}

[data-bs-theme="dark"] .sidebar .collapse .nav-link {
    color: var(--bs-gray-400);
}

[data-bs-theme="dark"] .sidebar .collapse .nav-link:hover {
    color: var(--bs-primary);
}

[data-bs-theme="dark"] .sidebar .collapse .nav-link.active {
    color: var(--bs-primary);
}

/* Main content styles */
.main-content {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

/* Button icon styles */
.btn-icon {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--bs-tertiary-bg);
    border-radius: 0.375rem;
}

/* Mobile styles for sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1029;
        display: none;
    }

    .sidebar.show + .sidebar-overlay {
        display: block;
    }
}

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Status badges - UPDATED to use CSS variables */
.badge-status-open {
    background-color: var(--bs-primary);
}

.badge-status-in-progress {
    background-color: var(--bs-warning);
    color: #000; /* Keep black text on yellow for readability */
}
[data-bs-theme="dark"] .badge-status-in-progress {
    color: #111; /* Darker text for bright yellow */
}

.badge-status-on-hold {
    background-color: #fd7e14;
}

.badge-status-closed {
    background-color: #6c757d;
}

/* Priority badges - UPDATED to use CSS variables */
.badge-priority-low {
    background-color: #20c997;
}

.badge-priority-medium {
    background-color: #0dcaf0;
    color: #000;
}
[data-bs-theme="dark"] .badge-priority-medium {
    color: #111;
}

.badge-priority-high {
    background-color: #fd7e14;
}

.badge-priority-urgent {
    background-color: #dc3545;
}

/* Card headers - primary accent color for both themes */
.card-header {
    background-color: #004aad !important;
    color: #ffffff !important;
    padding: 1rem 1.5rem !important;
}

[data-bs-theme="dark"] .card-header {
    background-color: #004aad !important;
    color: #ffffff !important;
}

/* Card footer styling */
.card-footer {
    padding: 1rem 1.5rem !important;
    background-color: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
}

/* Card body padding */
.card-body {
    padding: 1.5rem;
}

/* Card hover effect */
.card-hover {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Loading spinner overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-gray-600);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Ticket thread entry */
.thread-entry {
    border-left: 3px solid var(--bs-border-color);
    padding-left: 1rem;
    margin-bottom: 1.5rem;
}

.thread-entry.user-entry {
    border-left-color: var(--bs-primary);
}

.thread-entry.agent-entry {
    border-left-color: var(--bs-success);
}

/* Form validation */
.is-invalid {
    border-color: var(--bs-danger);
}

.invalid-feedback {
    display: block;
    color: var(--bs-danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Ticket details page */
.ticket-header {
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.ticket-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.ticket-meta-item {
    display: flex;
    flex-direction: column;
}

.ticket-meta-label {
    color: var(--bs-gray-600);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* Authentication pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    max-width: 450px;
    width: 100%;
}

.auth-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bs-primary);
    text-align: center;
    margin-bottom: 2rem;
}

/* Real-time notification animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.notification-pulse {
    animation: pulse 2s infinite;
}

/* Flash animation for status/badge changes */
@keyframes flash {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
    }
}

/* Notification dropdown styling */
.dropdown-menu .notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-menu .notification-item:hover {
    background-color: var(--bs-tertiary-bg);
}

.dropdown-menu .notification-item:last-child {
    border-bottom: none;
}

.dropdown-menu .notification-item.unread {
    background-color: var(--bs-primary-bg-subtle);
}

.dropdown-menu .notification-item .notification-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.dropdown-menu .notification-item .notification-time {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

/* Statistics cards */
.stat-card {
    border-left: 4px solid var(--bs-primary);
}

.stat-card.stat-card-warning {
    border-left-color: var(--bs-warning);
}

.stat-card.stat-card-success {
    border-left-color: var(--bs-success);
}

.stat-card.stat-card-danger {
    border-left-color: var(--bs-danger);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    color: var(--bs-gray-600);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Chevron rotation animation */
.feather-chevron-down {
    transition: transform 0.3s ease;
}

/* === ADDED: Chevron rotation for Font Awesome === */
.fa-chevron-down {
    transition: transform 0.3s ease;
}


/* Toast notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1050;
}

/* === DataTables Polished Customizations === */

/* DataTables Controls (Search & Page Length) */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    color: var(--bs-body-color);
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_length select {
    padding-right: 2rem; /* Make space for dropdown arrow */
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    outline: 0;
}

/* DataTables Info Text */
.dataTables_wrapper .dataTables_info {
    padding-top: 1rem;
    color: var(--bs-secondary-color);
}

/* DataTables Pagination */
.dataTables_wrapper .dataTables_paginate {
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color) !important;

    /* Polish */
    border-radius: 0.375rem; /* Rounded corners */
    margin: 0 3px; /* Add spacing between buttons */
    padding: 0;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: var(--bs-primary-border-subtle);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis) !important;
    z-index: 2;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    border-color: var(--bs-primary);
    background: var(--bs-primary);
    color: #ffffff !important; /* White text on primary background */
    box-shadow: 0 2px 8px rgba(var(--bs-primary-rgb), 0.3);
    z-index: 3;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color) !important; /* Muted text */
    opacity: 0.6;
    box-shadow: none;
    cursor: not-allowed;
}



/* =====================================
   Service Catalog Styles
   ===================================== */

/* Service Catalog Modal */
#service-catalog-modal .modal-dialog {
    max-width: 900px;
}

#service-catalog-modal .modal-body {
    min-height: 400px;
}

/* Service Catalog Cards */
.service-catalog-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-radius: 0.75rem;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    height: 100%;
}

.service-catalog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
    border-color: var(--bs-primary);
}

.service-catalog-icon {
    flex-shrink: 0;
    width: 4rem;
    height: 4rem;
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    margin-right: 1.25rem;
}

.service-catalog-content {
    flex-grow: 1;
}

.service-catalog-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--bs-body-color);
}

.service-catalog-description {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0;
}

/* Service Request Form Breadcrumb */
.service-request-breadcrumb {
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.service-request-breadcrumb .breadcrumb-link {
    color: var(--bs-primary);
    text-decoration: none;
    cursor: pointer;
}

.service-request-breadcrumb .breadcrumb-link:hover {
    text-decoration: underline;
}

/* Search Input Styling */
#catalog-search {
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
    padding: 0.75rem 1rem 0.75rem 3rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 1rem;
}

#catalog-search:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .service-catalog-card {
    background-color: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .service-catalog-card:hover {
    background-color: var(--bs-body-bg);
}

[data-bs-theme="dark"] #catalog-search {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23adb5bd' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3E%3C/path%3E%3C/svg%3E");
}

/* Thread Entry Body - Override inline email styles */
.thread-entry-body * {
    color: inherit !important;
    background-color: transparent !important;
}

.thread-entry-body {
    color: var(--bs-body-color);
}

/* Remove embedded email styles and metadata */
.thread-entry-body style,
.thread-entry-body meta {
    display: none !important;
}

/* Clean up email reply formatting */
.thread-entry-body hr {
    border-color: var(--bs-border-color);
    opacity: 0.5;
}

.thread-entry-body font {
    font-family: inherit !important;
    color: inherit !important;
}
