/* ========================================================
   BAYU ASIH SUPERAPP - PREMIUM GREEN THEME
   ======================================================== */

:root {
  /* Palette Warna Utama RSUD Bayu Asih (dari desain.md) */
  --primary-green: #009B4D;       /* Hijau Utama */
  --dark-green: #007a3d;          /* Hijau Gelap (Hover / Active) */
  --text-dark: #1e293b;           /* Font Utama (Charcoal Slate) */
  --text-muted: #64748b;          /* Font Keterangan / Muted Slate */
  --bg-light: #f8fafc;            /* Background Utama */
  --border-color: #e2e8f0;        /* Border Ringan */
  
  /* Status Colors */
  --danger-red: #ef4444;          /* Tombol Aksi Hapus / Logout */
  --danger-red-hover: #dc2626;
  --warning-yellow: #f59e0b;
  --success-green: #10b981;
  --info-blue: #3b82f6;

  /* Green Theme Colors mapped to original variables */
  --ba-gradient-start: var(--primary-green); /* Deep Emerald */
  --ba-gradient-end: #00b85c;   /* Bright Green Mint */
  
  --ba-primary: var(--primary-green);
  --ba-primary-dark: var(--dark-green);
  --ba-primary-light: #e6f7ef;
  
  --ba-bg-light: var(--bg-light);
  --ba-bg-card: #ffffff;
  --ba-border: var(--border-color);
  --ba-text-main: var(--text-dark);
  --ba-header-bg: rgba(255, 255, 255, 0.8);
  --ba-card-shadow: 0 4px 15px rgba(0, 155, 77, 0.08);
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] {
  --ba-bg-light: #0f172a;
  --ba-bg-card: #1e293b;
  --ba-border: #334155;
  --ba-text-main: #f8fafc;
  --ba-header-bg: rgba(30, 41, 59, 0.8);
  --ba-card-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  --ba-gradient-start: #34d399; /* Lighter in dark mode */
  --ba-gradient-end: #6ee7b7;
}

/* Base Overrides */
body {
  background-color: var(--ba-bg-light) !important;
  color: var(--ba-text-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Text Gradient Utility */
.text-gradient-primary {
  background: linear-gradient(135deg, var(--ba-gradient-start), var(--ba-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Header Styling */
.app-header {
  background: var(--ba-header-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ba-border) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- User Role Header Branding --- */
.header-brand-user {
  transition: opacity 0.2s ease;
}
.header-brand-user:hover {
  opacity: 0.85;
}
.header-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--ba-bg-card);
  border: 1px solid var(--ba-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(16,185,129,0.1);
  flex-shrink: 0;
}
.header-brand-logo img {
  height: 28px;
  width: auto;
  object-fit: contain;
}
.header-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.header-brand-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ba-text-main);
  letter-spacing: -0.3px;
}
.header-brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ba-primary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* --- Header Action Buttons --- */
.header-action-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--ba-border) !important;
  background: var(--ba-bg-card) !important;
  color: var(--ba-text-main) !important;
  transition: all 0.2s ease;
}
.header-action-btn:hover {
  background: var(--ba-primary-light) !important;
  border-color: var(--ba-primary) !important;
  color: var(--ba-primary) !important;
}
[data-bs-theme="dark"] .header-action-btn:hover {
  background: rgba(16,185,129,0.1) !important;
}

/* --- Header Divider --- */
.header-divider {
  width: 1px;
  height: 24px;
  background: var(--ba-border);
  margin: 0 0.5rem;
  flex-shrink: 0;
}

/* --- User Dropdown Trigger --- */
.header-user-dropdown {
  padding: 0.35rem 0.5rem;
  border-radius: 12px;
  transition: background 0.2s ease;
}
.header-user-dropdown:hover {
  background: rgba(16,185,129,0.05);
}
.header-user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ba-text-main);
  line-height: 1.2;
}
.header-user-role-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ba-primary);
  letter-spacing: 0.5px;
}

/* --- Avatar --- */
.header-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
}
.header-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--ba-border);
  transition: border-color 0.2s ease;
  image-rendering: -webkit-optimize-contrast;
}
.header-user-dropdown:hover .header-avatar img {
  border-color: var(--ba-primary);
}
.header-avatar-status {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid var(--ba-bg-card);
  z-index: 2;
}

/* --- Dropdown Menu --- */
.header-dropdown-menu {
  width: 240px;
  border-radius: 16px;
  border: 1px solid var(--ba-border);
  background: var(--ba-bg-card);
  box-shadow: 0 12px 35px rgba(0,0,0,0.1);
  padding: 0.5rem;
  overflow: hidden;
}
[data-bs-theme="dark"] .header-dropdown-menu {
  box-shadow: 0 12px 35px rgba(0,0,0,0.4);
}
.header-dropdown-profile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem;
  border-radius: 12px;
  background: var(--ba-bg-light);
}
[data-bs-theme="dark"] .header-dropdown-profile {
  background: rgba(15,23,42,0.5);
}
.header-dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.header-dropdown-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
}
.header-dropdown-menu .dropdown-item {
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.header-dropdown-menu .dropdown-item:hover {
  background: rgba(16,185,129,0.08);
  color: var(--ba-primary-dark);
}
.header-dropdown-menu .dropdown-divider {
  border-color: var(--ba-border);
  margin: 0.3rem 0;
}

/* Sidebar Styling */
.app-menubar {
  background: var(--ba-bg-card) !important;
  border-right: 1px solid var(--ba-border) !important;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.02) !important;
}

.menu-link.active {
  background: linear-gradient(135deg, var(--ba-gradient-start), var(--ba-gradient-end)) !important;
  color: white !important;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3) !important;
  border-radius: 10px;
}
.menu-link.active i {
  color: white !important;
}

/* Sidebar Hover Fix */
.menu-link:hover:not(.active) {
  background: var(--ba-primary-light) !important;
  color: var(--ba-primary-dark) !important;
  border-radius: 10px;
}
[data-bs-theme="dark"] .menu-link:hover:not(.active) {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #34d399 !important;
}
.menu-link:hover:not(.active) i {
  color: var(--ba-primary) !important;
}
[data-bs-theme="dark"] .menu-link:hover:not(.active) i {
  color: #34d399 !important;
}

/* Sidebar Menu Heading */
.menu-heading .menu-label {
  color: var(--ba-primary) !important;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Hide text logo when sidebar is minimized */
[data-app-sidebar="mini"] .app-navbar-brand h4 {
  display: none !important;
}

/* =====================================================
   DASHBOARD HERO
   ===================================================== */
.dashboard-hero {
  padding: 2rem 0 0;
}
.hero-logo-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border-radius: 24px;
  background: var(--ba-bg-card);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.15),
              inset 0 0 0 2px rgba(16, 185, 129, 0.12);
  animation: heroFloat 4s ease-in-out infinite;
}
.hero-logo-ring img {
  height: 55px;
  width: auto;
  object-fit: contain;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); box-shadow: 0 8px 32px rgba(16,185,129,0.15), inset 0 0 0 2px rgba(16,185,129,0.12); }
  50%      { transform: translateY(-8px); box-shadow: 0 16px 48px rgba(16,185,129,0.25), inset 0 0 0 2px rgba(16,185,129,0.2); }
}

/* =====================================================
   GROUP HEADERS
   ===================================================== */
.app-group-header {
  position: relative;
}
.group-indicator {
  width: 5px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--ba-gradient-start), var(--ba-gradient-end));
  flex-shrink: 0;
}
.app-group-header h5 {
  color: var(--ba-text-main);
  font-size: 1.15rem;
}
.group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ba-primary);
  background: var(--ba-primary-light);
}
[data-bs-theme="dark"] .group-count {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.group-line {
  height: 1px;
  background: linear-gradient(90deg, var(--ba-border), transparent);
}

/* =====================================================
   LAUNCHER CARDS — PREMIUM GLASS DESIGN
   ===================================================== */
.launcher-card {
  position: relative;
  border-radius: 20px;
  background: var(--ba-bg-card);
  border: 1px solid var(--ba-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.launcher-card-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--card-accent), var(--card-accent-light));
  flex-shrink: 0;
  transition: height 0.3s ease;
}

.launcher-card:hover .launcher-card-bar {
  height: 6px;
}

.launcher-card-inner {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-grow: 1;
  position: relative;
  z-index: 2;
}

.launcher-card-header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.launcher-card-icon-squircle {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.launcher-card-icon-squircle span {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.icon-squircle-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 1;
}

.launcher-card:hover .launcher-card-icon-squircle {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.launcher-card:hover .icon-squircle-shine {
  opacity: 1;
}

.launcher-card-title-area {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.launcher-card-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  width: fit-content;
}

.launcher-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ba-text-main);
  margin: 0;
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.launcher-card:hover .launcher-card-title {
  color: var(--card-accent);
}

.launcher-card-desc {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.launcher-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px dashed var(--ba-border);
  padding-top: 0.85rem;
  margin-top: auto;
}

.launcher-card-status {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  animation: dotPulse 2s infinite;
}

.launcher-card-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--btn-bg);
  padding: 0.3rem 0.6rem 0.3rem 0.8rem;
  border-radius: 50px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-text {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--btn-color);
  transition: all 0.3s ease;
}

.btn-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  color: var(--btn-color);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.launcher-card:hover .launcher-card-btn {
  background: var(--btn-color);
}

.launcher-card:hover .btn-text {
  color: #ffffff;
  letter-spacing: 0.8px;
}

.launcher-card:hover .btn-arrow {
  color: #ffffff;
  transform: translateX(2px);
}

.launcher-card-mesh {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
  background-size: 10px 10px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}

[data-bs-theme="dark"] .launcher-card-mesh {
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
}

.launcher-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--card-accent);
  border-color: var(--card-accent);
}

[data-bs-theme="dark"] .launcher-card:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--card-accent);
}

/* =====================================================
   LEGACY STYLES KEPT
   ===================================================== */
[data-bs-theme="dark"] .superapp-card h6 {
  color: #f8fafc !important;
}
[data-bs-theme="dark"] .superapp-card small {
  color: #94a3b8 !important;
}

/* Auth Page Premium Look */
.auth-cover-wrapper {
  background: linear-gradient(135deg, var(--ba-bg-light) 0%, var(--ba-primary-light) 100%);
}
[data-bs-theme="dark"] .auth-cover-wrapper {
  background: linear-gradient(135deg, #0f172a 0%, #064e3b 100%);
}

.auth-inner {
  background: var(--ba-bg-card) !important;
  backdrop-filter: blur(10px);
  border: 1px solid var(--ba-border);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 3rem !important;
}
[data-bs-theme="dark"] .auth-inner {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* Inputs & Buttons */
.form-control {
  border-radius: 10px;
  border: 1px solid var(--ba-border);
  padding: 0.75rem 1rem;
  background-color: var(--ba-bg-light);
  color: var(--ba-text-main);
  transition: all 0.2s ease;
}
[data-bs-theme="dark"] .form-control {
  background-color: #0f172a;
}
.form-control:focus {
  border-color: var(--ba-primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--ba-gradient-start), var(--ba-gradient-end));
  border: none;
  border-radius: 10px;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
  color: #ffffff;
}

/* Badges */
.badge {
  padding: 0.4em 0.8em;
  border-radius: 6px;
  font-weight: 600;
}

/* Tables */
.table {
  border-collapse: separate;
  border-spacing: 0 8px;
}
.table tbody tr {
  background: var(--ba-bg-card);
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
  transition: transform 0.2s;
}
[data-bs-theme="dark"] .table tbody tr {
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.table tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.table td, .table th {
  border: none;
  padding: 1rem;
  color: var(--ba-text-main);
  background: transparent !important;
}
.table td:first-child, .table th:first-child { border-radius: 10px 0 0 10px; }
.table td:last-child, .table th:last-child { border-radius: 0 10px 10px 0; }

/* User Layout Overrides (No Sidebar) */
.layout-user-role .app-wrapper {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
}
.layout-user-role .app-header {
  left: 0 !important;
  margin-left: 0 !important;
  width: 100% !important;
  padding-left: 0 !important;
}
.layout-user-role .footer-wrapper {
  left: 0 !important;
  margin-left: 0 !important;
  width: 100% !important;
}
.layout-user-role .app-header .app-header-inner {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 1.5rem !important;
}

/* Theme Glow Background - Greenish */
.theme-glow-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  z-index: -1;
  background-color: var(--ba-bg-light);
  transition: background-color 0.3s ease;
}
.theme-glow-bg::before, .theme-glow-bg::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: float 20s infinite alternate;
}
.theme-glow-bg::before {
  background: linear-gradient(to right, rgba(16, 185, 129, 0.4), rgba(52, 211, 153, 0.3));
  top: -200px;
  left: -100px;
}
.theme-glow-bg::after {
  background: linear-gradient(to right, rgba(4, 120, 87, 0.3), rgba(16, 185, 129, 0.3));
  bottom: -200px;
  right: -100px;
  animation-delay: -10s;
}

[data-bs-theme="dark"] .theme-glow-bg::before {
  background: linear-gradient(to right, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.1));
}
[data-bs-theme="dark"] .theme-glow-bg::after {
  background: linear-gradient(to right, rgba(4, 120, 87, 0.15), rgba(16, 185, 129, 0.1));
}

@keyframes float {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(100px, 50px) rotate(180deg); }
  100% { transform: translate(0, 100px) rotate(360deg); }
}

/* Enhance Page Header */
.app-page-title {
  font-weight: 800 !important;
  letter-spacing: -0.5px;
  color: var(--ba-text-main) !important;
}
.layout-user-role .app-page-head {
  padding-top: 1rem;
}

/* Dashboard Animations */
.logo-bounce {
  animation: logoBounce 3s ease-in-out infinite;
}
@keyframes logoBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); box-shadow: 0 15px 35px rgba(16, 185, 129, 0.3) !important; }
  }
}

/* ========================================================
   RULES & STYLES FROM DESIGN GUIDE (desain.md)
   ======================================================== */

/* --- 1. TOUCH TARGETS (WCAG AAA) --- */
/* Form inputs and select controls height should be at least 48px */
.form-control, 
.form-select, 
.bootstrap-select .dropdown-toggle, 
.dash-search-bar {
    min-height: 48px !important;
}

/* Primary buttons and call-to-actions */
.btn-primary, 
.btn-secondary, 
.btn-success, 
.btn-danger, 
.btn-warning, 
.btn-info,
.btn-submit {
    min-height: 48px !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
}

/* Icon action buttons in tables/cards - ensure min area of 48px x 48px */
.btn-icon, 
.btn-sm-icon,
.table td .btn,
.table td button,
.table td a.btn {
    min-height: 48px !important;
    min-width: 48px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
}

/* Adjust datatable length select and inputs for touch targets */
.dataTables_wrapper select, 
.dataTables_wrapper input {
    min-height: 38px !important; /* Slightly smaller for inline datatable filters, but touch-friendly */
}

/* --- 2. RESPONSIVE DESIGN & MOBILE STRIPE --- */
/* Aksen Desain M-stripe on sidebar in mobile/tablet screens */
@media (max-width: 991.98px) {
    .app-menubar {
        border-top: 4px solid var(--primary-green) !important;
    }
}

/* --- 3. CUSTOM AVATAR PROFILE --- */
/* Initial circle with transparent green background */
.avatar-initial-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: rgba(0, 155, 77, 0.15) !important;
    color: var(--primary-green) !important;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid rgba(0, 155, 77, 0.25);
}

