/* =========================================================
   PrimeCare Pharmacy Management System — main stylesheet
   ========================================================= */

:root {
    --pc-blue: #1565C0;
    --pc-blue-dark: #0D3C73;
    --pc-blue-darker: #0A2C54;
    --pc-green: #2E9E3F;
    --pc-green-dark: #237A32;
    --pc-red: #D32F2F;
    --pc-amber: #F0A500;
    --pc-bg: #F4F7FB;
    --pc-card: #FFFFFF;
    --pc-text: #212A33;
    --pc-text-muted: #6B7785;
    --pc-border: #E3E8EF;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(13, 60, 115, 0.07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--pc-bg);
    color: var(--pc-text);
    font-size: 15px;
}

a { color: var(--pc-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, var(--pc-blue-darker), var(--pc-blue-dark));
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar .brand img { width: 36px; height: 36px; }
.sidebar .brand .brand-text { line-height: 1.15; }
.sidebar .brand .brand-text strong { font-size: 17px; display: block; }
.sidebar .brand .brand-text span { font-size: 11px; color: #BFD9FF; }

.sidebar nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #DCE9FB;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.07); text-decoration: none; }
.sidebar nav a.active {
    background: rgba(255,255,255,0.10);
    border-left-color: var(--pc-green);
    color: #fff;
    font-weight: 600;
}
.sidebar nav .nav-section {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .06em;
    color: #7FA8DC;
    padding: 16px 20px 6px;
}
.sidebar .sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.12);
    font-size: 12px;
    color: #9DBEE8;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--pc-card);
    border-bottom: 1px solid var(--pc-border);
    padding: 14px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar h1 { font-size: 19px; margin: 0; color: var(--pc-blue-dark); }
.topbar .user-chip {
    display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--pc-text-muted);
}
.topbar .user-chip .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--pc-green); color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}

.content { padding: 24px 26px; flex: 1; }

/* ---------- Cards / widgets ---------- */
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card {
    background: var(--pc-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}
.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-card .icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff; flex-shrink: 0;
}
.stat-card .icon.blue { background: var(--pc-blue); }
.stat-card .icon.green { background: var(--pc-green); }
.stat-card .icon.red { background: var(--pc-red); }
.stat-card .icon.amber { background: var(--pc-amber); }
.stat-card .label { font-size: 12.5px; color: var(--pc-text-muted); margin: 0 0 2px; }
.stat-card .value { font-size: 21px; font-weight: 700; margin: 0; }

.panel { background: var(--pc-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 22px; }
.panel h2, .panel h3 { margin-top: 0; color: var(--pc-blue-dark); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2, .panel-head h3 { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 7px; border: none;
    font-size: 14px; font-weight: 600; cursor: pointer;
    background: var(--pc-blue); color: #fff; text-decoration: none;
    transition: filter .15s ease;
}
.btn:hover { filter: brightness(0.92); text-decoration: none; }
.btn-green { background: var(--pc-green); }
.btn-red { background: var(--pc-red); }
.btn-outline { background: transparent; color: var(--pc-blue); border: 1px solid var(--pc-blue); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-gray { background: #6B7785; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--pc-text); }
input[type=text], input[type=number], input[type=password], input[type=email],
input[type=date], input[type=month], select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--pc-border);
    border-radius: 7px; font-size: 14px; background: #fff; color: var(--pc-text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pc-blue); }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

/* ---------- Tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--pc-border); text-align: left; }
table.data-table th { background: #F0F4FA; color: var(--pc-blue-dark); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
table.data-table tr:hover td { background: #FAFCFF; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 11.5px; font-weight: 700; }
.badge-red { background: #FDE7E7; color: var(--pc-red); }
.badge-amber { background: #FFF3DC; color: #9A6700; }
.badge-green { background: #E4F6E6; color: var(--pc-green-dark); }
.badge-gray { background: #EEF1F4; color: var(--pc-text-muted); }
.badge-blue { background: #E6F0FB; color: var(--pc-blue-dark); }
.row-low-stock td { background: #FFF7F0; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-warning { background: #FFF3DC; color: #8A6100; border: 1px solid #F4D88A; }
.alert-danger { background: #FDE7E7; color: #A12525; border: 1px solid #F3B6B6; }
.alert-success { background: #E4F6E6; color: #1F6E2D; border: 1px solid #B7E3BD; }
.alert-info { background: #E6F0FB; color: var(--pc-blue-dark); border: 1px solid #BBD8F4; }

/* ---------- Login page ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--pc-blue-darker), var(--pc-blue) 60%, var(--pc-green));
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    padding: 36px 34px; width: 100%; max-width: 380px; text-align: center;
}
.login-card img { width: 64px; height: 64px; margin-bottom: 10px; }
.login-card h1 { font-size: 20px; margin: 6px 0 4px; color: var(--pc-blue-dark); }
.login-card p.tagline { color: var(--pc-text-muted); font-size: 13px; margin-bottom: 22px; }
.login-card label { text-align: left; }
.login-card .form-actions { margin-top: 10px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; }

/* ---------- Print ---------- */
@media print {
    .no-print { display: none !important; }
    .sidebar, .topbar { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .panel { box-shadow: none; }
}

.print-header { text-align: center; margin-bottom: 18px; }
.print-header img { width: 56px; height: 56px; }
.print-header h1 { margin: 6px 0 0; color: var(--pc-blue-dark); }
.print-header p { margin: 2px 0; color: var(--pc-text-muted); font-size: 13px; }

.text-muted { color: var(--pc-text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.small { font-size: 12.5px; }
.tag-line-items { width: 100%; }
.dynamic-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }

@media (max-width: 800px) {
    .sidebar { position: fixed; left: -240px; transition: left .2s ease; z-index: 50; }
    .sidebar.open { left: 0; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .dynamic-row { grid-template-columns: 1fr; }
    .sidebar-toggle-btn { display: inline-flex !important; }
    .panel { overflow-x: auto; }
    table.data-table { min-width: 600px; }
}

@media (max-width: 1024px) and (min-width: 801px) {
    .sidebar { width: 200px; }
    .panel { overflow-x: auto; }
}
.sidebar-toggle-btn { display: none; }
