/* --- GOOGLE FONTS (Poppins) --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');


/* =================================================================== */
/* ENTERPRISE UI OVERHAUL STYLESHEET V1.0                  */
/* =================================================================== */

/* --- 1. GLOBAL & TYPOGRAPHY --- */
:root {
    --primary-color: #2c3e50;
    /* Default, will be overridden by PHP */
    --secondary-color: #3498db;
    /* Default, will be overridden by PHP */
    --light-grey: #f8f9fa;
    --text-color: #495057;
    --heading-color: #343a40;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-grey);
    font-size: 15px;
    /* Base font size for better readability */
    color: var(--text-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--heading-color);
}

/* --- 2. LOGIN PAGE --- */
.login-container {
    background-color: #f8fafc;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden;
    background: #fff;
}

.login-carousel .carousel-item {
    height: 100%;
    min-height: 600px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.carousel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: #fff;
}

.carousel-overlay h4 {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.carousel-overlay p {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
}

.login-form-col {
    padding: 60px 50px;
}

.form-precision h3 {
    font-weight: 800;
    color: #1e293b;
}

.form-precision .form-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.form-precision .form-control {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.form-precision .form-control:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
}

.btn-precision {
    background: #1e293b !important;
    color: #fff !important;
    padding: 14px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    transition: all 0.2s ease;
}

.btn-precision:hover {
    background: #0f172a;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* --- 3. ADMIN LAYOUT & SIDEBAR --- */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: var(--primary-color);
    color: #fff;
    transition: all 0.3s;
    z-index: 10;
}

#sidebar.active {
    margin-left: -260px;
}

.sidebar-header {
    padding: 25px;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.sidebar-header img {
    height: 50px;
    margin-bottom: 10px;
}

.sidebar-header strong {
    font-weight: 500;
}

#sidebar ul.components {
    padding: 20px 0;
}

#sidebar ul li a {
    padding: 15px 25px;
    font-size: 1.05em;
    font-weight: 500;
    display: block;
    color: rgba(255, 255, 255, 0.8);
    border-left: 4px solid transparent;
    text-decoration: none;
}

#sidebar ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    border-left-color: var(--secondary-color);
}

#sidebar ul li.active>a,
a[aria-expanded="true"] {
    color: #fff;
    background: transparent;
    border-left-color: var(--secondary-color);
}

#sidebar ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* --- 4. TOP NAVIGATION BAR (REVISED & COMPACT) --- */
#content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.3s;
}

#content .navbar {
    padding: 0.75rem 1.5rem;
    /* More compact padding */
    margin: 0 !important;
    /* Remove margin */
    border-radius: 0;
    /* Full width */
    background-color: #fff !important;
}

#sidebarCollapse {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
}

#sidebarCollapse span {
    font-weight: 500;
}

.navbar .nav-link {
    font-size: 0.95rem;
    /* Smaller font for a sleeker look */
}

/* --- 5. MAIN CONTENT AREA (REVISED) --- */
.main-content {
    padding: 1rem;
    width: 100%;
    /* Maximize horizontal footprint */
}

.card-db {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .05) !important;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-db:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .08) !important;
}

.card-db .card-title-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: #888;
}

.card-db .card-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--heading-color);
}

.card-db .card-icon {
    font-size: 3rem;
    color: var(--secondary-color);
    opacity: 0.2;
}

.content-panel {
    background: #fff;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .05) !important;
}

.table-logs {
    font-size: 0.95rem;
}

.table-logs thead {
    border-bottom: 2px solid #dee2e6;
}

.table-logs th {
    font-weight: 600;
    color: #333;
}

.table-logs .action-cell {
    font-weight: 500;
}

.table-logs .date-cell {
    color: #6c757d;
    white-space: nowrap;
}

/* --- 6. BUTTONS & FORMS --- */
.btn {
    font-weight: 500;
    border-radius: 0.3rem;
}

.btn-success,
.btn-success:hover {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
}

.btn-primary,
.btn-primary:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* --- PO Entry Page Styles --- */
.pdf-viewer-container {
    height: 75vh;
    /* Adjust height as needed */
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    /* Important for iframe */
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.pdf-viewer-iframe {
    width: 100%;
    height: 100%;
    border: none;
}


/* --- Select2 Bootstrap 5 Alignment Fix --- */

/* Ensure the Select2 container matches the height and vertical alignment of Bootstrap form controls */
.select2-container--bootstrap-5 .select2-selection--single {
    height: calc(1.5em + .75rem + 2px);
    /* Matches Bootstrap's default form control height */
    padding: .375rem .75rem;
    /* Matches Bootstrap's form control padding */
    display: flex;
    /* Use flexbox for vertical alignment */
    align-items: center;
    /* Vertically center the text */
    border: var(--bs-border-width) solid var(--bs-border-color);
    /* Use Bootstrap's border variables */
    border-radius: var(--bs-border-radius);
    /* Use Bootstrap's border radius */
}

/* Adjust the selected text's line height */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.5;
    /* Match Bootstrap's form control line height */
    padding-left: 0;
    /* Remove default padding as container handles it */
}

/* Style the dropdown arrow */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + .75rem);
    /* Match the container height */
    position: absolute;
    top: 1px;
    right: 1px;
    width: 2.5rem;
    /* Adjust width as needed */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Style adjustments when the dropdown is open */
.select2-container--bootstrap-5.select2-container--open .select2-selection--single {
    border-color: #86b7fe;
    /* Bootstrap focus border color */
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
    /* Bootstrap focus shadow */
}

/* Ensure dropdown itself uses the theme */
.select2-dropdown {
    border-color: var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

/* Style search box within the dropdown */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border-radius: var(--bs-border-radius-sm);
    /* Use smaller radius for search input */
    border-color: var(--bs-border-color);
}



/* --- DataTables Column Filter Inputs --- */
.datatable-filter-input {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.3rem;
    box-sizing: border-box;
    /* Ensures padding doesn't affect width */
}

/* Add padding to the cells containing the inputs */
#poListTable thead tr:nth-child(2) td {
    padding: 0.5rem;
}

/* =================================================================== */
/* PRECISION CORPORATE DESIGN SYSTEM (OVERRIDE)            */
/* =================================================================== */

:root {
    --precision-dark: #1e293b;
    --precision-navy: #0f172a;
    --precision-blue: #3b82f6;
    --precision-accent: #6366f1;
    --precision-success: #10b981;
    --precision-warning: #f59e0b;
    --precision-danger: #ef4444;
    --precision-bg: #f1f5f9;
    --sidebar-width: 260px;
}

body {
    background-color: var(--precision-bg);
}

/* --- PRECISION SIDEBAR --- */
#sidebar {
    background: var(--precision-navy);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 30px 20px;
}

#sidebar ul li a {
    color: #94a3b8;
    padding: 12px 25px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

#sidebar ul li a:hover, #sidebar ul li.active > a {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-left-color: var(--precision-blue);
}

#sidebar ul li a i {
    color: #475569;
}

#sidebar ul li.active > a i, #sidebar ul li a:hover i {
    color: var(--precision-blue);
}

/* --- PRECISION CARDS --- */
.card-precision {
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
}

.card-precision:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.card-precision .card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.bg-precision-blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.bg-precision-green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.bg-precision-purple { background: rgba(99, 102, 241, 0.1); color: #6366f1; }

.stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

/* --- PRECISION PANELS --- */
.panel-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

/* --- STATUS BADGES --- */
.badge-precision {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
}

.status-active { background: #dcfce7; color: #166534; }
.status-inactive { background: #fee2e2; color: #991b1b; }

* Style adjustments when the dropdown is open */ .select2-container--bootstrap-5.select2-container--open .select2-selection--single {
    border-color: #86b7fe;
    /* Bootstrap focus border color */
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
    /* Bootstrap focus shadow */
}

/* Ensure dropdown itself uses the theme */
.select2-dropdown {
    border-color: var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

/* Style search box within the dropdown */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border-radius: var(--bs-border-radius-sm);
    /* Use smaller radius for search input */
    border-color: var(--bs-border-color);
}



/* --- DataTables Column Filter Inputs --- */
.datatable-filter-input {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.3rem;
    box-sizing: border-box;
    /* Ensures padding doesn't affect width */
}

/* Add padding to the cells containing the inputs */
#poListTable thead tr:nth-child(2) td {
    padding: 0.5rem;
}