/* ==========================================================================
   RSAM — Global Stylesheet
   Ported 1:1 from frontend/src/App.css + frontend/src/index.css
            + frontend/src/styles/Home.css (custom animations/patterns)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
:root {
  --blue-dark: #0a2342;
  --blue-primary: #0056b3;
  --blue-primary-light: #0080ff;
  --blue-primary-dark: #003166;
  --text-primary: #333333;
  --text-secondary: #666666;
  --bg-light: #f8fafc;
  --white: #ffffff;
  --gray-light: #f1f5f9;
  --gray-medium: #e2e8f0;
  --transition-all: all 0.3s ease;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #667eea 20%, #764ba2 80%);
  --shadow-soft: 0 15px 35px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 20px 40px rgba(0, 0, 0, 0.12);
  --shadow-strong: 0 25px 50px rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  background-color: var(--bg-light);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: left;
}

.App {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  text-align: left;
}

main {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--blue-dark);
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--blue-primary);
  text-decoration: none;
  transition: var(--transition-all);
}

a:hover {
  color: var(--blue-primary-dark);
}

/* --------------------------------------------------------------------------
   Layout Enhancements
   -------------------------------------------------------------------------- */
body .container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (min-width: 1536px) {
  body .container {
    max-width: 1440px;
  }
}

/* --------------------------------------------------------------------------
   Section Styling
   -------------------------------------------------------------------------- */
.section {
  padding: 5rem 0;
  position: relative;
}

.section-sm {
  padding: 3rem 0;
}

.section-lg {
  padding: 8rem 0;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--blue-dark);
}

.section-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}

/* --------------------------------------------------------------------------
   Background Variations
   -------------------------------------------------------------------------- */
.bg-gradient-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--white);
}

.bg-gradient-secondary {
  background: linear-gradient(135deg, #0056b3 0%, #3498db 100%);
  color: var(--white);
}

.bg-light {
  background-color: var(--gray-light);
}

.bg-white {
  background-color: var(--white);
}

.text-gradient {
  background: linear-gradient(135deg, var(--blue-primary) 0%, #764ba2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --------------------------------------------------------------------------
   Card Styles
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--white);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  transition: var(--transition-all);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.1);
}

.card-hover {
  transition: box-shadow 0.3s ease;
}

.card-hover:hover {
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* --------------------------------------------------------------------------
   Button Styles
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: var(--transition-all);
  cursor: pointer;
  line-height: 1;
  border: none;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--blue-primary);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--blue-primary-dark);
  color: var(--white);
}

.btn-outline {
  border: 2px solid var(--blue-primary);
  color: var(--blue-primary);
  background-color: transparent;
}

.btn-outline:hover {
  background-color: var(--blue-primary);
  color: var(--white);
}

.btn-white {
  background-color: var(--white);
  color: var(--blue-primary);
}

.btn-white:hover {
  background-color: var(--gray-light);
  color: var(--blue-primary-dark);
}

.btn-rounded {
  border-radius: 9999px;
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: var(--transition-all);
}

.btn-secondary:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.btn-disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Scroll to top button
   -------------------------------------------------------------------------- */
.scroll-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--blue-primary);
  color: var(--white);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  box-shadow: 0 10px 15px -3px rgba(0, 86, 179, 0.3);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.17, 0.67, 0.83, 0.67);
  z-index: 999;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background-color: var(--blue-primary-dark);
  transform: translateY(-5px);
}

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 40;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease forwards;
}

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

.animate-slideUp {
  animation: slideUp 0.5s ease forwards;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

@keyframes float-slow {
  0% { transform: translateY(0px) translateX(0px); }
  50% { transform: translateY(-15px) translateX(10px); }
  100% { transform: translateY(0px) translateX(0px); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { opacity: 0.3; }
  100% { transform: scale(1.2); opacity: 0; }
}

@keyframes shimmer {
  0% { background-position: -500px 0; }
  100% { background-position: 500px 0; }
}

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

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

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-float-slow {
  animation: float-slow 8s ease-in-out infinite;
}

.animate-pulse-ring {
  animation: pulse-ring 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

.animate-shimmer {
  animation: shimmer 2s infinite linear;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  background-size: 1000px 100%;
}

.animate-rotate {
  animation: rotate 20s linear infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.animate-modal-enter {
  animation: modal-enter 0.2s ease-out;
}

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

/* --------------------------------------------------------------------------
   Background Patterns
   -------------------------------------------------------------------------- */
.bg-pattern-dots {
  background-image: radial-gradient(rgba(0, 86, 179, 0.2) 1px, transparent 1px);
  background-size: 20px 20px;
}

.bg-dot-pattern {
  background-image: radial-gradient(rgba(0, 86, 179, 0.2) 1px, transparent 1px);
  background-size: 20px 20px;
}

.bg-grid-pattern {
  background-image: linear-gradient(to right, rgba(0, 86, 179, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 86, 179, 0.1) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-diagonal-lines {
  background-image: repeating-linear-gradient(45deg, rgba(0, 86, 179, 0.05), rgba(0, 86, 179, 0.05) 10px,
    rgba(255, 255, 255, 0) 10px, rgba(255, 255, 255, 0) 20px);
}

/* --------------------------------------------------------------------------
   Card Effects
   -------------------------------------------------------------------------- */
.card-hover-effect {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-effect:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.shadow-blue-highlight {
  box-shadow: 0 5px 15px -3px rgba(0, 86, 179, 0.3);
}

.shadow-hover-blue {
  transition: box-shadow 0.3s ease;
}

.shadow-hover-blue:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 86, 179, 0.4);
}

.glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.rotating-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(45deg, #0056b3, #764ba2, #0056b3);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: rotate 4s linear infinite;
}

/* --------------------------------------------------------------------------
   Loading
   -------------------------------------------------------------------------- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--gray-medium);
  border-top-color: var(--blue-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Page Header
   -------------------------------------------------------------------------- */
.page-header {
  position: relative;
}

@media (max-width: 768px) {
  .page-header {
    min-height: 50vh !important;
  }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 86, 179, 0.5) rgba(241, 245, 249, 0.7);
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.7);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 86, 179, 0.5);
  border-radius: 10px;
}

/* Smooth transitions for interactive elements */
a, button, input, select, textarea, .transition-all, .transition-colors, .transition-transform {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Focus styles */
button:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  padding: 8px;
  background-color: var(--blue-primary);
  color: white;
  z-index: 1000;
  transition: top 0.3s;
}

.skip-to-content:focus {
  top: 0;
}

/* --------------------------------------------------------------------------
   Responsive adjustments for small screens
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .section { padding: 3rem 0; }
  .section-lg { padding: 5rem 0; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
}

@media (max-width: 640px) {
  body .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
