/* ===== GLOBAL ===== */
/* 🎨 CLAYMORPHISM THEME - Soft, warm, organic design */
html {
  scrollbar-gutter: stable;
}

body {
  background: linear-gradient(135deg, #FBF7F0 0%, #F5F1E8 100%);
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: #4A4A4A;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ===== HEADER ===== */
.custom-header {
  height: 50px;
  display: grid;
  grid-template-columns: 50px 1fr 90px auto;
  align-items: center;
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 248, 243, 0.95);
  border-bottom: none;
  z-index: 1001;
  box-shadow: 0 8px 24px rgba(180, 120, 80, 0.12);
  backdrop-filter: blur(10px);
}

.logo-box img {
  width: 40px;
}

.header-center {
  text-align: center;
  line-height: 1.1;
  padding-left: 4px;
}

.header-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.header-sub {
  font-size: 11px;
  font-weight: 700;
  color: #6c757d;
}

.header-dept {
  font-size: 9px;
  font-weight: 600;
  color: #198754;
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ===== HEADER RIGHT SECTION ===== */
.header-right {
  text-align: right;
  font-weight: 700;
  font-size: 12px;
  padding-right: 12px;
  letter-spacing: 0.3px;
}

.header-right div {
  white-space: nowrap;
  background: linear-gradient(135deg, #0056FF 0%, #0080FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px; /* 👈 Increased gap */
  padding-right: 12px;
}

/* ========================================
   👇 NEW: VERTICAL DIVIDER (Claymorphism)
======================================== */
.header-divider {
  width: 2px;                    /* Divider width */
  height: 32px;                  /* Divider height */
  background: linear-gradient(   /* Gradient effect */
    to bottom,
    transparent,
    #D4917D 20%,
    #D4917D 80%,
    transparent
  );
  border-radius: 2px;
}

.brand-blue {
  color: #0056FF;
  background: linear-gradient(135deg, #0056FF 0%, #0080FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand-orange {
  color: #FF8C00;
  background: linear-gradient(135deg, #FF8C00 0%, #FF6B35 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: 1px;
}

/* ========================================
   👇 UPDATED: USER BOX (Claymorphism)
======================================== */
.user-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  min-width: 42px;               /* 👈 Reduced from 48px */
  padding: 2px 6px;              /* 👈 Reduced from 4px 8px */
  border-radius: 12px;
  transition: all 0.3s ease;
}

/* Hover effect on user box */
.user-box:hover {
  background: rgba(212, 145, 125, 0.1);
  transform: translateY(-2px);
}

/* Active state */
.user-box:active {
  transform: translateY(0);
}


/* ========================================
   👇 UPDATED: USER AVATAR (Claymorphism)
======================================== */
.user-avatar {
  width: 26px;                   /* 👈 Reduced from 32px */
  height: 26px;                  /* 👈 Reduced from 32px */
  border-radius: 50%;
  background: linear-gradient(135deg, #D4917D 0%, #B8927E 100%);
  color: #fff;
  font-weight: 800;
  font-size: 11px;               /* 👈 Reduced from 13px */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(212, 145, 125, 0.3);
  transition: all 0.3s ease;
}

/* Avatar hover effect */
.user-box:hover .user-avatar {
  box-shadow: 0 6px 16px rgba(212, 145, 125, 0.4);
  transform: scale(1.05);
}

.user-name {
  font-size: 9px;                /* 👈 Reduced from 10px */
  font-weight: 700;
  color: #4A4A4A;
  margin-top: 2px;               /* 👈 Reduced from 3px */
  max-width: 48px;
  text-align: center;
  transition: color 0.3s ease;
}

/* Name color change on hover */
.user-box:hover .user-name {
  color: #D4917D;
}


/* ========================================
   👇 USER MENU (Claymorphism)
======================================== */
.user-menu {
  position: fixed;
  top: 60px;
  right: 12px;
  background: rgba(255, 248, 243, 0.98);
  border: none;
  padding: 0;
  border-radius: 16px;
  width: 220px;
  z-index: 2000;
  box-shadow: 0 12px 32px rgba(180, 120, 80, 0.15);
  overflow: hidden;
  
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Hidden state */
.user-menu.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}


@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Menu Header Section */
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #F4C7A8 0%, #E8B5A0 100%);
}

/* Avatar in menu (larger) */
.user-menu-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4917D 0%, #B8927E 100%);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(212, 145, 125, 0.3);
}

/* User info section */
.user-menu-info {
  flex: 1;
}

/* Full name in menu */
.user-menu-name {
  font-size: 14px;
  font-weight: 700;
  color: #212529;
  margin-bottom: 2px;
  word-break: break-word;
}

/* Role/department */
.user-menu-role {
  font-size: 11px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Divider line */
.user-menu-divider {
  height: 1px;
  background: #e9ecef;
  margin: 0;
}

/* ========================================
   👇 UPDATED: MODERN LOGOUT BUTTON
======================================== */
.btn-logout {
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #d97e7e;              /* Warm red/clay color */
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Logout button hover */
.btn-logout:hover {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(232, 92, 92, 0.08) 100%);
  color: #E85C5C;
  transform: translateX(2px);
}

/* Logout button active */
.btn-logout:active {
  background: rgba(255, 107, 107, 0.15);
  transform: scale(0.98);
}

/* Logout icon */
.btn-logout i {
  font-size: 16px;
}

/* ===== HOME ===== */
#home-screen {
  padding-top: 150px;
  padding-bottom: 130px;
}

/* ===== FOOTER ===== */
.app-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 28px;
  background: #fff;
  border-top: 1px solid #ddd;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 28px;
  z-index: 1000;
}

/* ===== TOAST ===== */
/* ========================================
   👇 UPDATED: TOAST NOTIFICATION (STABLE)
======================================== */
#toast {
  position: fixed;
  bottom: 80px;              /* Above footer */
  left: 50%;                 /* Center horizontally */
  
  /* 🚀 STABILITY FIXES */
  transform: translateX(-50%) translateY(100px); /* Start hidden below */
  width: max-content;        /* Prevents width jitter/glitch */
  will-change: transform, opacity; /* 🚀 Prevents rendering glitches */
  visibility: hidden;        /* Better than display:none for anims */
  opacity: 0;                /* Start invisible */

  background: #fff;
  padding: 12px 24px;        /* Comfortable padding */
  border-radius: 50px;       /* Pill shape (Modern App Style) */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); /* Soft, high shadow */
  
  z-index: 2000;
  min-width: 200px;
  max-width: 90%;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #212529;
  border: 1px solid rgba(0,0,0,0.05); /* Very subtle border */
  
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smooth easing */
}

/* ========================================
   👇 ANIMATION TRIGGER CLASSES
======================================== */

/* Show State */
#toast.show {
  visibility: visible;
  opacity: 1;
  /* 🚀 KEYFRAME ANIMATION */
  animation: slideUpFade 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Hide State */
#toast.hide {
  animation: slideDownFade 0.3s ease-in forwards;
}

/* ========================================
   👇 KEYFRAMES (Locked Centering)
======================================== */

@keyframes slideUpFade {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(40px); /* Start slightly below */
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);    /* End exactly center */
  }
}

@keyframes slideDownFade {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(40px); /* Exit slightly below */
  }
}

/* ========================================
   👇 COLOR VARIANTS (With Subtle Backgrounds)
======================================== */

/* Success (Green) */
#toast.success {
  background: #ecfdf5;     /* Very pale green */
  color: #047857;          /* Dark green text */
  border: 1px solid #a7f3d0;
}

/* Error (Red) */
#toast.error {
  background: #fef2f2;     /* Very pale red */
  color: #b91c1c;          /* Dark red text */
  border: 1px solid #fecaca;
}

/* Warning (Yellow/Orange) */
#toast.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Info (Blue) */
#toast.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
/* ========================================
   GLOBAL LOADING SPINNER OVERLAY
======================================== */
#loading-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    
    /* White background with slight transparency */
    background: rgba(255, 255, 255, 0.8); 
    backdrop-filter: blur(2px); /* Optional: adds a nice blur effect */
    
    z-index: 9999; /* Ensures it sits on top of everything */
    
    /* Flexbox centers the spinner */
    display: none; 
    align-items: center; 
    justify-content: center;
}

/* Class to toggle visibility via JS */
#loading-overlay.visible {
    display: flex;
}

/* The Clay Spinner Animation (Claymorphism) */
.spinner {
    width: 45px; 
    height: 45px;
    border: 4px solid rgba(212, 145, 125, 0.1);       /* Light clay track */
    border-top: 4px solid #D4917D;   /* Clay spinner */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}