/* ==========================================================================
   GLOBAL RESET & MODERN ENHANCEMENTS
   ========================================================================== */
html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

html {
  background-color: var(--bg-dark);
  font-size: 16px;
  font-optical-sizing: auto;
}

/* ==========================================================================
   ENHANCED THEME VARIABLES WITH GRADIENTS & DEPTH
   ========================================================================== */
:root {
  --bg-dark: #0a0a0a;
  --bg-darker: #000000;
  --bg-card: #1e1e1e;
  --accent: #ff0038;
  --accent-hover: #ff1a4d;
  --accent-glow: rgba(255, 0, 56, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --error: #ff0038;
  --success: #4bb543;
  --warning: #f8961e;
  --info: #43aa8b;
  --border: #333;
  --glow: 0 0 20px rgba(255, 0, 56, 0.3);
  --glow-strong: 0 0 30px rgba(255, 0, 56, 0.5);
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Enhanced Gradients */
  --gradient-primary: linear-gradient(135deg, #ff0038 0%, #ff1a4d 100%);
  --gradient-dark: linear-gradient(135deg, #0a0a0a 0%, #000000 100%);
  --gradient-card: linear-gradient(145deg, #1e1e1e 0%, #252525 100%);
  --gradient-glow: radial-gradient(circle at center, rgba(255, 0, 56, 0.15) 0%, transparent 70%);
  
  /* Glass Morphism */
  --glass-bg: rgba(30, 30, 30, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  
  /* Animations */
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ==========================================================================
   HR MODULE THEME EXTENSION
   ========================================================================== */
.module-hr {
  --hr-accent: #00c4ff; /* Cyan / Trust / Documentation */
  --hr-accent-hover: #33d6ff;
  --hr-accent-glow: rgba(0, 196, 255, 0.4);
  --hr-gradient-primary: linear-gradient(135deg, #00c4ff 0%, #33d6ff 100%);
  --hr-glass-bg: rgba(20, 30, 40, 0.7);
  --hr-glass-border: rgba(255, 255, 255, 0.08);
  --hr-avatar-shadow: 0 0 15px rgba(0, 196, 255, 0.3);
  --hr-success: #2ecc71;
  --hr-warning: #f39c12;
  --hr-error: #e74c3c;
}

/* ==========================================================================
   ENHANCED LIGHT THEME
   ========================================================================== */
:root[data-theme="light"] {
  --bg-dark: #fdfdfd;
  --bg-darker: #f5f5f5;
  --bg-card: #ffffff;
  --text-primary: #111111;
  --text-secondary: #444444;
  --border: #ddd;
  --glow: 0 0 20px rgba(255, 0, 56, 0.15);
  --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   ENHANCED BASE STYLES WITH MODERN EFFECTS
   ========================================================================== */
body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  padding-top: 60px;
  line-height: 1.6;
  position: relative;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 0, 56, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 0, 56, 0.05) 0%, transparent 50%),
    linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
  z-index: -2;
  animation: backgroundShift 20s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 40px 40px;
  z-index: -1;
  pointer-events: none;
}

@keyframes backgroundShift {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.1) rotate(1deg); }
}

/* ==========================================================================
   PREMIUM CONTAINERS WITH GLASS MORPHISM
   ========================================================================== */
.container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 1.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: 
    var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-smooth);
}

.container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.container:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 0, 56, 0.3);
}

.container:hover::before {
  opacity: 1;
}

.container::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(255, 0, 56, 0.1),
    rgba(255, 0, 56, 0.05),
    transparent,
    transparent
  );
  animation: conicRotate 20s linear infinite;
  z-index: -1;
  opacity: 0.5;
}

@keyframes conicRotate {
  0% { transform: rotate(0deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1.2); }
}

/* ==========================================================================
   PREMIUM HEADINGS WITH GRADIENT TEXT
   ========================================================================== */
h1 {
  text-align: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 2rem;
  margin-bottom: 2rem;
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
  width: 100%;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
  animation: linePulse 3s ease-in-out infinite;
}

@keyframes linePulse {
  0%, 100% { width: 60px; opacity: 1; }
  50% { width: 80px; opacity: 0.8; }
}

/* ==========================================================================
   PREMIUM FLASHES & ALERTS
   ========================================================================== */
.flash {
  background: linear-gradient(135deg, rgba(75, 181, 67, 0.15) 0%, rgba(75, 181, 67, 0.05) 100%);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  border-left: 4px solid var(--success);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  animation: slideInDown 0.5s var(--ease-bounce);
}

.flash::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--success);
  animation: progressBar 3s ease-in-out;
}

@keyframes slideInDown {
  0% { 
    opacity: 0; 
    transform: translateY(-20px) scale(0.95);
  }
  70% { 
    transform: translateY(5px) scale(1.02);
  }
  100% { 
    opacity: 1; 
    transform: translateY(0) scale(1);
  }
}

@keyframes progressBar {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ==========================================================================
   PREMIUM FORM CONTROLS
   ========================================================================== */
form.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 1.5rem;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
}

input[type="file"],
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea {
  padding: 1rem 1.25rem;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s var(--ease-smooth);
  position: relative;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  background: var(--gradient-primary);
  color: #000;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin-right: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow);
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
textarea:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 0, 56, 0.1);
  transform: translateY(-1px);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 
    0 0 0 4px rgba(255, 0, 56, 0.15),
    var(--glow);
  transform: translateY(-2px);
}

/* ==========================================================================
   PREMIUM SELECT STYLES
   ========================================================================== */
select {
  padding: 1rem 3rem 1rem 1.25rem;
  border-radius: 8px;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  background: var(--bg-darker) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ff0038' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 8 4 4 4-4'/%3e%3c/svg%3e") no-repeat right 1rem center / 1.5em 1.5em;
  color: var(--text-primary);
  transition: all 0.3s var(--ease-smooth);
  cursor: pointer;
  appearance: none;
}

select:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ==========================================================================
   PREMIUM BUTTONS WITH MICRO-INTERACTIONS
   ========================================================================== */
button.save-btn,
button.delete-selected-btn {
  background: var(--gradient-primary);
  color: #000;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  font-family: var(--font-heading);
  letter-spacing: 0.05em;
  min-width: 140px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(255, 0, 56, 0.3);
}

button.save-btn::before,
button.delete-selected-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 0.6s;
}

button.save-btn:hover::before,
button.delete-selected-btn:hover::before {
  left: 100%;
}

button.save-btn:hover,
button.delete-selected-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 0, 56, 0.4);
}

button.save-btn:active,
button.delete-selected-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(255, 0, 56, 0.4);
}

/* ==========================================================================
   PREMIUM TABLE STYLES
   ========================================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

table::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-primary);
  z-index: 1;
}

th, td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  min-width: 120px;
  transition: all 0.2s ease;
}

th {
  background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-card) 100%);
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
}

tr {
  transition: all 0.3s ease;
}

tr:hover {
  background: rgba(255, 0, 56, 0.05);
  transform: scale(1.01);
}

/* ==========================================================================
   HR MODULE COMPONENTS
   ========================================================================== */

/* Employee Cards */
.module-hr .employee-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--hr-glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s var(--ease-smooth);
  text-align: center;
  backdrop-filter: blur(20px);
}

.module-hr .employee-card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--hr-accent);
  box-shadow: 0 0 20px var(--hr-accent-glow);
}

/* Avatar / Photo */
.module-hr .employee-card img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 2px solid var(--hr-accent);
  box-shadow: var(--hr-avatar-shadow);
}

/* Employee Name */
.module-hr .employee-card h3 {
  font-family: var(--font-heading);
  color: var(--hr-accent);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

/* Job Title */
.module-hr .employee-card p.position {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

/* Contact / Status Badges */
.module-hr .badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--hr-gradient-primary);
  color: #000;
  box-shadow: 0 2px 10px var(--hr-accent-glow);
}

/* Form Panels */
.module-hr form {
  background: var(--hr-glass-bg);
  border: 1px solid var(--hr-glass-border);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 1.5rem;
  backdrop-filter: blur(15px);
}

.module-hr label {
  font-weight: 600;
  color: var(--text-secondary);
}

.module-hr .hst-btn {
  background: var(--hr-gradient-primary);
  color: #000;
  box-shadow: 0 4px 15px var(--hr-accent-glow);
}

.module-hr .hst-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--hr-accent-glow);
}

/* ==========================================================================
   HR GRID / DASHBOARD LAYOUTS
   ========================================================================== */

.module-hr .employee-grid {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .module-hr .employee-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

/* ==========================================================================
   ENHANCED CYBERPUNK CORNERS
   ========================================================================== */
.corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-style: solid;
  border-color: var(--accent);
  border-width: 0;
  opacity: 0.6;
  transition: all 0.3s ease;
}

.corner-tl { 
  top: 0; 
  left: 0; 
  border-top-width: 2px; 
  border-left-width: 2px; 
  border-radius: 8px 0 0 0;
}

.corner-tr { 
  top: 0; 
  right: 0; 
  border-top-width: 2px; 
  border-right-width: 2px; 
  border-radius: 0 8px 0 0;
}

.corner-bl { 
  bottom: 0; 
  left: 0; 
  border-bottom-width: 2px; 
  border-left-width: 2px; 
  border-radius: 0 0 0 8px;
}

.corner-br { 
  bottom: 0; 
  right: 0; 
  border-bottom-width: 2px; 
  border-right-width: 2px; 
  border-radius: 0 0 8px 0;
}

.container:hover .corner {
  opacity: 1;
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   PREMIUM HIGHLIGHT EFFECTS
   ========================================================================== */
.highlight-flash {
  position: relative;
  animation: premiumPulse 2s var(--ease-smooth) infinite;
  border: 2px solid var(--accent);
  border-radius: 8px;
  z-index: 10;
  background: rgba(255, 0, 56, 0.05);
  backdrop-filter: blur(5px);
}

@keyframes premiumPulse {
  0%, 100% { 
    border-color: rgba(255, 0, 56, 0.4);
    box-shadow: 0 0 10px rgba(255, 0, 56, 0.2);
  }
  50% { 
    border-color: rgba(255, 0, 56, 0.8);
    box-shadow: 0 0 20px rgba(255, 0, 56, 0.6);
  }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px var(--hr-accent-glow); }
  50% { box-shadow: 0 0 25px var(--hr-accent-glow); }
}

.module-hr .employee-card:hover img {
  animation: glowPulse 2s infinite ease-in-out;
}

.module-hr .toast-success {
  background: var(--hr-gradient-primary);
  color: #000;
}

/* ==========================================================================
   ENHANCED RESPONSIVE DESIGN
   ========================================================================== */
@media (min-width: 601px) {
  .container { 
    padding: 2rem; 
    margin: 2rem auto; 
  }
  
  h1 { 
    font-size: 2.5rem; 
    margin-bottom: 2.5rem; 
  }
  
  form.upload-form {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
  }
  
  th, td { 
    padding: 1.25rem 1.5rem; 
    min-width: 140px; 
  }
  
  .corner { 
    width: 20px; 
    height: 20px; 
    border-width: 2px; 
  }
}

@media (min-width: 769px) {
  .container { 
    padding: 2.5rem; 
    border-radius: 20px; 
    box-shadow: 
      0 8px 40px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  
  h1 { 
    font-size: 3rem; 
  }
  
  .highlight-flash { 
    border-width: 3px; 
  }
}

@media (min-width: 1025px) {
  body::before { 
    animation-duration: 30s; 
  }
  
  .container::after { 
    animation-duration: 15s; 
  }
  
  /* Hover effects for desktop only */
  @media (hover: hover) {
    .container:hover {
      transform: translateY(-5px) scale(1.01);
    }
    
    tr:hover {
      transform: scale(1.02);
    }
  }
}

/* ==========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #fff;
    --glass-border: #fff;
  }
}