/* FinEasy Web - Responsive Styles */

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

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
  background-color: #fafafa;
}

/* Flutter Container */
#flutter-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Prevent stretching on large screens */
flt-glass-pane {
  max-width: 100%;
}

/* Center content and add max width */
body > flt-glass-pane > flt-scene-host {
  max-width: 1920px;
  margin: 0 auto;
}

/* Loading Indicator */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive Breakpoints */
/* Mobile: < 768px */
/* Tablet: 768px - 1023px */
/* Desktop: >= 1024px */

/* Mobile Styles (Default) */
@media (max-width: 767px) {
  body {
    font-size: 14px;
  }
  
  /* Ensure touch targets are at least 44x44 */
  button, a, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Prevent text from being too small */
  input, select, textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1023px) {
  body {
    font-size: 15px;
  }
  
  #flutter-container {
    max-width: 100%;
  }
}

/* Desktop Styles */
@media (min-width: 1024px) {
  body {
    font-size: 16px;
  }
  
  #flutter-container {
    max-width: 100%;
  }
  
  /* Constrain content width on desktop */
  flt-glass-pane {
    max-width: 1600px;
    margin: 0 auto;
  }
  
  /* Better scrollbars on desktop */
  ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }
  
  ::-webkit-scrollbar-track {
    background: #f1f1f1;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #555;
  }
}

/* Large Desktop Styles */
@media (min-width: 1440px) {
  #flutter-container {
    max-width: 100%;
    margin: 0 auto;
  }
  
  /* Comfortable max width for large screens */
  flt-glass-pane {
    max-width: 1800px;
  }
}

/* Extra Large Screens */
@media (min-width: 1920px) {
  /* Prevent excessive stretching on very large screens */
  flt-glass-pane {
    max-width: 1920px;
  }
  
  body {
    background: #f5f5f5;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
  }
  
  /* Hide non-essential elements when printing */
  .no-print {
    display: none !important;
  }
}

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

/* Focus Styles */
*:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Prevent horizontal scroll */
html {
  overflow-x: hidden;
}

/* Add subtle padding on very large screens */
@media (min-width: 1600px) {
  body {
    padding: 0 24px;
  }
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Better text rendering */
body {
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

/* Prevent iOS text size adjustment */
@supports (-webkit-touch-callout: none) {
  body {
    -webkit-text-size-adjust: none;
  }
}

/* Loading Screen Improvements */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease-out;
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

.splash-text {
  color: white;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
}

.splash-subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  margin-bottom: 32px;
}

/* Error Screen */
.error-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding: 24px;
  text-align: center;
}

.error-icon {
  font-size: 64px;
  color: #f44336;
  margin-bottom: 16px;
}

.error-title {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.error-message {
  font-size: 16px;
  color: #666;
  margin-bottom: 24px;
  max-width: 500px;
}

.error-button {
  padding: 12px 24px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.error-button:hover {
  background: #5568d3;
}

/* Offline Indicator */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ff9800;
  color: white;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Images */
img {
  max-width: 100%;
  height: auto;
}

/* Prevent text selection on buttons */
button {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
