:root {
    --primary: #1a73e8;          /* Google Blue */
    --primary-light: #4285f4;    /* Lighter Blue */
    --primary-dark: #185abc;     /* Darker Blue */
    --secondary: #5f6368;        /* Google Gray */
    --background: #f8f9fa;       /* Light Gray Background */
    --card-bg: #ffffff;
    --text-primary: #202124;     /* Dark Gray Text */
    --text-secondary: #5f6368;   /* Medium Gray Text */
    --border-color: #dadce0;     /* Google Border Color */
    --success: #34a853;          /* Google Green */
    --danger: #ea4335;           /* Google Red */
    --warning: #fbbc04;          /* Google Yellow */
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 2px 6px 2px rgba(60, 64, 67, 0.15), 0 1px 2px 0 rgba(60, 64, 67, 0.3);
}

/* Global Styles */
body {
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Enhanced Card Styling */
.card {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    border: none;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

.card-header h2, .card-header h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
}

/* Modern Table Styling */
.table {
    margin: 0;
}

.table thead th {
    background: var(--background);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(26, 115, 232, 0.04);
}

/* Enhanced Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
}

/* Modern Button Styling */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Modern Navbar */
.navbar {
    background: var(--primary) !important;
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    min-height: 75px;
}

.navbar .container-fluid {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
    color: white !important;
    margin-left: 1rem !important;
    position: absolute;
    left: 4rem;
}

.navbar-toggler {
    padding: 0.375rem 0.75rem;
    font-size: 1.25rem;
    border: none;
    background-color: transparent !important;
    z-index: 2;
}

.navbar-toggler-icon {
    width: 1.5em;
    height: 1.5em;
}

#menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary);
    padding: 0.5rem;
    z-index: 1000;
}

@media (max-width: 768px) {
    .navbar-brand {
        left: 4.5rem;
    }
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.9) !important;
}

.nav-link:hover, .nav-link.active {
    color: white !important;
    background: rgba(255, 255, 255, 0.1);
}

/* Modern Pagination */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border: none;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 500;
}

.page-link:hover {
    background: rgba(26, 115, 232, 0.04);
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    color: white;
}

/* Login Form Enhancement */
.login-card {
    max-width: 400px;
    margin: 2rem auto;
    width: 90%;
}

@media (max-width: 576px) {
    .login-card {
        width: 95%;
        margin: 1rem auto;
    }
}

.login-card .card-header {
    text-align: center;
    padding: 2rem 1.5rem;
}

.login-card .card-body {
    padding: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.75rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar .container-fluid {
        padding: 0.5rem;
    }
    
    #menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary);
        padding: 1rem;
        z-index: 1000;
    }
}

/* Loading Animation */
.spinner-grow {
    color: var(--primary) !important;
}

#loader {
    background: rgba(248, 249, 250, 0.9);
    backdrop-filter: blur(8px);
}

/* Add these responsive form and button styles */
.card .btn {
    white-space: nowrap;
    padding: 0.75rem 1rem;
    width: 100%;
}

@media (max-width: 991px) {  /* For tablet and smaller screens */
    .card .row {
        margin-bottom: 1rem;
    }
    
    .card .col-md-1,
    .card .col-md-2,
    .card .col-md-3,
    .card .col-md-4 {
        margin-bottom: 1rem;
    }

    .card .d-flex.align-items-end {
        margin-top: 1rem;
    }

    /* Specific adjustments for the Update Visit form */
    #updateVisitForm .col-md-1 {
        width: 100%;
    }

    /* Adjustments for Add Inspector form */
    .card form .row .col-md-2 {
        width: 100%;
        text-align: right;
    }

    /* Adjustments for Add Company form */
    #addCompanyForm .col-md-2.d-flex {
        width: 100%;
    }
}

/* Additional spacing for form groups */
.form-group {
    margin-bottom: 1rem;
}

/* Ensure form elements stay within bounds */
.form-control, 
.form-select {
    max-width: 100%;
}

/* Dashboard responsive fixes */
@media (max-width: 991px) {  /* For tablet and smaller screens */
    /* General table responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Filter form adjustments */
    .card .row .col-md-1,
    .card .row .col-md-2,
    .card .row .col-md-3,
    .card .row .col-md-4 {
        margin-bottom: 1rem;
        width: 100%;
    }

    /* Button container adjustments */
    .col-md-1.d-flex.align-items-end {
        width: 100%;
        margin-top: 1rem;
    }

    .d-flex.flex-column.gap-2 {
        flex-direction: row !important;
        justify-content: space-between;
        width: 100%;
    }

    /* Filter and Reset buttons */
    .btn {
        width: 48%;  /* Allows two buttons to sit side by side with small gap */
        margin: 0;
    }
}

/* General responsive improvements */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.75rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Ensure form controls don't overflow */
    .form-control,
    .form-select,
    .btn {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Ensure consistent button sizing */
.btn {
    white-space: nowrap;
    padding: 0.75rem 1rem;
}

/* Table cell content wrapping */
.table td {
    white-space: normal;
    word-break: break-word;
}

/* Add or update these responsive styles */

/* Table Responsiveness */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;  /* Negative margin to align with card padding */
    padding: 0 1rem;  /* Add padding back to maintain spacing */
    width: calc(100% + 2rem);  /* Compensate for negative margins */
}

@media (max-width: 768px) {
    /* Adjust card padding for mobile */
    .card-body {
        padding: 1rem;
    }

    /* Make table cells more compact on mobile */
    .table td, .table th {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    /* Ensure table headers don't wrap unnecessarily */
    .table th {
        white-space: nowrap;
    }

    /* Filter form adjustments */
    .filter-form .col-md-3,
    .filter-form .col-md-2,
    .filter-form .col-md-1 {
        margin-bottom: 1rem;
    }

    /* Export buttons adjustment */
    .btn-group {
        display: flex;
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .container-fluid {
        padding: 1rem;
    }

    /* Adjust filter form layout */
    .filter-form .row {
        display: flex;
        flex-wrap: wrap;
    }

    .filter-form .col-md-3 {
        width: 50%;
        padding: 0 0.5rem;
        margin-bottom: 1rem;
    }

    .filter-form .col-md-2,
    .filter-form .col-md-1 {
        width: 50%;
        padding: 0 0.5rem;
        margin-bottom: 1rem;
    }
}

/* General responsive improvements */
@media (max-width: 1024px) {
    /* Navbar adjustments */
    .navbar-brand {
        font-size: 1.25rem;
    }

    /* Card adjustments */
    .card {
        margin-bottom: 1rem;
    }

    /* Button adjustments */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    /* Form control adjustments */
    .form-control,
    .form-select {
        font-size: 0.875rem;
        padding: 0.4rem 0.75rem;
    }
}

/* Ensure tables don't break layout on small screens */
.table {
    min-width: 800px; /* Minimum width to ensure all columns are visible */
    margin-bottom: 0;
}

/* Add smooth scrolling for touch devices */
* {
    -webkit-overflow-scrolling: touch;
}

/* Improve table header visibility */
.table thead th {
    position: sticky;
    top: 0;
    background: var(--background);
    z-index: 1;
}

/* Add fade indicators for horizontal scroll */
.table-responsive::after,
.table-responsive::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 2;
    pointer-events: none;
}

.table-responsive::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.9), rgba(255,255,255,0));
}

.table-responsive::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.9), rgba(255,255,255,0));
}

/* Add visual indication for editable cells */
.editable-date {
    position: relative;
    cursor: pointer;
}

.editable-date::after {
    content: '✎';
    position: absolute;
    right: 5px;
    opacity: 0.5;
    font-size: 0.8em;
}

/* Add touch feedback styles */
@media (hover: none) {  /* Only on touch devices */
    .editable-date:active {
        background-color: rgba(0, 123, 255, 0.1);
    }
}

/* Optional: Add tooltip for desktop users */
@media (hover: hover) {  /* Only on non-touch devices */
    .editable-date::before {
        content: 'Double-click to edit';
        position: absolute;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        font-size: 12px;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
        opacity: 0;
        transition: opacity 0.2s;
        pointer-events: none;
    }

    .editable-date:hover::before {
        opacity: 1;
    }
}

/* Autocomplete Styles */
.autocomplete-suggestions {
    position: absolute;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    width: 100%;
}

.autocomplete-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.autocomplete-suggestion:hover {
    background-color: rgba(26, 115, 232, 0.04);
}

/* Style for the combobox container */
.combobox-container {
    position: relative;
}

.combobox-container .form-control {
    padding-right: 2.5rem; /* Space for the dropdown arrow */
}

.combobox-toggle {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 2.5rem;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
}

.combobox-toggle:hover {
    color: var(--text-primary);
}

/* Toast Notifications - Updated for top positioning on all devices */
#toast-container {
    position: fixed;
    z-index: 1050;
    padding: 15px;
    pointer-events: none;
    top: 20px; /* Position at top for all devices */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 350px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 10px;
    min-width: 250px;
    opacity: 0;
    transform: translateY(-100%); /* Changed to slide from top */
    transition: all 0.3s ease-in-out;
    pointer-events: auto;
    width: 100%;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-body {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

/* Mobile-specific adjustments */
@media (max-width: 576px) {
    #toast-container {
        padding: 10px;
        max-width: 100%;
    }

    .toast {
        margin-bottom: 5px;
        min-width: 0;
    }

    .toast-body {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

/* Success and Error states */
.success-toast {
    border-left: 4px solid var(--success);
}

.error-toast {
    border-left: 4px solid var(--danger);
}

.success-toast i {
    color: var(--success);
    font-size: 1.2em;
}

.error-toast i {
    color: var(--danger);
    font-size: 1.2em;
}

/* Safe area inset padding for modern mobile devices */
@supports (padding: max(0px)) {
    @media (max-width: 576px) {
        #toast-container {
            padding-top: max(10px, env(safe-area-inset-top));
            padding-left: max(10px, env(safe-area-inset-left));
            padding-right: max(10px, env(safe-area-inset-right));
        }
    }
}

/* Add these styles to your existing CSS */
.filter-input {
    margin-bottom: 0;
}

.combobox-container {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .col-md-1.d-flex.align-items-end {
        margin-top: 0;
    }
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Add to your existing CSS */
.alert {
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1045;
}

.alert {
    z-index: 1050;
}

/* Button group and button sizing */
.btn-group {
    display: flex;
}

.btn-group .btn {
    flex: 1;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-width: 80px;  /* Ensures minimum width for buttons */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* Reset button styling to match export buttons */
.btn-outline-secondary {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* Ensure consistent button heights */
.d-flex.gap-2 {
    align-items: stretch;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .d-flex.gap-2 {
        flex-direction: column;
    }
    
    .btn-group, .btn-outline-secondary {
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
    }
}

.combobox-container {
    position: relative;
}

.combobox-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    border: none;
    background: transparent;
    padding: 0 10px;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.autocomplete-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.autocomplete-suggestion:hover {
    background-color: var(--background);
}

/* custom_admin.css */

/* Make the table layout fixed for consistent column width */
.change-list table {
    table-layout: fixed;
    width: 100%;
}

/* Target the 2nd column (quality_point) */


.change-list table th:nth-child(3),
.change-list table td:nth-child(3) {
    width: 30%;  /* Adjust width as needed */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* Target the 3rd column (uploaded_file_names) */
.change-list table th:nth-child(4),
.change-list table td:nth-child(4) {
    width: 30%;  /* Adjust width as needed */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.custom-blue-btn {
    background-color: #3B82F6;  /* Tailwind's blue-500 color */
}
.custom-blue-btn:hover {
    background-color: #2563EB;  /* Tailwind's blue-600 color */
}