/* ==== GLOBAL TOKENS & SOVEREIGNTY PALETTE ==== */
:root {
  /* Brand Colors */
  --green-primary: #006837;
  --green-light: #008f4c;
  --red-action: #E30613;
  --red-light: #ff1a28;
  
  /* Theme Transition */
  --transition-speed: 0.3s;
  
  /* Pure Minimal Light Theme */
  --bg-color: #FAFAFA;
  --surface-color: #FFFFFF;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  
  --input-bg: #FFFFFF;
  --input-border: #E5E7EB;
  --input-focus: var(--green-primary);
  
  --button-bg: var(--green-primary);
  --button-hover: var(--green-light);
  --button-text: #ffffff;
  
  --shadow-color: rgba(0, 0, 0, 0.05);
}

/* ==== RESET & BASE ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Tajawal', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-speed), color var(--transition-speed);
  overflow-x: hidden;
  position: relative;
}

/* ==== BACKGROUND ANIMATION ==== */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 15s infinite ease-in-out alternate;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background-color: var(--green-primary);
  top: -100px;
  right: -100px;
  animation-duration: 20s;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background-color: var(--red-action);
  bottom: -50px;
  left: -50px;
  animation-duration: 25s;
  animation-delay: -5s;
}

.shape-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--green-light) 0%, transparent 70%);
  top: 40%;
  right: 30%;
  animation-duration: 18s;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 50px) scale(1.1); }
  100% { transform: translate(-30px, -20px) scale(0.9); }
}

/* ==== TOP NAVIGATION ==== */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  z-index: 10;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333;
  transition: .4s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  z-index: 2;
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #ddd;
}

input:checked + .slider:before {
  transform: translateX(26px);
  background-color: var(--green-primary);
}

.btn-sm {
  background: var(--surface-color);
  color: var(--text-primary);
  border: 1px solid var(--input-border);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-sm:hover {
  background: var(--green-primary);
  color: white;
}

/* ==== LOGIN CONTAINER ==== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 20px;
  z-index: 10;
}

.login-box {
  width: 100%;
  max-width: 450px;
  background-color: var(--surface-color);
  padding: 40px 30px;
  border-radius: 20px;
  box-shadow: 0 10px 40px var(--shadow-color);
  transition: all var(--transition-speed);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--input-border);
}

.logo-section {
  text-align: center;
  margin-bottom: 30px;
}

.logo-placeholder {
  font-size: 32px;
  font-weight: 800;
  color: var(--green-primary);
  margin-bottom: 15px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 5px;
}

/* ==== FORMS ==== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.input-field {
  position: relative;
  display: flex;
  align-items: center;
}

.input-field i {
  position: absolute;
  right: 15px;
  font-style: normal;
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.input-field input {
  width: 100%;
  padding: 14px 45px 14px 15px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.3s;
}

.input-field input::placeholder {
  color: rgba(150, 150, 150, 0.5);
}

.input-field input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 4px rgba(0, 104, 55, 0.1);
}

/* ==== PRIMARY BUTTON ==== */
.btn-primary {
  width: 100%;
  padding: 15px;
  margin-top: 10px;
  background-color: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(0, 104, 55, 0.3);
}

.btn-primary:hover {
  background-color: var(--button-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(227, 6, 19, 0.4); /* Dynamic red shadow on hover */
}

.btn-primary:active {
  transform: translateY(1px);
}

/* Spinner for loading state */
.spinner {
  animation: spin 1s linear infinite;
  display: inline-block;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ==== SYSTEM STATUS ==== */
.system-status {
  margin-top: 25px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Responsive logic */
@media (max-width: 480px) {
  .login-box {
    padding: 30px 20px;
  }
  .brand-title {
    font-size: 15px;
  }
}

/* ==== DASHBOARD CONTAINER (SPA) ==== */
.dashboard-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  z-index: 10;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background-color: var(--surface-color);
  padding: 15px 20px;
  border-radius: 15px;
  box-shadow: 0 5px 15px var(--shadow-color);
}

.user-info h2 {
  font-size: 18px;
  color: var(--green-primary);
  margin-bottom: 5px;
}

.user-role {
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(0, 104, 55, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
}

/* ==== DASHBOARD TILES ==== */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.tile {
  background-color: var(--surface-color);
  border-radius: 20px;
  padding: 25px 15px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 20px var(--shadow-color);
  transition: all var(--transition-speed);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.tile:hover {
  transform: translateY(-5px);
  border-color: var(--green-primary);
  box-shadow: 0 12px 25px rgba(0, 104, 55, 0.2);
}

.tile i {
  font-size: 40px;
  margin-bottom: 15px;
  display: block;
}

.tile h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Specific Tile Colors */
.tile-tasks i { color: #3498db; }
.tile-radar i { color: #9b59b6; }
.tile-red-Btn { 
  border-color: rgba(227, 6, 19, 0.3) !important;
}
.tile-red-Btn i { color: var(--red-action); }
.tile-red-Btn h3 { color: var(--red-action); }

.tile-red-Btn:hover {
  background-color: rgba(227, 6, 19, 0.1);
  box-shadow: 0 12px 25px rgba(227, 6, 19, 0.3);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .tiles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  .tile {
    padding: 20px 10px;
  }
  .tile i {
    font-size: 32px;
  }
  .tile h3 {
    font-size: 14px;
  }
}
