/* General Body Styles */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background-color: #f4f7f9; margin: 0; color: #333; }
.main-wrapper { display: flex; height: 100vh; }
.main-content { flex-grow: 1; overflow-y: auto; padding: 25px; }
.content-header { margin-bottom: 25px; }
.content-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.content-header h1, .content-header-flex h1 { margin: 0; font-size: 28px; font-weight: 600; }
.content-header p, .content-header-flex p { color: #6c757d; margin-top: 5px; }

/* Sidebar Styles */
.sidebar { width: 250px; background-color: #1f2937; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 20px; font-size: 24px; font-weight: bold; text-align: center; border-bottom: 1px solid #374151; }
.sidebar-menu { list-style: none; padding: 20px 0; margin: 0; }
.sidebar-menu li a { display: block; color: #d1d5db; text-decoration: none; padding: 15px 25px; transition: background-color 0.3s, color 0.3s; }
.sidebar-menu li a:hover { background-color: #374151; color: #fff; }
.sidebar-menu li.active a { background-color: #007bff; color: #fff; font-weight: 600; }

/* Top Bar / Header Styles */
.header { display: flex; justify-content: space-between; align-items: center; padding: 15px 25px; background-color: #fff; border-bottom: 1px solid #e5e7eb; margin: -25px -25px 25px -25px; }
.header-right { display: flex; align-items: center; gap: 25px; }
.user-profile { display: flex; align-items: center; cursor: pointer; }
.user-profile img { width: 40px; height: 40px; border-radius: 50%; margin-right: 10px; }

/* Dashboard Widgets */
.widgets-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.widget { background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); }
.widget-title { color: #6c757d; font-size: 14px; margin-bottom: 10px; }
.widget-value { font-size: 32px; font-weight: 700; margin-bottom: 10px; }
.widget-change { font-size: 14px; }
.widget-change .positive { color: #28a745; } .widget-change .negative { color: #dc3545; }
.widget-link { text-decoration: none; color: inherit; display: block; transition: transform 0.2s ease-in-out; }
.widget-link:hover { transform: translateY(-5px); }

/* Data Table Styles */
.data-table-container { background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); }
.data-table-container h3 { margin-top: 0; margin-bottom: 20px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 15px; text-align: left; border-bottom: 1px solid #e5e7eb; }
.data-table th { font-weight: 600; color: #6c757d; font-size: 12px; text-transform: uppercase; }
.data-table th a { text-decoration: none; color: inherit; } .data-table th a:hover { color: #007bff; }
.status-badge { padding: 5px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-approved { background-color: #d1fae5; color: #065f46; } .status-pending { background-color: #fef3c7; color: #92400e; } .status-rejected { background-color: #fee2e2; color: #991b1b; } .status-draft { background-color: #e5e7eb; color: #374151; }
.status-vouchered { background-color: #e0e7ff; color: #3730a3; }
.status-delivered { background-color: #dcfce7; color: #166534; }
/* Login Container */
.login-container { background-color: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); width: 100%; max-width: 400px; margin: auto; }
body:has(.login-container) { display: flex; justify-content: center; align-items: center; height: 100vh; }

/* General Form Styles */
.form-container-full { background-color: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.form-header { font-size: 20px; font-weight: 600; margin-bottom: 5px; }
.form-subheader { color: #6c757d; margin-top: 0; margin-bottom: 25px; }
.form-grid, .form-grid-2, .form-grid-3 { display: grid; gap: 20px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); } .form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #555; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
.items-section { border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 20px 0; margin: 20px 0; }
.items-section h4 { margin-top: 0; font-size: 16px; }
.item-row { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr auto; gap: 15px; align-items: center; margin-bottom: 10px; }
.item-row input { padding: 8px; }
.item-total { font-weight: 600; text-align: right; padding-right: 10px; }
.btn-delete-item { background: transparent; border: none; color: #dc3545; font-size: 20px; cursor: pointer; }
.totals-section { text-align: right; font-size: 18px; margin: 20px 0; }
.form-actions { text-align: right; }
.radio-group, .checkbox-label { display: flex; align-items: center; gap: 10px; font-weight: normal;} .checkbox-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.form-section { border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 25px; }
.form-section h3 { margin-top: 0; margin-bottom: 20px; border-bottom: 1px solid #e5e7eb; padding-bottom: 10px; }
.section-header { display: flex; justify-content: space-between; align-items: center; }

/* Filter Bar */
.filter-bar { background-color: #fff; padding: 15px; margin-bottom: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.filter-bar form { display: flex; align-items: center; gap: 10px; }
.search-input { flex-grow: 1; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
.clear-filter-link { text-decoration: none; color: #6c757d; font-size: 14px; } .clear-filter-link:hover { text-decoration: underline; }

/* Buttons */
.btn { text-decoration: none; display: inline-block; padding: 12px 20px; border: none; color: white; font-size: 16px; font-weight: 600; border-radius: 4px; cursor: pointer; transition: background-color 0.3s; }
.btn-primary { background-color: #007bff; } .btn-primary:hover { background-color: #0056b3; }
.btn-secondary { background-color: #6c757d; } .btn-secondary:hover { background-color: #5a6268; }

/* Alert/Message Boxes */
.alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; }
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-error { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }

/* Action Dropdown Menu */
.action-dropdown { position: relative; display: inline-block; }
.action-btn { background-color: #f0f0f0; border: 1px solid #ccc; color: #333; padding: 2px 10px; font-size: 16px; font-weight: bold; border-radius: 5px; cursor: pointer; line-height: 1; }
.action-btn:hover { background-color: #e0e0e0; }
.dropdown-content { display: none; position: absolute; right: 0; background-color: #ffffff; min-width: 180px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; border-radius: 5px; overflow: hidden; }
.dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; font-size: 14px; }
.dropdown-content a:hover { background-color: #f1f1f1; }
.dropdown-content a.delete-action { color: #dc3545; }
.show { display: block; }

/* Notification Styles */
.notification-area { position: relative; display: flex; align-items: center; }
.notification-icon { position: relative; cursor: pointer; color: #555; }
.notification-badge { position: absolute; top: -5px; right: -8px; background-color: #dc3545; color: white; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: bold; display: flex; justify-content: center; align-items: center; }
.notification-dropdown { display: none; position: absolute; top: 40px; right: 0; width: 320px; background-color: #fff; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 10; border-radius: 5px; overflow: hidden; }
.notification-dropdown.show { display: block; }
.dropdown-header { padding: 12px 16px; font-weight: bold; border-bottom: 1px solid #e5e7eb; }
.notification-item { display: block; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; color: #333; text-decoration: none; font-size: 14px; }
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background-color: #f8f9fa; }
.notification-item .time-ago { display: block; font-size: 12px; color: #6c757d; margin-top: 4px; }

/* Inspection Form Styles */
.inspection-item-row { border: 1px solid #e5e7eb; border-radius: 8px; padding: 15px; margin-bottom: 15px; }
.inspection-item-row .item-description { font-weight: 500; margin-bottom: 10px; }
.rejection-reason-field { width: 100%; margin-top: 10px; padding: 8px; border: 1px solid #ddd; border-radius: 4px; }
#total_amount_display, #amount_in_words { background-color: #e9ecef; }

/* Styles for View Pages */
.view-container {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.view-section {
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 25px;
}
.view-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.view-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}
.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px 25px; /* row-gap column-gap */
}
.view-grid div, .view-item {
    font-size: 14px;
    color: #555;
}
.view-grid div strong, .view-item strong {
    color: #1f2937;
    display: block;
    margin-bottom: 4px;
}
.view-item {
    margin-top: 15px;
}
.view-item p, .view-section p {
    margin-top: 5px;
    color: #333;
    line-height: 1.6;
}
/* Style for the logo in the sidebar */
.sidebar-logo {
    max-height: 50px; /* Adjust this value to fit your logo's dimensions */
    width: auto;
    padding: 10px 0; /* Add some vertical spacing */
}
/* Styles for Updated Header */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.page-title {
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
}
.current-datetime {
    font-size: 14px;
    color: #6c757d;
    background-color: #f4f7f9;
    padding: 5px 10px;
    border-radius: 5px;
}

/* Styles for Settings Page */
.settings-container { display: flex; flex-direction: column; gap: 20px; }
.danger-zone { border: 2px solid #dc3545 !important; }
.btn-danger { background-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; }

/* Styles for Confirmation Modal */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
}
.modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.modal-close:hover,
.modal-close:focus {
    color: black;
}

/* Styles for new Dashboard Layout */
.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* On wider screens, show two columns */
@media (min-width: 1200px) {
    .dashboard-columns {
        grid-template-columns: 1fr 1fr;
    }
}

/* Styles for Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-top: 1px solid #e5e7eb;
}
.pagination-info {
    font-size: 14px;
    color: #6c757d;
}
.pagination-links a {
    color: #007bff;
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    margin: 0 2px;
    border-radius: 4px;
}
.pagination-links a:hover {
    background-color: #f4f7f9;
}
.pagination-links a.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

* --- VISUAL POLISH STYLES --- */

/* 1. Form Input Focus */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.search-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 2. Button Active State (when clicked) */
.btn:active {
    transform: translateY(1px);
    filter: brightness(90%);
}

/* 3. Table Row Hover Effect */
.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* 4. Sidebar Link Hover/Active Polish */
.sidebar-menu li a {
    position: relative;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.sidebar-menu li.active a {
    background-color: #007bff;
    color: #fff;
    font-weight: 600;
}

/* Add a subtle left border to the active link for emphasis */
.sidebar-menu li.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: #63aeff;
}

/* Styles for Dashboard Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}
.empty-state-icon {
    width: 60px;
    height: 60px;
    fill: #ced4da;
    margin-bottom: 15px;
}
.empty-state h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #495057;
}
.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Style for highlighted dashboard widget */
.widget-highlight {
    background-color: #fffbe6; /* A light yellow */
    border: 1px solid #fcc419;
}
.widget-highlight .widget-title {
    font-weight: bold;
}


/* --- CORRECTED STYLES FOR SETTINGS PAGE --- */
.settings-columns {
    display: grid;
    grid-template-columns: 1fr; /* Default to a single column on small screens */
    gap: 25px;
}

/* On screens wider than 992px, switch to a two-column layout */
@media (min-width: 992px) {
    .settings-columns {
        /* The first column (profile pic) takes up 1 part, the second (password) takes up 2 parts */
        grid-template-columns: 1fr 2fr;
    }
}

.profile-picture-preview {
    text-align: center;
    margin-bottom: 20px;
}
.profile-picture-preview img {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #e5e7eb;
}

/* Styles for Receiving Status Badges */
.status-not-received { background-color: #f3f4f6; color: #4b5563; }
.status-partially-received { background-color: #fef9c3; color: #854d0e; }
.status-fully-received { background-color: #dcfce7; color: #166534; }

.status-void { background-color: #fee2e2; color: #991b1b; text-decoration: line-through; }
.status-active { background-color: #dcfce7; color: #166534; }


/* Styles for Supplier Attachment Grid */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 25px;
}
.attachment-item .form-group {
    border: 1px solid #e5e7eb;
    padding: 15px;
    border-radius: 6px;
    background-color: #f9fafb;
}
.attachment-view {
    margin-top: 10px;
    font-size: 14px;
}
.delete-link-small {
    color: #dc3545;
    text-decoration: none;
    font-size: 12px;
    margin-left: 10px;
}
.delete-link-small:hover {
    text-decoration: underline;
}