/* ==========================================================================
   Speed Comunicação Escolar - Master Theme Stylesheet
   ========================================================================== */

/* 1. CSS Custom Properties / Variables */
:root {
  --speed-blue: #1B7EB8;
  --speed-blue-dark: #125E8A;
  --speed-green: #7DBE42;
  --speed-green-dark: #66A233;
  --speed-gray: #58595B;
  --speed-gray-light: #F5F7F9;
  --white: #FFFFFF;
  --success: #7DBE42;
  --error: #D64545;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dark Mode Tokens */
html.dark,
body.dark-mode {
  --speed-gray: #E5E7EB;
  --speed-gray-light: #111827;
  --white: #1F2937;
  background-color: #0B0F17;
  color: #F3F4F6;
}

/* 2. Base Resets & Global Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--speed-gray);
  background-color: #FFFFFF;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: #111827;
}

html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6, html.dark .font-heading {
  color: #FFFFFF;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Fallback SVG dimension constraints to prevent gigantic icons */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

svg.w-3 { width: 0.75rem !important; height: 0.75rem !important; }
svg.h-3 { height: 0.75rem !important; }
svg.w-3\.5 { width: 0.875rem !important; height: 0.875rem !important; }
svg.h-3\.5 { height: 0.875rem !important; }
svg.w-4 { width: 1rem !important; height: 1rem !important; }
svg.h-4 { height: 1rem !important; }
svg.w-5 { width: 1.25rem !important; height: 1.25rem !important; }
svg.h-5 { height: 1.25rem !important; }
svg.w-6 { width: 1.5rem !important; height: 1.5rem !important; }
svg.h-6 { height: 1.5rem !important; }
svg.w-7 { width: 1.75rem !important; height: 1.75rem !important; }
svg.h-7 { height: 1.75rem !important; }
svg.w-8 { width: 2rem !important; height: 2rem !important; }
svg.h-8 { height: 2rem !important; }
svg.w-10 { width: 2.5rem !important; height: 2.5rem !important; }
svg.h-10 { height: 2.5rem !important; }
svg.w-12 { width: 3rem !important; height: 3rem !important; }
svg.h-12 { height: 3rem !important; }
svg.w-16 { width: 4rem !important; height: 4rem !important; }
svg.h-16 { height: 4rem !important; }
svg.w-20 { width: 5rem !important; height: 5rem !important; }
svg.h-20 { height: 5rem !important; }

button, input, select, textarea {
  font-family: inherit;
}

button, a, select, summary, label, [role="button"], .cursor-pointer {
  cursor: pointer;
}

/* 3. Utility Layout Classes */
.container,
.max-w-7xl {
  width: 100%;
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

.max-w-6xl { max-width: 72rem; margin-left: auto; margin-right: auto; }
.max-w-5xl { max-width: 64rem; margin-left: auto; margin-right: auto; }
.max-w-4xl { max-width: 56rem; margin-left: auto; margin-right: auto; }
.max-w-3xl { max-width: 48rem; margin-left: auto; margin-right: auto; }
.max-w-2xl { max-width: 42rem; margin-left: auto; margin-right: auto; }
.max-w-xl  { max-width: 36rem; margin-left: auto; margin-right: auto; }
.max-w-md  { max-width: 28rem; margin-left: auto; margin-right: auto; }

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }

/* Flex & Grid Display Fallbacks */
.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.grid { display: grid !important; }

.flex-col { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.shrink-0 { flex-shrink: 0 !important; }
.flex-1 { flex: 1 1 0% !important; }

.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-6 { gap: 1.5rem !important; }
.gap-8 { gap: 2rem !important; }
.gap-10 { gap: 2.5rem !important; }
.gap-12 { gap: 3rem !important; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }

@media (min-width: 640px) {
  .sm\:flex { display: flex !important; }
  .sm\:hidden { display: none !important; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (min-width: 768px) {
  .md\:flex { display: flex !important; }
  .md\:hidden { display: none !important; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (min-width: 1024px) {
  .lg\:flex { display: flex !important; }
  .lg\:hidden { display: none !important; }
  .lg\:grid { display: grid !important; }
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; }
  .lg\:col-span-4 { grid-column: span 4 / span 4 !important; }
  .lg\:col-span-5 { grid-column: span 5 / span 5 !important; }
  .lg\:col-span-7 { grid-column: span 7 / span 7 !important; }
  .lg\:col-span-8 { grid-column: span 8 / span 8 !important; }
}

/* 4. Component Buttons & Cards */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--speed-blue);
  color: #FFFFFF !important;
  font-weight: 700;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  border: none;
  box-shadow: 0 4px 14px rgba(27, 126, 184, 0.3);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary:hover {
  background-color: var(--speed-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(27, 126, 184, 0.4);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: transparent;
  color: var(--speed-blue);
  font-weight: 700;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  border: 2px solid var(--speed-blue);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-secondary:hover {
  background-color: rgba(27, 126, 184, 0.08);
  transform: translateY(-2px);
}

html.dark .btn-secondary {
  color: #38BDF8;
  border-color: #38BDF8;
}

html.dark .btn-secondary:hover {
  background-color: rgba(56, 189, 248, 0.12);
}

.btn-green {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--speed-green);
  color: #FFFFFF !important;
  font-weight: 700;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  border: none;
  box-shadow: 0 4px 14px rgba(125, 190, 66, 0.3);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-green:hover {
  background-color: var(--speed-green-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(125, 190, 66, 0.4);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--speed-blue);
  margin-bottom: 0.5rem;
}

html.dark .eyebrow {
  color: #38BDF8;
}

/* 5. Custom Card Styling */
.speed-card {
  background-color: #FFFFFF;
  border-radius: 1.5rem;
  border: 1px solid rgba(229, 231, 235, 0.8);
  padding: 1.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.speed-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

html.dark .speed-card {
  background-color: #111827;
  border-color: #1F2937;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

html.dark .speed-card:hover {
  border-color: var(--speed-blue);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

/* 6. Animations & Orbs */
.floating-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.4;
  animation: pulse-slow 8s infinite alternate ease-in-out;
}

@keyframes pulse-slow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.3; }
  100% { transform: scale(1.15) translate(15px, -15px); opacity: 0.5; }
}

/* 7. Form Controls */
.speed-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: #F9FAFB;
  color: #111827;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  outline: none;
}

html.dark .speed-input {
  background-color: #1F2937;
  color: #F9FAFB;
  border-color: #374151;
}

.speed-input:focus {
  border-color: var(--speed-blue);
  box-shadow: 0 0 0 3px rgba(27, 126, 184, 0.15);
  background-color: #FFFFFF;
}

html.dark .speed-input:focus {
  background-color: #111827;
}

/* 8. Toast Feedback & Modals */
.speed-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: #111827;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* 9. Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #F5F7F9;
}
::-webkit-scrollbar-thumb {
  background: #1B7EB8;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #125E8A;
}
