/* ================================================================
   AMS — ACCESSORY MANAGEMENT SYSTEM THEME
   Clean, Professional, Factory-Friendly
   ================================================================ */

:root {
    --ams-primary: #2563eb;
    --ams-primary-dark: #1d4ed8;
    --ams-primary-light: #dbeafe;
    --ams-sidebar-bg: #1e293b;
    --ams-sidebar-hover: #334155;
    --ams-sidebar-active: #2563eb;
    --ams-sidebar-text: #94a3b8;
    --ams-sidebar-width: 260px;
    --ams-navbar-height: 56px;
    --ams-body-bg: #f1f5f9;
    --ams-card-bg: #ffffff;
    --ams-border: #e2e8f0;
    --ams-text: #1e293b;
    --ams-text-muted: #64748b;
    --ams-success: #16a34a;
    --ams-danger: #dc2626;
    --ams-warning: #d97706;
    --ams-info: #0891b2;
}

/* ======= GLOBAL ======= */
body.ams-body {
    background: var(--ams-body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ams-text);
    margin: 0;
    overflow-x: hidden;
}

/* ======= AUTH PAGE ======= */
body.ams-auth-body {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.ams-auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.ams-auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ams-auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.ams-auth-logo {
    font-size: 42px;
    color: var(--ams-primary);
    margin-bottom: 10px;
}

.ams-auth-header h4 {
    margin-bottom: 4px;
    font-weight: 700;
    color: var(--ams-text);
}

.ams-btn-login {
    padding: 10px;
    font-weight: 600;
    font-size: 15px;
}

.ams-toggle-password {
    border-color: #dee2e6;
}

/* ======= SIDEBAR ======= */
.ams-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--ams-sidebar-width);
    height: 100vh;
    background: var(--ams-sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.ams-sidebar-brand {
    height: var(--ams-navbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 10px;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.ams-sidebar-brand i {
    color: var(--ams-primary);
}

.ams-sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.ams-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ams-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--ams-sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.ams-nav-link:hover {
    background: var(--ams-sidebar-hover);
    color: #fff;
}

.ams-nav-link.active {
    background: rgba(37, 99, 235, 0.15);
    color: #fff;
    border-left-color: var(--ams-primary);
}

.ams-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.ams-arrow {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.2s;
}

.ams-nav-link[aria-expanded="true"] .ams-arrow {
    transform: rotate(180deg);
}

.ams-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.15);
}

.ams-submenu .ams-nav-link {
    padding-left: 56px;
    font-size: 13px;
}

.ams-sidebar-footer {
    padding: 12px 20px;
    color: var(--ams-sidebar-text);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    flex-shrink: 0;
}

.ams-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

/* ======= MAIN CONTENT ======= */
.ams-main {
    margin-left: var(--ams-sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.ams-content {
    padding: 20px;
}

/* ======= NAVBAR ======= */
.ams-navbar {
    height: var(--ams-navbar-height);
    background: var(--ams-card-bg);
    border-bottom: 1px solid var(--ams-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.ams-sidebar-toggle {
    color: var(--ams-text);
    font-size: 18px;
    text-decoration: none;
    margin-right: 12px;
}

.ams-page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ams-text);
}

.ams-user-dropdown {
    color: var(--ams-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

/* ======= BREADCRUMB ======= */
.ams-breadcrumb {
    background: var(--ams-card-bg);
    padding: 10px 20px;
    border-bottom: 1px solid var(--ams-border);
}

.ams-breadcrumb .breadcrumb {
    font-size: 13px;
}

/* ======= CARDS ======= */
.ams-card {
    border: 1px solid var(--ams-border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    background: var(--ams-card-bg);
}

.ams-card-header {
    background: transparent;
    border-bottom: 1px solid var(--ams-border);
    padding: 14px 20px;
}

.ams-card-header h5 {
    font-size: 15px;
    font-weight: 600;
    color: var(--ams-text);
}

/* ======= STAT CARDS ======= */
.ams-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 10px;
    background: var(--ams-card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-left: 4px solid transparent;
}

.ams-stat-primary { border-left-color: var(--ams-primary); }
.ams-stat-success { border-left-color: var(--ams-success); }
.ams-stat-danger  { border-left-color: var(--ams-danger); }
.ams-stat-warning { border-left-color: var(--ams-warning); }
.ams-stat-info    { border-left-color: var(--ams-info); }

.ams-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ams-stat-primary .ams-stat-icon { background: var(--ams-primary-light); color: var(--ams-primary); }
.ams-stat-success .ams-stat-icon { background: #dcfce7; color: var(--ams-success); }
.ams-stat-danger .ams-stat-icon  { background: #fee2e2; color: var(--ams-danger); }
.ams-stat-warning .ams-stat-icon { background: #fef3c7; color: var(--ams-warning); }
.ams-stat-info .ams-stat-icon    { background: #cffafe; color: var(--ams-info); }

.ams-stat-info h3 {
    font-size: 26px;
    font-weight: 800;
    margin: 0;
    color: var(--ams-text);
    letter-spacing: -0.5px;
}

.ams-stat-info p {
    margin: 0;
    font-size: 13px;
    color: var(--ams-text-muted);
}

/* ======= TABLES ======= */
.table thead th {
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: var(--ams-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--ams-border);
    white-space: nowrap;
}

.table td {
    font-size: 14px;
    vertical-align: middle;
}

/* ======= DATATABLES OVERRIDES ======= */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--ams-border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--ams-border);
    border-radius: 6px;
    padding: 4px 8px;
}

/* ======= BUTTONS ======= */
.btn-primary {
    background: var(--ams-primary);
    border-color: var(--ams-primary);
}

.btn-primary:hover {
    background: var(--ams-primary-dark);
    border-color: var(--ams-primary-dark);
}

/* ======= BADGE ======= */
.badge {
    font-weight: 500;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 50px;
}

/* ======= FORMS ======= */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ams-text);
    margin-bottom: 4px;
}

.form-control, .form-select {
    font-size: 14px;
    border-color: var(--ams-border);
    border-radius: 6px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ams-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ======= SIDEBAR COLLAPSED (DESKTOP) ======= */
body.ams-sidebar-collapsed .ams-sidebar {
    transform: translateX(-100%);
}

body.ams-sidebar-collapsed .ams-main {
    margin-left: 0;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 991.98px) {
    .ams-sidebar {
        transform: translateX(-100%);
    }

    .ams-main {
        margin-left: 0;
    }

    body.ams-sidebar-open .ams-sidebar {
        transform: translateX(0);
    }

    body.ams-sidebar-open .ams-sidebar-overlay {
        display: block;
    }
}

/* ======= NPROGRESS ======= */
#nprogress .bar {
    background: var(--ams-primary) !important;
    height: 3px !important;
}

#nprogress .spinner-icon {
    border-top-color: var(--ams-primary) !important;
    border-left-color: var(--ams-primary) !important;
}

/* ======= SCROLLBAR ======= */
.ams-sidebar::-webkit-scrollbar {
    width: 4px;
}

.ams-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* ======= SELECT2 ======= */
.select2-container {
    width: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
    border-color: var(--ams-border);
    font-size: 14px;
    padding: 4px 8px;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    color: var(--ams-text);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--ams-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: var(--ams-primary);
    color: #fff;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border-color: var(--ams-border);
    padding: 6px 10px;
    font-size: 14px;
}

.select2-container--open {
    z-index: 9999 !important;
}

.select2-container--bootstrap-5 .select2-selection__placeholder {
    color: #999;
}

.select2-container--bootstrap-5 .select2-selection__clear {
    margin-right: 4px;
}

/* ======= NOTIFICATION BELL ======= */
.ams-bell-btn {
    color: var(--ams-text);
    text-decoration: none;
    padding: 4px 8px;
}

.ams-bell-btn:hover {
    color: var(--ams-primary);
}

.ams-notif-dropdown {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--ams-border);
    border-radius: 8px;
    padding: 0;
}

.ams-notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: var(--ams-text);
    cursor: pointer;
}

.ams-notif-item:hover {
    background: #f8fafc;
}

.ams-notif-item.unread {
    background: #eff6ff;
}

.ams-notif-item .notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    flex-shrink: 0;
    font-size: 14px;
}

.ams-notif-item .notif-content {
    flex: 1;
    min-width: 0;
}

.ams-notif-item .notif-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.ams-notif-item .notif-msg {
    font-size: 12px;
    color: var(--ams-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ams-notif-item .notif-time {
    font-size: 11px;
    color: #94a3b8;
}

/* ======= DASHBOARD — GREETING BANNER ======= */
.ams-greeting {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #2563eb 100%);
    border-radius: 10px;
    padding: 22px 24px;
    color: #fff;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.ams-greeting::before {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 180px;
    height: 180px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

.ams-greeting h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ams-greeting p {
    margin: 0;
    opacity: 0.8;
    font-size: 13px;
}

.ams-greeting .greeting-date {
    font-size: 12px;
    opacity: 0.6;
    margin-top: 4px;
}

.ams-greeting .greeting-icon {
    font-size: 48px;
    opacity: 0.12;
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
}

/* ======= DASHBOARD — COMPARISON CARDS ======= */
.ams-compare-card {
    border: 1px solid var(--ams-border);
    border-radius: 8px;
    background: var(--ams-card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ams-compare-card .compare-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1;
}

.ams-compare-card .compare-label {
    font-size: 11px;
    color: var(--ams-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.ams-compare-card .compare-change {
    font-size: 12px;
    font-weight: 600;
}

/* ======= DASHBOARD — CARDS ======= */
.ams-dash-card {
    border: 1px solid var(--ams-border);
    border-radius: 8px;
    background: var(--ams-card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ams-dash-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--ams-border);
    padding: 12px 16px;
}

.ams-dash-card .card-header h5 {
    font-size: 13px;
    font-weight: 700;
    color: var(--ams-text);
}

/* ======= DASHBOARD — TABLES ======= */
.ams-dash-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ams-text-muted);
    font-weight: 700;
    padding: 8px 14px;
    border-bottom: 2px solid var(--ams-border);
}

.ams-dash-table td {
    padding: 8px 14px;
    font-size: 13px;
    vertical-align: middle;
}

/* ======= DASHBOARD — LOW STOCK PROGRESS ======= */
.ams-stock-progress {
    height: 5px;
    border-radius: 5px;
    background: #f1f5f9;
    overflow: hidden;
}

.ams-stock-progress .progress-bar {
    border-radius: 5px;
}

/* ======= DASHBOARD — OVERDUE PULSE ======= */
.ams-overdue-pulse {
    animation: overduePulse 2s ease-in-out infinite;
}

@keyframes overduePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ======= DASHBOARD — CHART CONTAINER ======= */
.ams-chart-container {
    position: relative;
    height: 260px;
}

/* ======= DASHBOARD — COUNTER ======= */
.ams-counter {
    display: inline-block;
}