/* ============================================================
   PHARMA REIMBURSEMENT SYSTEM - GLOBAL STYLES
   Clean, professional, medical-industry feel
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
    --primary:      #0A6E5C;
    --primary-dk:   #074d40;
    --primary-lt:   #e8f5f2;
    --accent:       #F0A500;
    --accent-lt:    #fff8e6;
    --danger:       #d63447;
    --danger-lt:    #fdeef0;
    --success:      #1a7a4a;
    --success-lt:   #eaf6ef;
    --warn:         #e07b00;
    --warn-lt:      #fff3e0;
    --text:         #1a1f2e;
    --text-muted:   #6b7280;
    --border:       #e2e8f0;
    --bg:           #f4f7f9;
    --white:        #ffffff;
    --sidebar-w:    240px;
    --radius:       10px;
    --shadow:       0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

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

/* ---- LAYOUT ---- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--primary-dk);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.sidebar-brand small {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    font-weight: 400;
}

.sidebar-user {
    padding: 14px 18px;
    background: rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #1a1f2e;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-info strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section {
    padding: 8px 18px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: rgba(255,255,255,0.75);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; border-left-color: var(--accent); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-logout {
    display: flex; align-items: center; gap: 8px;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    cursor: pointer;
    background: none; border: none; width: 100%;
    padding: 6px 0;
    transition: color 0.15s;
}
.btn-logout:hover { color: #fff; }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}

.page-title { font-size: 17px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 12px; color: var(--text-muted); }

.content { padding: 28px; }

/* ---- CARDS ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.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: 15px; font-weight: 600; }
.card-body { padding: 22px; }

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 14px;
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #e8f0fe; }
.stat-icon.green  { background: var(--success-lt); }
.stat-icon.red    { background: var(--danger-lt); }
.stat-icon.orange { background: var(--accent-lt); }

.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
}

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning   { background: var(--accent); color: #1a1f2e; }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-lt); }
.btn-sm        { padding: 6px 12px; font-size: 12px; }
.btn-lg        { padding: 12px 24px; font-size: 15px; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-label span { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 13.5px;
    font-family: 'DM Sans', sans-serif;
    background: var(--white);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,110,92,0.1); }
.form-control.is-invalid { border-color: var(--danger); }

.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.invalid-feedback { font-size: 12px; color: var(--danger); margin-top: 4px; display: none; }
.is-invalid ~ .invalid-feedback { display: block; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
th {
    padding: 11px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13.5px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-pending  { background: var(--warn-lt);    color: var(--warn); }
.badge-reviewed { background: #e8f0fe;           color: #1a56c4; }
.badge-closed   { background: var(--success-lt); color: var(--success); }
.badge-approved { background: var(--success-lt); color: var(--success); }
.badge-rejected { background: var(--danger-lt);  color: var(--danger); }

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: var(--success-lt); color: var(--success); border: 1px solid #b7e4ca; }
.alert-danger  { background: var(--danger-lt);  color: var(--danger);  border: 1px solid #f5b8bf; }
.alert-warning { background: var(--warn-lt);    color: var(--warn);    border: 1px solid #fcd580; }
.alert-info    { background: #e8f0fe;           color: #1a56c4;        border: 1px solid #bdd0fb; }

/* ---- LINE ITEM CARD ---- */
.line-item-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.line-item-card:hover { border-color: var(--primary); }

.line-item-header {
    background: #f8fafc;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.line-item-header strong { font-size: 13px; font-weight: 600; }
.line-item-body { padding: 16px; }

.item-approved { border-color: var(--success) !important; }
.item-approved .line-item-header { background: var(--success-lt); }
.item-rejected { border-color: var(--danger) !important; }
.item-rejected .line-item-header { background: var(--danger-lt); }

/* ---- PHOTO PREVIEW ---- */
.photo-preview {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.photo-preview:hover { border-color: var(--primary); background: var(--primary-lt); }
.photo-preview img { max-height: 120px; max-width: 100%; border-radius: 6px; }
.photo-preview .upload-placeholder { color: var(--text-muted); font-size: 13px; }
.photo-preview .upload-icon { font-size: 32px; margin-bottom: 6px; }

/* ---- RM PHOTO VERIFY ---- */
.photo-lock {
    background: var(--warn-lt);
    border: 1.5px solid #fcd580;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--warn);
}

.btn-view-photo {
    background: var(--primary);
    color: #fff;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dk) 0%, var(--primary) 60%, #1a9d82 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 16px;
    padding: 44px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 56px; height: 56px;
    background: var(--primary-lt);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    margin: 0 auto 12px;
}

.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ---- MISC ---- */
.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

.filter-bar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.amount-total {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .form-row.cols-2,
    .form-row.cols-3,
    .form-row.cols-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
