/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

@theme {
  /* Font Family Overrides */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  /* Custom Colors mapped to CSS Theme Variables */
  --color-brand-50: var(--brand-light);
  --color-brand-100: var(--brand-light);
  --color-brand-200: var(--brand-light);
  --color-brand-300: var(--brand-primary);
  --color-brand-400: var(--brand-primary);
  --color-brand-500: var(--brand-primary);
  --color-brand-600: var(--brand-primary-hover);
  --color-brand-700: var(--brand-primary-hover);
  --color-brand-800: var(--brand-primary-hover);
  --color-brand-900: var(--brand-primary-hover);

  /* Workspace Theme Customizations */
  --color-bg-base: var(--bg-base);
  --color-bg-surface: var(--bg-surface);
  --color-bg-card: var(--bg-card);
  --color-bg-card-hover: var(--bg-card-hover);
  --color-border-subtle: var(--border-subtle);
  --color-border-focus: var(--border-focus);
  --color-text-main: var(--text-main);
  --color-text-muted: var(--text-muted);
  --color-text-invert: var(--text-invert);
  
  --animate-modal-in: modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  --animate-fade-in: fade-in 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

:root {
  /* Premium Obsidian Slate Dark Theme */
  --bg-base: #070913;           /* Obsidian space dark slate background */
  --bg-surface: rgba(15, 23, 42, 0.92); /* Translucent sidebar & header background */
  --bg-card: rgba(30, 41, 59, 0.82);   /* Clean slate glass card */
  --bg-card-hover: rgba(51, 65, 85, 0.92); /* Slate glass card hover */
  --border-subtle: rgba(59, 130, 246, 0.16); /* Blue border glow tint */
  --border-focus: #3b82f6;      /* Blue focus */
  --text-main: #f8fafc;         /* White-slate text */
  --text-muted: #94a3b8;        /* Anthracite / Slate Gray for Dark Mode */
  --text-invert: #070913;
  --text-anthracite: #94a3b8;   /* Anthracite / Slate Gray for Dark Mode */
  
  --brand-primary: #3b82f6;     /* Royal Blue */
  --brand-primary-hover: #2563eb;
  --brand-light: #1e3a8a;       /* Deep Royal blue tint */
  
  --gradient-brand: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --gradient-brand-hover: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
}

html[data-theme="light"] {
  /* Premium Ice Slate Light Theme */
  --bg-base: #f1f5f9;           /* Slate-light background */
  --bg-surface: rgba(255, 255, 255, 0.92); /* Crisp glass sidebar & header */
  --bg-card: rgba(255, 255, 255, 0.92);   /* White translucent glass card */
  --bg-card-hover: rgba(241, 245, 249, 0.98); /* Slate white card hover */
  --border-subtle: rgba(59, 130, 246, 0.12); /* Clean blue border tint */
  --border-focus: #3b82f6;      /* Blue focus */
  --text-main: #0f172a;         /* Deep slate text */
  --text-muted: #475569;        /* Anthracite / Slate Gray for Light Mode */
  --text-invert: #ffffff;
  --text-anthracite: #475569;   /* Anthracite / Slate Gray for Light Mode */
  
  --brand-primary: #3b82f6;     /* Royal Blue */
  --brand-primary-hover: #2563eb;
  --brand-light: #eff6ff;       /* Soft light blue tint */
  
  --gradient-brand: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --gradient-brand-hover: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
}

/* Base Body Layout with space ambient background */
body {
  position: relative;
  background-color: var(--bg-base);
  color: var(--text-main);
  overflow-x: hidden;
  font-family: var(--font-sans);
  min-height: 100vh;
}

/* Moving Background Glow Elements */
.ambient-glow-1 {
  position: absolute;
  top: -15%;
  left: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.14) 0%, transparent 70%);
  filter: blur(100px);
  z-index: -10;
  pointer-events: none;
  animation: float-glow-1 25s infinite ease-in-out;
}

.ambient-glow-2 {
  position: absolute;
  bottom: -15%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
  filter: blur(100px);
  z-index: -10;
  pointer-events: none;
  animation: float-glow-2 30s infinite ease-in-out;
}

@keyframes float-glow-1 {
  0%, 100% { transform: translate(0px, 0px) scale(1); }
  50% { transform: translate(60px, -40px) scale(1.15); }
}

@keyframes float-glow-2 {
  0%, 100% { transform: translate(0px, 0px) scale(1); }
  50% { transform: translate(-60px, 40px) scale(1.15); }
}

/* Heading Styling */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading) !important;
  font-weight: 700 !important;
}

/* Custom Premium Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 9999px;
  border: 1px solid transparent;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary);
}

/* Smooth Sidebar Transitions & Animations */
.sidebar-transition {
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease, border-color 0.25s ease;
}

/* Sidebar Saturated Gradient styling */
aside {
  background: linear-gradient(180deg, #0b081e 0%, #05030b 100%) !important;
  border-right: 1px solid var(--border-subtle) !important;
}

html[data-theme="light"] aside {
  background: linear-gradient(180deg, #f3e8ff 0%, #ffffff 100%) !important;
  border-right: 1px solid var(--border-subtle) !important;
}

/* Header Glassmorphism */
header {
  background: rgba(14, 11, 32, 0.95) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

html[data-theme="light"] header {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

/* Collapsed Sidebar Premium Styling Overrides */
#sidebar.w-16 {
  width: 4.5rem !important;
}

#sidebar.w-16 .sidebar-text {
  display: none !important;
}

#sidebar.w-16 #sidebar-header {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

#sidebar.w-16 #workspace-trigger {
  justify-content: center !important;
  padding: 0.5rem !important;
}

#sidebar.w-16 #workspace-trigger div {
  margin: 0 !important;
}

#sidebar.w-16 .quick-actions-container {
  flex-direction: column !important;
  gap: 0.5rem !important;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

#sidebar.w-16 .quick-actions-container button {
  justify-content: center !important;
  padding: 0.5rem !important;
  width: 100% !important;
}

#sidebar.w-16 nav {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

#sidebar.w-16 nav ul li a {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  gap: 0 !important;
}

#sidebar.w-16 #sidebar-projects-list li a {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

#sidebar.w-16 #sidebar-footer {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

#sidebar.w-16 #workspace-dropdown {
  left: 5rem !important;
  width: 15rem !important;
  right: auto !important;
}

.fade-transition {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease;
}

/* Glassmorphism Preset */
.glass-panel {
  background: rgba(14, 11, 35, 0.95) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="light"] .glass-panel {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.08) !important;
}

/* Keyframes for animations */
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Kanban column drag over */
.drag-over {
  border: 2px dashed var(--brand-primary) !important;
  background-color: rgba(139, 92, 246, 0.08) !important;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15) !important;
}

/* Checklist Item completed helper */
.subtask-completed-text {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.5;
}

/* Premium Card Design System */
.premium-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.premium-card:hover {
  transform: translateY(-4px);
  border-color: rgba(236, 72, 153, 0.4) !important; /* Rose accent hover */
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.18), 0 0 15px rgba(236, 72, 153, 0.05);
}

html[data-theme="light"] .premium-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.04);
}

html[data-theme="light"] .premium-card:hover {
  border-color: rgba(124, 58, 237, 0.35) !important;
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.1);
}

/* Saturated Colored Kanban Columns styling */
.border-t-cyan-500\/80 {
  background: rgba(6, 182, 212, 0.02) !important;
  border-color: rgba(6, 182, 212, 0.14) !important;
  border-top: 4px solid #06b6d4 !important;
}
.border-t-amber-500\/80 {
  background: rgba(245, 158, 11, 0.02) !important;
  border-color: rgba(245, 158, 11, 0.14) !important;
  border-top: 4px solid #f59e0b !important;
}
.border-t-purple-500\/80 {
  background: rgba(168, 85, 247, 0.02) !important;
  border-color: rgba(168, 85, 247, 0.14) !important;
  border-top: 4px solid #a855f7 !important;
}
.border-t-emerald-500\/80 {
  background: rgba(16, 185, 129, 0.02) !important;
  border-color: rgba(16, 185, 129, 0.14) !important;
  border-top: 4px solid #10b981 !important;
}
.border-t-blue-500\/80 {
  background: rgba(59, 130, 246, 0.02) !important;
  border-color: rgba(59, 130, 246, 0.14) !important;
  border-top: 4px solid #3b82f6 !important;
}
.border-t-red-500\/80 {
  background: rgba(239, 68, 68, 0.02) !important;
  border-color: rgba(239, 68, 68, 0.14) !important;
  border-top: 4px solid #ef4444 !important;
}
.border-t-pink-500\/80 {
  background: rgba(236, 72, 153, 0.02) !important;
  border-color: rgba(236, 72, 153, 0.14) !important;
  border-top: 4px solid #ec4899 !important;
}
.border-t-indigo-500\/80 {
  background: rgba(99, 102, 241, 0.02) !important;
  border-color: rgba(99, 102, 241, 0.14) !important;
  border-top: 4px solid #6366f1 !important;
}
.border-t-rose-500\/80 {
  background: rgba(244, 63, 94, 0.02) !important;
  border-color: rgba(244, 63, 94, 0.14) !important;
  border-top: 4px solid #f43f5e !important;
}
.border-t-orange-500\/80 {
  background: rgba(249, 115, 22, 0.02) !important;
  border-color: rgba(249, 115, 22, 0.14) !important;
  border-top: 4px solid #f97316 !important;
}
.border-t-green-500\/80 {
  background: rgba(34, 197, 94, 0.02) !important;
  border-color: rgba(34, 197, 94, 0.14) !important;
  border-top: 4px solid #22c55e !important;
}
.border-t-yellow-500\/80 {
  background: rgba(234, 179, 8, 0.02) !important;
  border-color: rgba(234, 179, 8, 0.14) !important;
  border-top: 4px solid #eab308 !important;
}
.border-t-slate-500\/80 {
  background: rgba(100, 116, 139, 0.02) !important;
  border-color: rgba(100, 116, 139, 0.14) !important;
  border-top: 4px solid #64748b !important;
}

/* Global Form Input legibility & glow effects */
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  color: var(--text-main) !important;
  background-color: rgba(5, 3, 11, 0.4) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 0.75rem !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html[data-theme="light"] input[type="text"], 
html[data-theme="light"] input[type="email"], 
html[data-theme="light"] input[type="password"], 
html[data-theme="light"] textarea, 
html[data-theme="light"] select {
  background-color: rgba(255, 255, 255, 0.6) !important;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25), 0 0 10px rgba(139, 92, 246, 0.15) !important;
  background-color: rgba(5, 3, 11, 0.6) !important;
  outline: none !important;
}

html[data-theme="light"] input[type="text"]:focus, 
html[data-theme="light"] input[type="email"]:focus, 
html[data-theme="light"] input[type="password"]:focus, 
html[data-theme="light"] textarea:focus, 
html[data-theme="light"] select:focus {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2) !important;
  background-color: rgba(255, 255, 255, 0.95) !important;
}

/* Global Cursor overrides */
a, button, select, input[type="submit"], input[type="button"], [role="button"], [data-settings-tab], .cursor-pointer {
  cursor: pointer !important;
}

/* Premium Modals frosted cosmic windows styling */
div[id*="modal"] > div {
  background: rgba(15, 23, 42, 0.98) !important;
  border: 1px solid rgba(59, 130, 246, 0.28) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(59, 130, 246, 0.12) !important;
}

html[data-theme="light"] div[id*="modal"] > div {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid rgba(37, 99, 235, 0.2) !important;
  box-shadow: 0 25px 50px -12px rgba(37, 99, 235, 0.08) !important;
}

/* Manual fallback utility classes for brand colors */
.bg-brand-500 {
  background-color: var(--brand-primary) !important;
}
.bg-brand-600 {
  background: var(--gradient-brand) !important;
}
.bg-brand-600:hover {
  background: var(--gradient-brand-hover) !important;
}
.hover\:bg-brand-500:hover {
  background-color: var(--brand-primary-hover) !important;
}
.text-brand-400 {
  color: var(--brand-primary-hover) !important;
}
.hover\:text-brand-300:hover {
  color: var(--brand-primary-hover) !important;
}
.border-brand-500 {
  border-color: var(--brand-primary) !important;
}
.border-l-brand-500 {
  border-left-color: var(--brand-primary) !important;
}

/* Opacity utilities for brand colors */
.bg-brand-500\/5 {
  background-color: rgba(59, 130, 246, 0.05) !important;
}
html[data-theme="light"] .bg-brand-500\/5 {
  background-color: rgba(37, 99, 235, 0.04) !important;
}
.bg-brand-500\/10 {
  background-color: rgba(59, 130, 246, 0.1) !important;
}
html[data-theme="light"] .bg-brand-500\/10 {
  background-color: rgba(37, 99, 235, 0.08) !important;
}
.bg-brand-500\/15 {
  background-color: rgba(59, 130, 246, 0.15) !important;
}
html[data-theme="light"] .bg-brand-500\/15 {
  background-color: rgba(37, 99, 235, 0.12) !important;
}
.border-brand-500\/10 {
  border-color: rgba(59, 130, 246, 0.1) !important;
}
html[data-theme="light"] .border-brand-500\/10 {
  border-color: rgba(37, 99, 235, 0.08) !important;
}
.border-brand-500\/20 {
  border-color: rgba(59, 130, 246, 0.2) !important;
}
html[data-theme="light"] .border-brand-500\/20 {
  border-color: rgba(37, 99, 235, 0.15) !important;
}

/* Custom Utility fallbacks for theme surfaces */
.bg-bg-surface {
  background-color: var(--bg-surface) !important;
}
.bg-bg-base {
  background-color: var(--bg-base) !important;
}
.bg-bg-card {
  background-color: var(--bg-card) !important;
}
.bg-bg-card-hover {
  background-color: var(--bg-card-hover) !important;
}
.border-border-subtle {
  border-color: var(--border-subtle) !important;
}
.text-text-main {
  color: var(--text-main) !important;
}
.text-text-muted {
  color: var(--text-muted) !important;
}
.text-anthracite {
  color: var(--text-anthracite) !important;
}

/* Active navigation item styling in sidebar */
#sidebar nav ul li a[class*="text-brand-400"] {
  background-color: rgba(59, 130, 246, 0.12) !important;
  border-left-color: var(--brand-primary) !important;
  font-weight: 700;
  box-shadow: inset 4px 0 0 0 var(--brand-primary) !important;
}

/* Remember Me Checkbox Custom Peer Styles */
#rememberMe:checked + div {
  background: var(--gradient-brand) !important;
  border-color: var(--brand-primary) !important;
}
#rememberMe:checked ~ svg {
  opacity: 1 !important;
}

/* Slide notifications animations */
@keyframes slide-in-right {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slide-out-right {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}
.animate-slide-in-right {
  animation: slide-in-right 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}
.animate-slide-out-right {
  animation: slide-out-right 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* Details Modal Narrow Mode */
.details-mode-narrow #details-left-wrapper {
  position: relative !important;
  background-color: var(--bg-surface) !important;
  border-right: 1px solid var(--border-subtle) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.details-mode-narrow #details-tabs-header {
  display: flex !important;
}

/* In narrow mode, make active column inside the wrapper fill full container height */
.details-mode-narrow #details-left-wrapper > div:not(#details-tabs-header) {
  flex: 1 1 0% !important;
  width: 100% !important;
  height: 100% !important;
  overflow-y: auto !important;
  border-right: none !important;
  border-bottom: none !important;
}

/* Ensure the right sidebar is always visible on the right */
.details-mode-narrow #details-right-sidebar {
  margin-left: auto !important;
  width: 320px !important;
  z-index: 10 !important;
  border-left: 1px solid var(--border-subtle) !important;
}

/* Pulsating lock screen button glow */
.lock-btn-glow {
  position: relative;
  overflow: visible;
}

.lock-btn-glow::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: inherit;
  border: 2px solid #eab308; /* Amber/Yellow glow */
  box-shadow: 0 0 10px #eab308, 0 0 20px #eab308;
  opacity: 0;
  animation: lock-btn-pulse 2s infinite;
  pointer-events: none;
}

@keyframes lock-btn-pulse {
  0% {
    transform: scale(1);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

/* Shake animation for incorrect PIN entry */
.animate-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Fade out animation */
.animate-fade-out {
  animation: fade-out 0.25s ease-out forwards;
}

@keyframes fade-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

/* Custom Toggle Switch for Active/Passive state */
.custom-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.custom-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  transition: .3s;
}

.custom-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: .3s;
}

input:checked + .custom-toggle-slider {
  background-color: var(--brand-primary);
}

input:checked + .custom-toggle-slider:before {
  transform: translateX(20px);
  background-color: #ffffff; /* Contrast white knob on active color */
}

input:disabled + .custom-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}
