/* ═══════════════════════════════════════════
   VetLink ERP - Modern UI v3
   ═══════════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #0f172a;
    --darker: #020617;
    --surface: #f8fafc;
    --sidebar-width: 270px;
    --topbar-height: 64px;
    --radius: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 14px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--surface); color: #334155; }
a { text-decoration: none; color: inherit; }
::selection { background: var(--primary); color: #fff; }

/* ─── Sidebar ─── */
.sidebar {
    position: fixed; top: 0; left: 0; z-index: 1040;
    width: var(--sidebar-width); height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    overflow-y: auto; transition: all .3s cubic-bezier(.4,0,.2,1);
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent;
    border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 22px; position: sticky; top: 0;
    background: linear-gradient(180deg, #0f172a 80%, transparent);
    z-index: 2;
}
.sidebar-brand .brand-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-brand h4 { color: #fff; margin: 0; font-weight: 700; font-size: 1.15rem; letter-spacing: -.3px; }
.sidebar-brand h4 span { font-weight: 300; opacity: .7; }

.sidebar-menu { padding: 8px 0 20px; }

/* ── Dropdown Group ── */
.sidebar-group { display: block; }
.sidebar-group-toggle {
    display: flex; align-items: center; padding: 10px 22px;
    color: rgba(255,255,255,.5); font-size: .72rem;
    text-transform: uppercase; letter-spacing: 1.8px;
    font-weight: 700; cursor: pointer; transition: all .2s;
    border: none; background: none; width: 100%; text-align: left;
    margin-top: 6px;
}
.sidebar-group-toggle:hover { color: rgba(255,255,255,.75); }
.sidebar-group-toggle .toggle-arrow {
    margin-left: auto; font-size: .6rem; transition: transform .25s ease;
    opacity: .4;
}
.sidebar-group.open .sidebar-group-toggle .toggle-arrow { transform: rotate(90deg); opacity: .7; }
.sidebar-group-toggle i:first-child {
    width: 18px; margin-right: 10px; font-size: .7rem; text-align: center;
    color: var(--primary-light); opacity: .6;
}
.sidebar-group-items {
    max-height: 0; overflow: hidden;
    transition: max-height .35s cubic-bezier(.4,0,.2,1);
}
.sidebar-group.open .sidebar-group-items { max-height: 600px; }

.sidebar-link {
    display: flex; align-items: center; padding: 9px 22px 9px 34px;
    color: rgba(255,255,255,.55); font-size: .84rem;
    transition: all .2s ease; border-left: 3px solid transparent;
    position: relative;
}
.sidebar-link::before {
    content: ''; position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; border-radius: 50%;
    background: rgba(255,255,255,.2); transition: all .2s;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.04); }
.sidebar-link:hover::before { background: var(--primary-light); }
.sidebar-link.active {
    color: #fff; background: linear-gradient(90deg, rgba(99,102,241,.15), transparent);
    border-left-color: var(--primary);
}
.sidebar-link.active::before { background: var(--primary); box-shadow: 0 0 6px rgba(99,102,241,.5); }
.sidebar-link i { width: 20px; margin-right: 10px; font-size: .9rem; text-align: center; }

/* Dashboard direct link */
.sidebar-link.sidebar-link-main {
    padding-left: 22px; font-weight: 600; font-size: .9rem;
    margin-bottom: 4px;
}
.sidebar-link.sidebar-link-main::before { display: none; }

.sidebar-logout {
    margin: 8px 14px; padding: 10px 18px; border-radius: 10px;
    background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.12);
    color: rgba(255,255,255,.5); display: flex; align-items: center;
    font-size: .85rem; transition: all .2s;
}
.sidebar-logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; }
.sidebar-logout i { width: 20px; margin-right: 10px; }

/* ─── Main Content ─── */
.main-content {
    margin-left: var(--sidebar-width); min-height: 100vh;
    transition: margin-left .3s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
}

/* ─── Top Bar ─── */
.topbar {
    height: var(--topbar-height); background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; border-bottom: 1px solid rgba(0,0,0,.06);
    position: sticky; top: 0; z-index: 1030;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left h5 {
    margin: 0; font-weight: 700; font-size: 1.15rem;
    color: var(--dark); letter-spacing: -.3px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 6px 12px 6px 6px; border-radius: 12px;
    transition: background .2s;
}
.topbar-user:hover { background: rgba(99,102,241,.06); }
.topbar-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

#sidebarToggle {
    background: none; border: none; font-size: 1.2rem; color: #64748b;
    cursor: pointer; padding: 6px; border-radius: 8px; transition: all .2s;
}
#sidebarToggle:hover { background: rgba(0,0,0,.04); color: var(--dark); }

/* ─── Content Area ─── */
.content-area { padding: 28px; flex: 1; }

/* ─── Footer ─── */
.admin-footer {
    padding: 16px 28px;
    text-align: center; font-size: .78rem; color: #94a3b8;
    border-top: 1px solid rgba(0,0,0,.04);
    background: #fff;
}
.admin-footer a { color: var(--primary); font-weight: 600; transition: color .2s; }
.admin-footer a:hover { color: var(--primary-dark); }

/* ─── Dashboard Cards ─── */
.stat-card {
    border: none; border-radius: 18px; padding: 24px;
    background: #fff; 
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.03);
    transition: all .4s cubic-bezier(.4,0,.2,1);
    position: relative; overflow: hidden;
    border-left: none;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 4px; height: 100%; border-radius: 4px 0 0 4px;
    background: inherit;
}
.stat-card::after {
    content: ''; position: absolute; top: -30px; right: -30px;
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,.05), transparent 70%);
    transition: transform .4s;
}
.stat-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 12px 36px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
}
.stat-card:hover::after {
    transform: scale(1.3);
}
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; margin-bottom: 16px;
    position: relative; z-index: 1;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.stat-card .stat-value { 
    font-size: 1.75rem; font-weight: 800; color: var(--dark); 
    margin-bottom: 4px; letter-spacing: -.5px; 
    position: relative; z-index: 1;
    line-height: 1.2;
}
.stat-card .stat-label { 
    font-size: .72rem; color: #94a3b8; text-transform: uppercase; 
    letter-spacing: 1px; font-weight: 700; 
    position: relative; z-index: 1;
}
.stat-card .stat-change { font-size: .75rem; margin-top: 8px; font-weight: 500; }

.bg-gradient-primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.bg-gradient-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.bg-gradient-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.bg-gradient-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.bg-gradient-info { background: linear-gradient(135deg, #06b6d4, #0891b2); color: #fff; }

.icon-primary { background: rgba(99,102,241,.1); color: var(--primary); }
.icon-success { background: rgba(16,185,129,.1); color: var(--success); }
.icon-warning { background: rgba(245,158,11,.1); color: var(--warning); }
.icon-danger { background: rgba(239,68,68,.1); color: var(--danger); }
.icon-info { background: rgba(6,182,212,.1); color: var(--info); }
.icon-secondary { background: rgba(139,92,246,.1); color: var(--secondary); }
.icon-cash { background: rgba(16,185,129,.08); color: #059669; }
.icon-bank { background: rgba(99,102,241,.08); color: #4f46e5; }

/* ─── Cards ─── */
.card {
    border: none; border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden; background: #fff;
}
.card-header {
    background: #fff; border-bottom: 1px solid #f1f5f9;
    padding: 16px 22px; font-weight: 600; font-size: .92rem; color: var(--dark);
}

/* ─── Tables ─── */
.table-hover tbody tr:hover { background: rgba(99,102,241,.02); }
.table th {
    font-weight: 600; font-size: .75rem; text-transform: uppercase;
    letter-spacing: .8px; color: #94a3b8; border-bottom: 1px solid #f1f5f9 !important;
    padding: 12px 16px;
}
.table td { vertical-align: middle; font-size: .88rem; padding: 12px 16px; color: #475569; }

/* ─── Status Badges ─── */
.badge-status { padding: 5px 14px; border-radius: 20px; font-size: .73rem; font-weight: 600; letter-spacing: .3px; }

/* ─── Chart Container ─── */
.chart-container { position: relative; height: 300px; }

/* ─── Settings Page ─── */
.settings-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
    overflow: hidden; margin-bottom: 24px;
}
.settings-card-header {
    padding: 20px 24px; display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid #f1f5f9;
}
.settings-card-header .settings-icon {
    width: 42px; height: 42px; border-radius: 10px; display: flex;
    align-items: center; justify-content: center; font-size: 1rem;
}
.settings-card-header h6 { margin: 0; font-weight: 700; font-size: 1rem; color: var(--dark); }
.settings-card-header p { margin: 0; font-size: .8rem; color: #94a3b8; }
.settings-card-body { padding: 24px; }
.settings-input {
    border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 10px 14px;
    transition: all .2s; font-size: .9rem;
}
.settings-input:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1);
    outline: none;
}

/* ─── Public Site ─── */
.public-navbar {
    background: rgba(255,255,255,.97) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 10px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}
.public-navbar.navbar-scrolled {
    background: rgba(255,255,255,.99) !important;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

/* ─── Auth Pages ─── */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center;
    justify-content: center; padding: 40px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}
.auth-card {
    width: 100%; max-width: 440px; background: #fff;
    border-radius: 18px; padding: 44px;
    box-shadow: 0 20px 60px rgba(0,0,0,.08);
}
.auth-card h3 { font-weight: 800; margin-bottom: 6px; color: var(--dark); }
.auth-card .subtitle { color: #94a3b8; margin-bottom: 28px; font-size: .9rem; }

/* ─── Responsive ─── */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); backdrop-filter: blur(4px); z-index: 1035;
}
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 16px; }
}

/* ─── Utility ─── */
.text-truncate-2 {
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.fw-600 { font-weight: 600; }
.fs-sm { font-size: .85rem; }
.border-start-4 { border-left-width: 4px !important; }
.glass-card {
    background: rgba(255,255,255,.7); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius);
}
