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

:root {
    --primary: #E92E44;
    --primary-dark: #c41e32;
    --primary-light: #FFE5E5;
    --success: #28a745;
    --warning: #fd7e14;
    --danger: #dc3545;
    --gray: #6c757d;
    --gray-light: #f8f9fa;
    --border: rgba(189,189,189,0.4);
    --text: #252525;
    --card-bg: #ffffff;
    --sidebar-width: 240px;
}

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

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

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

/* ========== LAYOUT ========== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: #1a1a2e;
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}

.sidebar-logo span {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.sidebar nav { padding: 12px 0; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(233,46,68,0.15);
    color: #fff;
    border-left-color: var(--primary);
    text-decoration: none;
}

.sidebar nav a .icon { font-size: 16px; width: 20px; text-align: center; }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar-title { font-size: 18px; font-weight: 600; color: var(--text); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.topbar-user .username {
    font-weight: 600;
    color: var(--text);
}

.page-content { padding: 24px; flex: 1; }

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text);
}

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

.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s;
}

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

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-card .stat-sub {
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
}

.stat-card.danger { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.free-card {
    border-left: 4px solid #FF0000;
    background: #fff8f8;
}
.stat-card.free-card .stat-value { color: #FF0000; }

.card {
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.card-body { padding: 20px; }

/* ========== TABLES ========== */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: #f8f9fa;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--gray);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover { background: #fafbfc; cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }

tr.row-free { background: #fff0f0 !important; }
tr.row-free:hover { background: #ffe8e8 !important; }
tr.row-sale { background: #f0fff4 !important; }
tr.row-sale:hover { background: #e6faea !important; }

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

.badge-lead { background: #fff3e0; color: #e65100; }
.badge-sale { background: #e8f5e9; color: #1b5e20; }
.badge-cancelled { background: #f5f5f5; color: #424242; }
.badge-refunded { background: #fce4ec; color: #880e4f; }
.badge-free {
    background: #FF0000;
    color: #fff;
    font-weight: 800;
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0%,100% { box-shadow: 0 0 0 0 rgba(255,0,0,0.4); }
    50% { box-shadow: 0 0 0 4px rgba(255,0,0,0); }
}

/* ========== FORMS ========== */
.form-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input[type=text],
input[type=email],
input[type=tel],
input[type=date],
input[type=number],
input[type=password],
select,
textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(233,46,68,0.1);
}

textarea { resize: vertical; min-height: 100px; }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}

.checkbox-group input[type=checkbox] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #1e7e34; color: #fff; text-decoration: none; }

.btn-secondary { background: #6c757d; color: #fff; border-color: #6c757d; }
.btn-secondary:hover { background: #545b62; color: #fff; text-decoration: none; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #bd2130; color: #fff; text-decoration: none; }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

.btn-icon { padding: 6px 10px; font-size: 14px; }

.action-btns { display: flex; gap: 6px; }

/* ========== FILTERS ========== */
.filter-bar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--gray); text-transform: uppercase; }
.filter-group select,
.filter-group input { min-width: 140px; padding: 7px 10px; font-size: 13px; }

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 16px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid var(--border);
    color: var(--text);
    transition: all 0.2s;
}

.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== LOGIN PAGE ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.login-logo h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.3;
}

.login-logo p {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

.login-box .form-group { margin-bottom: 16px; }
.login-box label { font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 6px; display: block; }
.login-box input { padding: 12px 16px; font-size: 14px; }

/* ========== ALERTS ========== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.alert-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.alert-warning { background: #fff8e1; color: #e65100; border: 1px solid #ffcc02; }
.alert-info { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }

.free-warning {
    background: #FF0000;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* ========== PET ROWS ========== */
.pet-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fafafa;
    position: relative;
}

.pet-row .pet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pet-row .pet-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray);
}

/* ========== FOLLOWUP LOG ========== */
.followup-log { max-height: 400px; overflow-y: auto; }

.followup-item {
    padding: 12px;
    border-left: 3px solid var(--primary);
    background: #fafafa;
    border-radius: 0 8px 8px 0;
    margin-bottom: 10px;
}

.followup-item .meta {
    font-size: 11px;
    color: var(--gray);
    margin-bottom: 4px;
    font-weight: 600;
}

.followup-item .note {
    font-size: 13px;
    color: var(--text);
    white-space: pre-wrap;
}

/* ========== CHARTS ========== */
.bar-chart { padding: 10px 0; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar-label { width: 100px; font-size: 12px; font-weight: 600; color: var(--gray); text-align: right; }
.bar-wrap { flex: 1; background: #f0f0f0; border-radius: 6px; height: 26px; overflow: hidden; }
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff6b81);
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    min-width: 30px;
    transition: width 0.8s ease;
}

/* ========== VIEW PAGE ========== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item { }
.detail-item .detail-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
    margin-bottom: 4px;
}

.detail-item .detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* ========== FOOTER ========== */
.footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--gray);
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

.footer a { color: var(--primary); font-weight: 600; }

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

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.page-header .breadcrumb {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

/* ========== OVERLAY SIDEBAR MOBILE ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ========== PRINT STYLES ========== */
@media print {
    .sidebar, .topbar, .btn, .action-btns, .filter-bar, .pagination, .footer { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    body { background: #fff; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open { display: block; }

    .main-content { margin-left: 0; }

    .hamburger { display: block; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .form-grid { grid-template-columns: 1fr; }

    .page-content { padding: 16px; }

    .topbar { padding: 0 16px; }

    .filter-bar { flex-direction: column; }
    .filter-group select, .filter-group input { min-width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-box { padding: 28px 20px; }
}

/* ========== MISC ========== */
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--gray); }
.text-center { text-align: center; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.tooltip-free {
    display: inline-block;
    background: #FF0000;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
}

.section-divider hr { flex: 1; border: none; border-top: 1px solid var(--border); }
.section-divider span { font-size: 12px; font-weight: 700; color: var(--gray); text-transform: uppercase; white-space: nowrap; }

/* Table checkbox */
.cb-select { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* Amount highlight */
.amount { font-weight: 700; color: var(--success); }
.amount-free { font-weight: 700; color: #FF0000; }

/* ── Notification Bell ── */
.notif-bell-wrap { position: relative; display: inline-flex; align-items: center; margin-right: 1rem; cursor: pointer; }
.notif-bell-wrap svg { width: 22px; height: 22px; color: rgba(255,255,255,0.85); transition: color 0.2s; }
.notif-bell-wrap:hover svg { color: #fff; }
.notif-count {
  position: absolute; top: -7px; right: -9px;
  background: #E92E44; color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: none; align-items: center; justify-content: center;
  padding: 0 4px; font-family: "Poppins", sans-serif;
  border: 2px solid #1a1a2e;
  animation: notif-pulse 2s infinite;
}
@keyframes notif-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.notif-dropdown {
  display: none; position: absolute;
  top: 38px; right: -10px;
  width: 330px; background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 99999; overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
}
.notif-dropdown.open { display: block; }
.notif-header {
  padding: 0.8rem 1rem;
  background: #E92E44; color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 0.85rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.notif-mark-all {
  font-size: 0.72rem; color: rgba(255,255,255,0.85);
  text-decoration: underline; cursor: pointer;
  background: none; border: none; font-family: "Poppins", sans-serif;
}
.notif-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer; transition: background 0.15s;
}
.notif-item:hover { background: #fff5f5; }
.notif-item:last-child { border-bottom: none; }
.notif-item-title { font-family: "Poppins", sans-serif; font-size: 0.82rem; font-weight: 600; color: #252525; }
.notif-item-msg { font-size: 0.75rem; color: #666; margin-top: 2px; line-height: 1.4; }
.notif-item-time { font-size: 0.68rem; color: #aaa; margin-top: 4px; }
.notif-empty { padding: 1.5rem; text-align: center; color: #aaa; font-size: 0.85rem; }


/* Bell Fix: Override all previous bell styles */
.notif-bell-wrap {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  cursor: pointer !important;
  margin-right: 1rem !important;
  padding: 0.3rem !important;
}
.notif-bell-wrap svg {
  width: 22px !important;
  height: 22px !important;
  color: #E92E44 !important;
  stroke: #E92E44 !important;
  fill: none !important;
}
.notif-bell-wrap:hover svg {
  color: #b5133f !important;
  stroke: #b5133f !important;
}
.notif-count {
  position: absolute !important;
  top: -5px !important;
  right: -8px !important;
  background: #E92E44 !important;
  color: #fff !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  min-width: 18px !important;
  height: 18px !important;
  border-radius: 9px !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 4px !important;
  font-family: "Poppins", sans-serif !important;
  border: 2px solid #fff !important;
  z-index: 10 !important;
}
.notif-count.has-notif {
  display: flex !important;
}
