:root {
    --primary: #1565c0;
    --primary-light: #42a5f5;
    --accent: #00bcd4;
    --accent-green: #00c853;
    --accent-purple: #7c4dff;
    --accent-orange: #ff6d00;
    --sidebar-start: #0d2137;
    --sidebar-mid: #1565c0;
    --sidebar-end: #6a1b9a;
    --bg-main: #f0f4f8;
    --card-shadow: 0 4px 20px rgba(21, 101, 192, 0.08);
}

html, body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-main);
}

a, .btn-link {
    color: var(--primary);
}

.btn-primary {
    background: linear-gradient(135deg, #1565c0 0%, #0288d1 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0d47a1 0%, #0277bd 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(21, 101, 192, 0.45);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #42a5f5;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idH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jA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #e3f2fd 100%);
    border-radius: 14px;
    border-left: 5px solid var(--primary);
    box-shadow: var(--card-shadow);
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0d47a1, #0288d1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: none;
    transition: transform 0.25s, box-shadow 0.25s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(21, 101, 192, 0.15);
}

.stat-primary::before { background: linear-gradient(90deg, #1565c0, #42a5f5); }
.stat-success::before { background: linear-gradient(90deg, #2e7d32, #66bb6a); }
.stat-info::before    { background: linear-gradient(90deg, #00838f, #26c6da); }
.stat-warning::before { background: linear-gradient(90deg, #ef6c00, #ffb74d); }

.stat-primary { border-left: 4px solid #1565c0; }
.stat-success { border-left: 4px solid #2e7d32; }
.stat-info    { border-left: 4px solid #00838f; }
.stat-warning { border-left: 4px solid #ef6c00; }

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a237e;
}

.stat-label {
    font-size: 0.8rem;
    color: #78909c;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.stat-card-clickable {
    border: 2px solid transparent;
    cursor: pointer;
}

.stat-card-clickable.stat-card-active {
    border-color: #1565c0;
    box-shadow: 0 8px 28px rgba(21, 101, 192, 0.22);
}

.stat-hint {
    display: block;
    font-size: 0.68rem;
    color: #90a4ae;
    margin-top: 0.2rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.stat-card-compact {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border: 2px solid transparent;
}

.stat-card-compact:hover {
    transform: translateY(-2px);
}

.stat-card-compact.stat-card-active {
    border-color: #1565c0;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.25);
}

.stat-value-sm {
    font-size: 1.5rem;
}

.stat-label-sm {
    font-size: 0.68rem;
    letter-spacing: 0.4px;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: url('/images/login-bg.svg') center/cover no-repeat,
                linear-gradient(160deg, #f0f7ff 0%, #e8f4fd 50%, #f5f0ff 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 2.5rem 2.75rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(21, 101, 192, 0.12),
                0 0 0 1px rgba(21, 101, 192, 0.06);
    position: relative;
    z-index: 1;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 4px 12px rgba(21, 101, 192, 0.2));
}

.login-header h1 {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0d47a1, #1565c0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.login-subtitle {
    color: #78909c;
    font-size: 0.95rem;
    margin: 0;
}

.login-input {
    border-radius: 10px;
    border: 2px solid #e3f2fd;
    padding: 0.65rem 1rem;
    background: #f8fbff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    border-color: #42a5f5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.15);
}

.btn-login {
    background: linear-gradient(135deg, #1565c0 0%, #0288d1 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 20px rgba(21, 101, 192, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(21, 101, 192, 0.4);
    color: white;
}

.login-demo {
    border-top: 1px solid #e3f2fd;
    padding-top: 1rem;
}

.demo-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.demo-badge {
    display: inline-block;
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.demo-admin {
    background: #e8eaf6;
    color: #3949ab;
}

.demo-terminal {
    background: #e0f7fa;
    color: #00838f;
}

/* ===== Nav Tabs (Inventory) ===== */
.nav-tabs {
    border-bottom: 2px solid #e3f2fd;
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    cursor: pointer;
    border: none;
    color: #78909c;
    font-weight: 600;
    border-radius: 10px 10px 0 0;
    padding: 0.75rem 1.25rem;
    transition: all 0.2s;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    background: #e3f2fd;
}

.nav-tabs .nav-link.active {
    color: white;
    background: linear-gradient(135deg, #1565c0, #0288d1);
    border-bottom: none;
    box-shadow: 0 -2px 10px rgba(21, 101, 192, 0.2);
}

/* ===== Status Badges ===== */
.status-badge {
    font-size: 0.85rem;
    padding: 0.4em 0.9em;
    border-radius: 20px;
    font-weight: 600;
}

.status-pending  { background: linear-gradient(135deg, #ffb300, #ffd54f); color: #5d4037; }
.status-quotationreview { background: linear-gradient(135deg, #7b1fa2, #ba68c8); color: #fff; }
.status-approved { background: linear-gradient(135deg, #2e7d32, #66bb6a); color: #fff; }
.status-rejected { background: linear-gradient(135deg, #c62828, #ef5350); color: #fff; }
.status-ordered  { background: linear-gradient(135deg, #0277bd, #4fc3f7); color: #fff; }

/* ===== Request Cards ===== */
.request-card {
    border-left: 5px solid;
    border-image: linear-gradient(180deg, #1565c0, #7c4dff) 1;
    transition: box-shadow 0.2s, transform 0.2s;
}

.request-card:hover {
    box-shadow: 0 8px 24px rgba(21, 101, 192, 0.12);
    transform: translateX(3px);
}

.quotation-box {
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border: 1px solid #a5d6a7;
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

/* ===== Cards ===== */
.card {
    border: none;
    box-shadow: var(--card-shadow);
    border-radius: 14px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
    font-weight: 700;
    color: #1a237e;
    border-bottom: 2px solid #bbdefb;
    padding: 0.85rem 1.25rem;
}

.table thead.table-dark {
    background: linear-gradient(135deg, #0d47a1, #1565c0) !important;
}

.table thead th {
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge.bg-info    { background: linear-gradient(135deg, #0288d1, #4fc3f7) !important; }
.badge.bg-success { background: linear-gradient(135deg, #2e7d32, #66bb6a) !important; }
.badge.bg-warning { background: linear-gradient(135deg, #ef6c00, #ffb74d) !important; color: #fff !important; }
.badge.bg-primary { background: linear-gradient(135deg, #1565c0, #42a5f5) !important; }
.badge.bg-purple { background: linear-gradient(135deg, #6a1b9a, #ab47bc) !important; color: #fff !important; }
.badge.bg-dark    { background: linear-gradient(135deg, #37474f, #546e7a) !important; }
.badge.bg-secondary { background: linear-gradient(135deg, #546e7a, #78909c) !important; }

/* ===== Toast Alerts (bottom-right, compact) ===== */
.toast-alert {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    min-width: 260px;
    max-width: 340px;
    padding: 0.55rem 2.2rem 0.55rem 0.85rem;
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 10px;
    border: none;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    animation: toastSlideIn 0.3s ease;
}

.toast-alert .btn-close {
    padding: 0.6rem;
    font-size: 0.65rem;
}

.toast-alert.alert-success {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #1b5e20;
    border-left: 4px solid #43a047;
}

.toast-alert.alert-danger {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: #b71c1c;
    border-left: 4px solid #e53935;
}

.toast-alert.alert-info {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #0d47a1;
    border-left: 4px solid #1e88e5;
}

.toast-alert.alert-warning {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    color: #e65100;
    border-left: 4px solid #ffb300;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

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

.modal.show.d-block {
    z-index: 1050;
}

.progress-bar {
    background: linear-gradient(90deg, #1565c0, #00bcd4, #7c4dff);
}

.header-title {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #69f0ae, #00e676);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.8);
    animation: pulse 2s infinite;
}

/* ===== Scrollable Data Grids ===== */
.table-scroll {
    max-height: min(480px, 65vh);
    overflow-y: auto;
    overflow-x: auto;
}

.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: inherit;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

.card .table-scroll thead th {
    background: #f8f9fa;
}

.table-scroll thead.table-dark th {
    background: #212529;
}

.table-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: #90caf9;
    border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-track {
    background: #f0f4f8;
}

/* ===== Requests DataGrid ===== */
.requests-grid .desc-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.requests-grid .items-cell {
    max-width: 180px;
    font-size: 0.85rem;
}

/* ===== Compact Forms & Pages ===== */
.page-header-compact {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
}

.page-header-compact h1 {
    font-size: 1.25rem;
    margin-bottom: 0.1rem;
}

.compact-card .card-header {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.compact-form {
    padding: 0.5rem 0.75rem !important;
}

.compact-form .form-label-sm {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.compact-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1565c0;
    margin-bottom: 0.35rem;
}

.table-scroll-compact {
    max-height: min(420px, 60vh);
}

.quotation-preview-img-compact {
    max-width: 100%;
    max-height: 280px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    object-fit: contain;
}

.quotation-preview-pdf-compact {
    width: 100%;
    height: 320px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

@media (max-width: 767.98px) {
    .requests-grid .desc-cell,
    .requests-grid .items-cell {
        max-width: 120px;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.user-info {
    border-bottom: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 0.5rem;
}

/* ===== Quotation Preview ===== */
.quotation-preview-img {
    max-width: 100%;
    max-height: 420px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    object-fit: contain;
}

.quotation-preview-pdf {
    width: 100%;
    min-height: 400px;
    height: 55vh;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 767.98px) {
    .page-header {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.35rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .stat-card .stat-label {
        font-size: 0.75rem;
    }

    .card-header {
        font-size: 0.9rem;
    }

    .request-card .card-body {
        padding: 1rem;
    }

    .quotation-preview-pdf {
        min-height: 280px;
        height: 45vh;
    }

    .toast-alert {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        min-width: unset;
        max-width: unset;
    }

    .table-scroll {
        max-height: min(360px, 50vh);
    }

    .btn {
        font-size: 0.875rem;
    }
}

@media (max-width: 575.98px) {
    .content {
        padding-top: 0.5rem;
    }

    .page-header .badge {
        font-size: 0.7rem;
    }
}

.brand-icon {
    margin-right: 0.25rem;
}
