/* =============================================
   TIPREON - Main Stylesheet
   White / Light Theme  ·  Orange Brand
   ============================================= */

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

:root {
  /* Backgrounds */
  --bg-base:       #F7F4F1;
  --bg-secondary:  #FFFFFF;
  --bg-card:       #FFFFFF;
  --bg-card-hover: #FFF8F3;
  --bg-muted:      #F3EEEA;

  /* Borders */
  --border:        #E8E0D8;
  --border-hover:  #F97316;
  --border-focus:  #F97316;

  /* Brand — Orange */
  --primary:        #F97316;
  --primary-dark:   #EA6C0A;
  --primary-light:  #FED7AA;
  --primary-glow:   rgba(249,115,22,0.18);
  --primary-glow2:  rgba(249,115,22,0.07);

  /* Accent */
  --red:     #EF4444;
  --green:   #22C55E;
  --blue:    #3B82F6;
  --purple:  #8B5CF6;
  --yellow:  #F59E0B;
  --cyan:    #06B6D4;
  --orange:  #F97316;

  /* Text */
  --text:       #0F172A;
  --text-dim:   #334155;
  --text-muted: #94A3B8;
  --text-light: #CBD5E1;

  /* Sidebar */
  --sidebar-width: 256px;
  --header-height: 68px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:   0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm:   0 4px 6px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.05);
  --shadow-md:   0 10px 24px rgba(15,23,42,0.08), 0 4px 8px rgba(15,23,42,0.04);
  --shadow-lg:   0 20px 48px rgba(15,23,42,0.10), 0 8px 16px rgba(15,23,42,0.05);
  --shadow-xl:   0 32px 64px rgba(15,23,42,0.12);
  --shadow-brand: 0 8px 32px rgba(249,115,22,0.28);
  --shadow-card: 0 2px 8px rgba(15,23,42,0.06);

  --transition:      all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-slow: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =============================================
   BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(249,115,22,0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(239,68,68,0.06), transparent 50%),
    var(--bg-base);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, .stat-value, .header-title, .logo-name {
  font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-muted); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* =============================================
   KEYFRAME ANIMATIONS
   ============================================= */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp  { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown{ from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInLeft{ from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInRight{ from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
@keyframes float     { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes floatSlow { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-18px) rotate(4deg); } }
@keyframes shimmer   { 0% { background-position: -200% center; } 100% { background-position: 200% center; } }
@keyframes gradientFlow { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes pulse-dot { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.5; transform:scale(.8); } }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(249,115,22,0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(249,115,22,0); }
  100% { box-shadow: 0 0 0 0 rgba(249,115,22,0); }
}
@keyframes ripple    { 0% { transform: scale(0); opacity:.6; } 100% { transform: scale(4); opacity:0; } }
@keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes countUp   { from { opacity:0; transform:scale(.7); } to { opacity:1; transform:scale(1); } }
@keyframes spin      { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
@keyframes blobAnim  { 0%,100% { border-radius:60% 40% 30% 70%/60% 30% 70% 40%; } 50% { border-radius:30% 60% 70% 40%/50% 60% 30% 60%; } }
@keyframes scaleIn   { from { opacity:0; transform:scale(.92); } to { opacity:1; transform:scale(1); } }
@keyframes slideUpSoft { from { opacity:0; transform:translateY(40px) scale(.98); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes glowPulse {
  0%,100% { box-shadow: 0 4px 14px rgba(249,115,22,0.28); }
  50% { box-shadow: 0 8px 28px rgba(249,115,22,0.45); }
}
@keyframes orbitDrift {
  0% { transform: translate(0,0) scale(1); }
  33% { transform: translate(18px,-12px) scale(1.05); }
  66% { transform: translate(-10px,14px) scale(.96); }
  100% { transform: translate(0,0) scale(1); }
}
@keyframes sheen {
  0% { transform: translateX(-120%) skewX(-18deg); }
  100% { transform: translateX(220%) skewX(-18deg); }
}
@keyframes toastIn {
  from { opacity:0; transform: translateY(24px) scale(.96); }
  to { opacity:1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity:0; transform: translateY(12px) scale(.96); }
}

/* =============================================
   LOGO COMPONENT
   ============================================= */
.logo-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #F97316, #EF4444);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(249,115,22,0.35);
}
.logo-icon svg { width: 20px; height: 20px; }
.logo-text-wrap .logo-name {
  font-size: 20px; font-weight: 900; color: var(--text);
  letter-spacing: -0.5px; line-height: 1;
}
.logo-text-wrap .logo-sub {
  font-size: 10px; color: var(--text-muted); font-weight: 500;
  letter-spacing: 1.5px; text-transform: uppercase;
}
/* White variant */
.logo-mark.white .logo-icon { background: rgba(255,255,255,0.2); box-shadow: none; }
.logo-mark.white .logo-name { color: #fff; }
.logo-mark.white .logo-sub  { color: rgba(255,255,255,0.6); }

/* Large logo */
.logo-mark.lg .logo-icon { width: 48px; height: 48px; border-radius: 14px; }
.logo-mark.lg .logo-icon svg { width: 28px; height: 28px; }
.logo-mark.lg .logo-name { font-size: 26px; }

/* =============================================
   LAYOUT — DASHBOARD
   ============================================= */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  z-index: 100;
  animation: slideInLeft 0.35s ease;
  box-shadow: var(--shadow-xs);
}
.sidebar-logo {
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-close {
  display: none;
  width: 36px; height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-dim);
  align-items: center; justify-content: center;
  cursor: pointer;
}
@media (max-width: 768px) {
  .sidebar-close { display: inline-flex; }
}
.sidebar-nav {
  flex: 1; padding: 14px 12px;
  overflow-y: auto;
}
.sidebar-section-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-dim); font-size: 14px; font-weight: 500;
  transition: var(--transition); margin-bottom: 2px;
  position: relative;
}
.sidebar-link i { width: 18px; font-size: 14px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { color: var(--primary); background: var(--primary-glow2); }
.sidebar-link.active {
  color: var(--primary); background: var(--primary-glow2);
  font-weight: 600;
}
.sidebar-link.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.sidebar-link .badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: var(--radius-full);
}
.sidebar-link .badge.red { background: var(--red); }
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition);
}
.sidebar-user:hover { background: var(--bg-muted); }
.sidebar-user .s-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user .name { font-size: 13px; font-weight: 600; color: var(--text); }
.sidebar-user .role { font-size: 11px; color: var(--text-muted); }

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

/* TOP HEADER */
.top-header {
  height: var(--header-height);
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-xs);
  animation: fadeInDown 0.35s ease;
}
.header-title { font-size: 18px; font-weight: 700; color: var(--text); flex: 1; }
.header-search { flex: 1; max-width: 340px; position: relative; }
.header-search input {
  width: 100%;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 9px 16px 9px 40px;
  color: var(--text); font-size: 14px; outline: none;
  transition: var(--transition);
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-glow2); }
.header-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-icon-btn {
  width: 38px; height: 38px;
  background: var(--bg-muted); border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 15px;
  transition: var(--transition); position: relative;
}
.header-icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow2); }
.header-icon-btn .notif-dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px;
  background: var(--red); border-radius: 50%;
  border: 2px solid #fff;
  animation: pulse-dot 2s infinite;
}
.header-avatar {
  width: 38px; height: 38px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  cursor: pointer; border: 2px solid transparent; transition: var(--transition);
}
.header-avatar:hover { border-color: var(--primary); }

/* PAGE CONTENT */
.page-content {
  padding: 28px; flex: 1;
  animation: fadeIn 0.4s ease;
}

/* =============================================
   COMPONENTS
   ============================================= */

/* CARDS */
.card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card-title   { font-size: 16px; font-weight: 700; color: var(--text); }
.card-subtitle{ font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.card-header  {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 20px;
}

/* STAT CARDS */
.stat-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%; opacity: 0.06;
  transform: translate(20px, -20px);
}
.stat-card.orange::after { background: var(--orange); }
.stat-card.green::after  { background: var(--green); }
.stat-card.blue::after   { background: var(--blue); }
.stat-card.purple::after { background: var(--purple); }
.stat-card.red::after    { background: var(--red); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 16px;
}
.stat-icon.orange { background: #FFF7ED; color: var(--orange); }
.stat-icon.green  { background: #F0FDF4; color: var(--green); }
.stat-icon.blue   { background: #EFF6FF; color: var(--blue); }
.stat-icon.purple { background: #F5F3FF; color: var(--purple); }
.stat-icon.red    { background: #FEF2F2; color: var(--red); }
.stat-icon.cyan   { background: #ECFEFF; color: var(--cyan); }

.stat-value {
  font-size: 28px; font-weight: 800;
  color: var(--text); letter-spacing: -1px;
  animation: countUp 0.5s ease;
}
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-change {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: var(--radius-full);
  margin-top: 10px;
}
.stat-change.up   { background: #F0FDF4; color: var(--green); }
.stat-change.down { background: #FEF2F2; color: var(--red); }
.stat-change.neutral { background: var(--bg-muted); color: var(--text-muted); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  border: none; outline: none;
  transition: var(--transition);
  cursor: pointer; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #F97316, #EF4444);
  color: #fff;
  box-shadow: 0 4px 14px rgba(249,115,22,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(249,115,22,0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--primary-glow2);
  color: var(--primary);
  border: 1.5px solid var(--primary-light);
}
.btn-secondary:hover { background: var(--primary-light); }
.btn-ghost {
  background: #fff; border: 1.5px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow2); }
.btn-muted {
  background: var(--bg-muted); border: 1.5px solid var(--border);
  color: var(--text-dim);
}
.btn-muted:hover { background: var(--border); color: var(--text); }
.btn-danger {
  background: #FEF2F2; border: 1.5px solid #FECACA;
  color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-success {
  background: #F0FDF4; border: 1.5px solid #BBF7D0;
  color: var(--green);
}
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm  { padding: 7px 14px; font-size: 13px; }
.btn-xs  { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg  { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-xl  { padding: 17px 36px; font-size: 17px; border-radius: var(--radius-xl); font-weight: 700; }

/* TAGS / BADGES */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
}
.tag-orange { background: #FFF7ED; color: var(--orange); border: 1px solid #FED7AA; }
.tag-green  { background: #F0FDF4; color: var(--green);  border: 1px solid #BBF7D0; }
.tag-blue   { background: #EFF6FF; color: var(--blue);   border: 1px solid #BFDBFE; }
.tag-purple { background: #F5F3FF; color: var(--purple); border: 1px solid #DDD6FE; }
.tag-red    { background: #FEF2F2; color: var(--red);    border: 1px solid #FECACA; }
.tag-yellow { background: #FFFBEB; color: var(--yellow); border: 1px solid #FDE68A; }
.tag-gray   { background: var(--bg-muted); color: var(--text-muted); border: 1px solid var(--border); }

/* AVATAR */
.avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; border-radius: var(--radius-full); flex-shrink: 0;
  color: #fff;
}
.avatar-sm  { width: 32px; height: 32px; font-size: 12px; }
.avatar-md  { width: 44px; height: 44px; font-size: 16px; }
.avatar-lg  { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl  { width: 80px; height: 80px; font-size: 28px; }

/* FORMS */
.form-group  { margin-bottom: 18px; }
.form-label  {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 7px; letter-spacing: 0.2px;
}
.form-input {
  width: 100%;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px; color: var(--text);
  font-size: 14px; outline: none; transition: var(--transition);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow2); }
.form-select {
  width: 100%;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px; color: var(--text);
  font-size: 14px; outline: none; transition: var(--transition);
  appearance: none; cursor: pointer;
}
.form-select:focus { border-color: var(--primary); }
.form-textarea { min-height: 96px; resize: vertical; }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 11px 16px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
  background: var(--bg-muted);
  white-space: nowrap;
}
.data-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.data-table td {
  padding: 14px 16px; font-size: 14px;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: #FAFAFA; }
.data-table tr:last-child td { border-bottom: none; }

/* GRID */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }

/* PROGRESS BAR */
.progress-bar-wrap {
  background: var(--bg-muted); border-radius: var(--radius-full);
  overflow: hidden; height: 6px;
}
.progress-bar-fill {
  height: 100%; border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), #EF4444);
  transition: width 1s ease;
}

/* DIVIDER */
.divider { border: none; border-top: 1.5px solid var(--border); margin: 20px 0; }

/* TOGGLE SWITCH */
.toggle-switch {
  width: 44px; height: 24px; border-radius: var(--radius-full);
  background: var(--border); position: relative;
  transition: var(--transition); cursor: pointer; border: none; outline: none;
}
.toggle-switch::after {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%; background: #fff;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.toggle-switch.on { background: var(--primary); }
.toggle-switch.on::after { left: 23px; }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.35s ease;
  z-index: 9999; max-width: 340px;
}
.toast i { font-size: 18px; flex-shrink: 0; }
.toast .toast-text { font-size: 14px; font-weight: 600; color: var(--text); }
.toast .toast-sub  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* MODAL — supports both .modal-overlay and legacy .modal shells */
.modal-overlay,
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open,
.modal.open,
.modal[style*="display: flex"],
.modal[style*="display:flex"] {
  display: flex !important;
}
.modal-box,
.modal-content {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.3s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title { font-size: 18px; font-weight: 800; color: var(--text); }
.modal-close {
  background: none; border: none; font-size: 24px; line-height: 1;
  color: var(--text-muted); cursor: pointer;
}

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 48px; color: var(--text-light); margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text-dim); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; color: var(--text-muted); }

/* =============================================
   ANIMATION UTILITY CLASSES
   ============================================= */
.animate-fade-in    { animation: fadeIn 0.4s ease both; }
.animate-fade-up    { animation: fadeInUp 0.45s ease both; }
.animate-fade-left  { animation: fadeInLeft 0.45s ease both; }
.animate-fade-right { animation: fadeInRight 0.45s ease both; }
.animate-float      { animation: float 4s ease-in-out infinite; }
.animate-float-slow { animation: floatSlow 6s ease-in-out infinite; }

.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }
.delay-4 { animation-delay: 0.32s; }
.delay-5 { animation-delay: 0.40s; }
.delay-6 { animation-delay: 0.48s; }

/* =============================================
   RESPONSIVE — GLOBAL
   ============================================= */

/* Mobile menu toggle + dim overlay (panel) */
.menu-toggle {
  display: none;
  width: 42px; height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: var(--transition);
}
.menu-toggle:hover { border-color: var(--primary); color: var(--primary); }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 90;
  opacity: 0;
  transition: opacity .25s ease;
}
.sidebar-overlay.show { display: block; opacity: 1; }
body.sidebar-open { overflow: hidden; }

/* Tables: never blow out the viewport */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive table,
.card .data-table {
  width: 100%;
  min-width: 560px;
}

/* Safe images / media */
img, video, canvas, svg { max-width: 100%; height: auto; }
.page-content { max-width: 100%; overflow-x: clip; }
.main-content { max-width: 100%; min-width: 0; }

.hide-mobile { display: initial; }
.show-mobile { display: none !important; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px;
    padding: 22px 20px !important;
  }
}

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: inline-flex !important; }

  .menu-toggle { display: inline-flex; }

  .sidebar {
    transform: translateX(-105%);
    transition: transform .3s cubic-bezier(0.22, 1, 0.36, 1);
    width: min(288px, 86vw);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .2);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; width: 100%; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 14px; }

  .page-content { padding: 14px 12px 28px; }
  .top-header {
    padding: 0 12px;
    height: 60px;
    gap: 8px;
  }
  .header-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-search { display: none; }
  .header-actions .btn span,
  .header-actions .btn .btn-label { display: none; }
  .header-actions .btn { padding: 8px 10px; }
  #notifPanel {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    top: 68px !important;
    max-height: min(70vh, 420px);
  }

  .card { padding: 16px; border-radius: 16px; }
  .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }

  .btn, .btn-primary, .btn-ghost, .btn-outline {
    min-height: 42px;
  }
  .form-input, .form-select, .field input, .field select, .field textarea {
    font-size: 16px; /* prevents iOS zoom */
  }

  .amt-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .pay-grid { grid-template-columns: 1fr !important; }
  .earner-pick-grid { grid-template-columns: repeat(2, 1fr) !important; }

  .modal { padding: 12px; align-items: flex-end; }
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 12px 12px;
  }

  .auth-card { padding: 28px 20px !important; border-radius: 20px !important; }
  .auth-title { font-size: 24px !important; }

  .success-card, .tp-card { margin: 0 4px; }
  .tp-wrap { padding: 24px 12px 48px !important; }
  .tp-head, .tp-body { padding: 24px 18px !important; }
  .amount-big { font-size: 36px !important; }

  .actions { flex-direction: column; }
  .actions a { width: 100%; }

  .discovers-grid,
  .disc-head { flex-wrap: wrap; }

  /* Inline grids used in blades */
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns:repeat(2,1fr);gap:14px"] {
    grid-template-columns: 1fr !important;
  }

  .welcome-banner {
    flex-wrap: wrap;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .grid-4, .grid-3, .grid-2 { gap: 10px; }
  .page-content { padding: 12px 10px 24px; }
  .header-title { font-size: 14px; max-width: 42vw; }
  .earner-pick-grid { grid-template-columns: 1fr !important; }
  .stat-value { font-size: 20px; }
  .welcome-banner { padding: 18px 14px !important; }
  .welcome-banner > div:last-child { font-size: 28px !important; }
}

/* =============================================
   SHARED LOGO HTML HELPER
   (included via JS snippet in all pages)
   ============================================= */
.logo-svg-icon {
  fill: none;
}

/* =============================================
   DESIGN SYSTEM ENHANCEMENTS + MOTION
   ============================================= */

/* Scroll reveal — only when JS marks .js-reveal-ready */
html.js-reveal-ready .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
  will-change: opacity, transform;
}
html.js-reveal-ready .reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 1;
  transform: none;
}
html.js-reveal-ready .reveal-left {
  opacity: 0;
  transform: translateX(-36px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
html.js-reveal-ready .reveal-left.revealed { opacity: 1; transform: translateX(0); }
.reveal-scale { opacity: 1; transform: none; }
html.js-reveal-ready .reveal-scale {
  opacity: 0;
  transform: scale(.94);
  transition: opacity .65s var(--ease-out), transform .65s var(--ease-spring);
}
html.js-reveal-ready .reveal-scale.revealed { opacity: 1; transform: scale(1); }

html.js-reveal-ready .stagger > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .55s var(--ease-out), transform .55s var(--ease-out);
}
html.js-reveal-ready .stagger.revealed > *:nth-child(1) { transition-delay: .04s; }
html.js-reveal-ready .stagger.revealed > *:nth-child(2) { transition-delay: .10s; }
html.js-reveal-ready .stagger.revealed > *:nth-child(3) { transition-delay: .16s; }
html.js-reveal-ready .stagger.revealed > *:nth-child(4) { transition-delay: .22s; }
html.js-reveal-ready .stagger.revealed > *:nth-child(5) { transition-delay: .28s; }
html.js-reveal-ready .stagger.revealed > *:nth-child(6) { transition-delay: .34s; }
html.js-reveal-ready .stagger.revealed > *:nth-child(7) { transition-delay: .40s; }
html.js-reveal-ready .stagger.revealed > *:nth-child(8) { transition-delay: .46s; }
html.js-reveal-ready .stagger.revealed > * {
  opacity: 1;
  transform: translateY(0);
}

.page-enter {
  animation: slideUpSoft .55s var(--ease-out) both;
}

.card, .stat-card {
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), border-color .35s ease;
}
.card:hover, .stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #F5D0B0;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(249,115,22,.04));
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.stat-card:hover::before { opacity: 1; }

.btn-primary {
  position: relative;
  overflow: hidden;
  animation: glowPulse 3.5s ease-in-out infinite;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-120%) skewX(-18deg);
  pointer-events: none;
}
.btn-primary:hover::after {
  animation: sheen .75s ease;
}
.btn-primary:hover {
  animation: none;
}

.sidebar-link {
  transition: background .25s var(--ease-out), color .25s ease, transform .25s var(--ease-out), box-shadow .25s ease;
}
.sidebar-link:hover {
  transform: translateX(3px);
}
.sidebar-link.active {
  box-shadow: inset 0 0 0 1px rgba(249,115,22,.12);
}

.logo-icon, .brand-mark, .lg-mark {
  transition: transform .35s var(--ease-spring), box-shadow .35s ease;
}
.logo-mark:hover .logo-icon,
.brand-link:hover .brand-mark,
.auth-logo:hover .lg-mark {
  transform: rotate(-6deg) scale(1.06);
  box-shadow: 0 10px 28px rgba(249,115,22,.45);
}

.top-header {
  backdrop-filter: blur(14px);
  background: rgba(255,255,255,.86);
}
.page-content {
  animation: slideUpSoft .5s var(--ease-out) both;
}

.data-table tr {
  transition: background .2s ease, transform .2s ease;
}
.data-table tr:hover td {
  background: #FFF8F3;
}

.toast {
  animation: toastIn .4s var(--ease-spring) both;
}

.form-input:focus, .form-select:focus, .field input:focus, .field select:focus {
  transform: translateY(-1px);
}

/* Ambient floating orbs for auth / marketing shells */
.ambient-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.ambient-orbs .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .55;
  animation: orbitDrift 14s ease-in-out infinite;
}
.ambient-orbs .orb.o1 {
  width: 280px; height: 280px;
  top: -60px; left: -40px;
  background: rgba(249,115,22,.28);
}
.ambient-orbs .orb.o2 {
  width: 320px; height: 320px;
  bottom: -80px; right: -60px;
  background: rgba(239,68,68,.22);
  animation-delay: -4s;
}
.ambient-orbs .orb.o3 {
  width: 180px; height: 180px;
  top: 40%; left: 55%;
  background: rgba(251,146,60,.18);
  animation-delay: -8s;
}

.skeleton {
  background: linear-gradient(90deg, #F1EBE6 25%, #FAF6F2 50%, #F1EBE6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-md);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal, .reveal-left, .reveal-scale, .stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
