/* CloudOpsGPT Enterprise Frontend Styles */

/* CSS Custom Properties */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-cyan: #22d3ee;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* Focus Styles for Accessibility */
*:focus {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Skip Navigation */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--accent-blue);
  color: white;
  border-radius: var(--radius-md);
  z-index: 9999;
}

/* Background Grid Pattern */
.bg-grid {
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
}

/* Floating Orb Animation */
.orb {
  position: absolute;
  inset: auto;
  width: 52rem;
  height: 52rem;
  border-radius: 9999px;
  background: 
    radial-gradient(closest-side, rgba(34, 211, 238, 0.22), transparent 60%),
    radial-gradient(closest-side, rgba(139, 92, 246, 0.18), transparent 60%);
  filter: blur(30px);
  transform: translate(-20%, -10%);
  animation: float 12s ease-in-out infinite alternate;
  z-index: -1;
}

@keyframes float {
  from { 
    transform: translate(-20%, -10%); 
  }
  to { 
    transform: translate(-15%, -2%); 
  }
}

/* Glass Morphism Effect */
.glass {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  line-height: 1.5;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: var(--bg-primary);
  box-shadow: 0 4px 14px 0 rgba(34, 211, 238, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(34, 211, 238, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.05);
}

/* Form Elements */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

/* Loading Spinner */
.spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid transparent;
  border-top: 2px solid var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Mobile Menu */
.mobile-menu {
  transition: all 0.3s ease;
}

.mobile-menu.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.mobile-menu:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Chat Interface */
.chat-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.chat-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.chat-avatar.user {
  background: rgba(34, 211, 238, 0.2);
}

.chat-avatar.assistant {
  background: rgba(59, 130, 246, 0.2);
}

.chat-bubble {
  max-width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-2xl);
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-bubble.user {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: var(--text-primary);
}

.chat-bubble.assistant {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Typewriter Effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent-cyan);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-cyan); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .orb {
    width: 30rem;
    height: 30rem;
  }
  
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
  }
  
  .card {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .orb {
    width: 20rem;
    height: 20rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
}

/* Print Styles */
@media print {
  .orb,
  .mobile-menu-button,
  .btn,
  #loadingOverlay {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .glass {
    background: white !important;
    border: 1px solid #ccc !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border-color: rgba(255, 255, 255, 0.3);
  }
  
  .glass {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--border-color);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .orb {
    animation: none;
  }
}

/* Dark Mode (already dark, but for consistency) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
  }
}

/* Utility Classes */
.text-gradient {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.border-gradient {
  border: 1px solid transparent;
  background: linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
              linear-gradient(135deg, var(--accent-cyan), var(--accent-blue)) border-box;
}

.shadow-glow {
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.3);
}

.backdrop-blur {
  backdrop-filter: blur(10px);
}

/* Focus Visible for better accessibility */
.btn:focus-visible,
.form-input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Selection styles */
::selection {
  background: rgba(34, 211, 238, 0.3);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(34, 211, 238, 0.3);
  color: var(--text-primary);
}

/* Passive full-screen layers must not intercept clicks */
#loadingOverlay,
.processing,
.processing-overlay,
.page-overlay,
.hero-overlay { 
  pointer-events: none; 
}

/* Only interactive UI (modals) accept clicks when open */
#loginModal, #signupModal, #loginModal *, #signupModal * { 
  pointer-events: auto; 
}

/* Keep header above decorative layers if you rely on z-classes */
.site-header, header[role="banner"] { 
  position: relative; 
  z-index: 1000; 
}

/* Modal overflow and positioning fixes */
#loginModal, #signupModal {
  overflow-y: auto;
  max-height: 100vh;
  padding: 1rem;
}

#loginModal .bg-slate-800, #signupModal .bg-slate-800 {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  margin: auto;
}

/* Ensure modals stay within viewport on small screens */
@media (max-height: 600px) {
  #loginModal, #signupModal {
    align-items: flex-start;
    padding-top: 2rem;
  }
  
  #loginModal .bg-slate-800, #signupModal .bg-slate-800 {
    max-height: calc(100vh - 4rem);
  }
}

/* Mobile responsive modal adjustments */
@media (max-width: 640px) {
  #loginModal .bg-slate-800, #signupModal .bg-slate-800 {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
  }
}

