/* =============================================
   AgroDrop - Global Stylesheet
   Livestock Medicine Inventory System - Uganda
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
    --primary: #2e7d32;
    --secondary: #43a047;
    --accent: #66bb6a;
    --bg: #f1f8e9;
    --sidebar: #1b5e20;
    --sidebar-hover: #2e7d32;
    --white: #ffffff;
    --text: #212121;
    --text-light: #616161;
    --warning: #f57c00;
    --danger: #c62828;
    --danger-light: #ffebee;
    --warning-light: #fff3e0;
    --success-light: #e8f5e9;
    --info: #0288d1;
    --info-light: #e1f5fe;
    --border: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
}

button {
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

input,
select,
textarea {
    font-family: 'Poppins', sans-serif;
}

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 40%, #43a047 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(-30px, -30px) rotate(5deg);
    }
}

.login-container {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 50px 40px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
}

.login-logo h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
    position: relative;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.login-form .input-wrap {
    position: relative;
}

.login-form .input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 16px;
}

.login-form input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: #fafafa;
    color: var(--text);
}

.login-form input:focus {
    outline: none;
    border-color: var(--secondary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(67, 160, 71, 0.15);
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    letter-spacing: 0.5px;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-light);
}

.quick-login {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 20px;
}

.quick-login h4 {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.quick-login .q-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-login .q-btn {
    padding: 6px 12px;
    border: 1.5px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    transition: var(--transition);
}

.quick-login .q-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* ---- App Layout ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar) 0%, #143d17 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo .logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.sidebar-logo .logo-text h2 {
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-logo .logo-text span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section-title {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
}

.nav-item {
    padding: 0 12px;
    margin: 2px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 10px;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 400;
    position: relative;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    color: var(--white);
    font-weight: 500;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-user .user-info h4 {
    color: var(--white);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

.sidebar-user .user-info span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
    background: var(--white);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text);
    padding: 6px;
}

.page-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.page-title p {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 400;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-light);
    transition: var(--transition);
    position: relative;
}

.topbar-icon-btn:hover {
    background: var(--accent);
    color: var(--white);
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.topbar-user:hover {
    border-color: var(--accent);
}

.topbar-user .avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
}

.topbar-user .user-info h4 {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text);
}

.topbar-user .user-info span {
    font-size: 11px;
    color: var(--text-light);
}

.btn-logout {
    padding: 8px 16px;
    background: var(--danger-light);
    color: var(--danger);
    border: 1.5px solid rgba(198, 40, 40, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

/* ---- Page Content ---- */
.page-content {
    padding: 28px;
    flex: 1;
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.08;
    transform: translate(20px, -20px);
}

.stat-card.green::after {
    background: var(--primary);
}

.stat-card.orange::after {
    background: var(--warning);
}

.stat-card.red::after {
    background: var(--danger);
}

.stat-card.blue::after {
    background: var(--info);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.green {
    background: var(--success-light);
    color: var(--primary);
}

.stat-icon.orange {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.red {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-icon.blue {
    background: var(--info-light);
    color: var(--info);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 2px;
}

.stat-info .stat-change {
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

.stat-change.up {
    background: var(--success-light);
    color: var(--primary);
}

.stat-change.down {
    background: var(--danger-light);
    color: var(--danger);
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body {
    padding: 22px;
}

/* ---- Tables ---- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-light);
    background: #f8f9fa;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: var(--transition);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: #f9fbe7;
}

tbody td {
    padding: 13px 16px;
    color: var(--text);
    vertical-align: middle;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-light);
    color: var(--primary);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-secondary {
    background: #f5f5f5;
    color: #616161;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1.5px solid rgba(198, 40, 40, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1.5px solid rgba(245, 124, 0, 0.2);
}

.btn-warning:hover {
    background: var(--warning);
    color: var(--white);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
}

/* ---- Search & Filter Bar ---- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 15px;
}

.search-box input {
    width: 100%;
    padding: 9px 12px 9px 38px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    transition: var(--transition);
    background: var(--white);
    color: var(--text);
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(67, 160, 71, 0.12);
}

.filter-select {
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary);
}

/* ---- Modals ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9) translateY(-20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: var(--white);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Forms ---- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group label .req {
    color: var(--danger);
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    transition: var(--transition);
    background: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(67, 160, 71, 0.12);
}

.form-control.error {
    border-color: var(--danger);
}

.form-text {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--white);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    animation: toastIn 0.4s ease;
    border-left: 4px solid;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.toast.success {
    border-color: var(--primary);
}

.toast.error {
    border-color: var(--danger);
}

.toast.warning {
    border-color: var(--warning);
}

.toast.info {
    border-color: var(--info);
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: var(--success-light);
    color: var(--primary);
}

.toast.error .toast-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.toast.warning .toast-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.toast.info .toast-icon {
    background: var(--info-light);
    color: var(--info);
}

.toast-content h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.toast-content p {
    font-size: 12px;
    color: var(--text-light);
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
}

/* ---- Confirm Dialog ---- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(3px);
}

.confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: var(--white);
    border-radius: 16px;
    padding: 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
}

.confirm-overlay.active .confirm-dialog {
    transform: scale(1);
}

.confirm-icon {
    width: 64px;
    height: 64px;
    background: var(--danger-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--danger);
    margin: 0 auto 16px;
}

.confirm-dialog h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.confirm-dialog p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ---- Charts Grid ---- */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chart-card .card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.chart-wrapper {
    padding: 20px;
    position: relative;
}

/* ---- Bottom Grid ---- */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ---- Alert Rows ---- */
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.alert-dot.danger {
    background: var(--danger);
}

.alert-dot.warning {
    background: var(--warning);
}

.alert-dot.info {
    background: var(--info);
}

.alert-item-content p {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

.alert-item-content span {
    font-size: 11px;
    color: var(--text-light);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 48px;
    color: var(--border);
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.empty-state p {
    font-size: 13px;
}

/* ---- Reports ---- */
.report-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.report-tab {
    padding: 9px 20px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
}

.report-tab.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.report-tab:hover:not(.active) {
    border-color: var(--secondary);
    color: var(--primary);
}

.report-section {
    display: none;
}

.report-section.active {
    display: block;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--white);
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.summary-card .label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ---- Print Styles ---- */
@media print {

    .sidebar,
    .topbar,
    .toolbar,
    .btn,
    .report-tabs {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    body {
        background: white !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-light);
}

.pagination-controls {
    display: flex;
    gap: 6px;
}

.page-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--white);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.page-btn:hover:not(.active) {
    background: var(--bg);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Section Title ---- */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary);
}

/* ---- Grid Helpers ---- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-5 {
    margin-bottom: 20px;
}

.mt-3 {
    margin-top: 12px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-2 {
    gap: 8px;
}

/* ---- Medicine Category Pills ---- */
.category-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    background: var(--info-light);
    color: var(--info);
}

/* ---- Stock Level Indicator ---- */
.stock-level {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-width: 60px;
}

.stock-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.stock-bar-fill.high {
    background: var(--secondary);
}

.stock-bar-fill.medium {
    background: var(--warning);
}

.stock-bar-fill.low {
    background: var(--danger);
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-260px);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex !important;
    }

    .bottom-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-user .user-info {
        display: none;
    }

    .modal {
        max-height: 95vh;
    }
}

/* ---- Overlay for mobile sidebar ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 900px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* ---- Loading Spinner ---- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Role Badge ---- */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.role-admin {
    background: #e8eaf6;
    color: #3949ab;
}

.role-manager {
    background: var(--success-light);
    color: var(--primary);
}

.role-attendant {
    background: var(--info-light);
    color: var(--info);
}

/* ---- UGX Currency ---- */
.ugx {
    font-weight: 600;
}

/* Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}