/* ==========================================================================
   Dioly RMM - Global Design System & CSS Variables
   Dark-Mode Dashboard Architecture
   ========================================================================== */

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

/* --------------------------------------------------------------------------
   1. Design Tokens (:root CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Backgrounds & Surfaces */
  --bg-body: #0a0e1a;
  --bg-content: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #2d3b52;
  --bg-dark-blue: #001d3d;

  /* Color Palette - Primary & Gradients */
  --primary-cyan: #00b4d8;
  --primary-blue: #0077b6;
  --primary-gradient: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  --primary-gradient-hover: linear-gradient(135deg, #00c6eb 0%, #0088cc 100%);

  /* Color Palette - Status / Feedback */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  /* Color Palette - Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Borders & Focus Elements */
  --border-color: rgba(255, 255, 255, 0.06);
  --border-active: rgba(0, 180, 216, 0.4);
  --focus-ring: 0 0 0 3px rgba(0, 180, 216, 0.35);

  /* Shadows */
  --shadow-main: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(0, 180, 216, 0.15);

  /* Typography Settings */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Border Radii */
  --radius-card: 12px;
  --radius-input: 8px;
  --radius-container: 16px;
  --radius-pill: 9999px;

  /* Motion & Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Aliases for cross-file compatibility */
  --primary: var(--primary-cyan);
  --primary-dark: var(--primary-blue);
  --primary-hover: #00c6eb;
  --primary-glow: rgba(0, 180, 216, 0.35);
  --surface: var(--bg-surface);
  --surface-hover: var(--bg-surface-hover);
  --border: var(--border-color);
  --danger: var(--color-danger);
  --success: var(--color-success);
  --warning: var(--color-warning);
  --text: var(--text-primary);
}

/* --------------------------------------------------------------------------
   1b. Light Theme Overrides
   -------------------------------------------------------------------------- */
body.light-theme,
html.light-theme body {
  --bg-body: #f1f5f9;
  --bg-content: #e2e8f0;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-dark-blue: #e0f2fe;
  --input-bg: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-active: rgba(0, 119, 182, 0.4);

  --shadow-main: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(0, 180, 216, 0.1);

  --surface: var(--bg-surface);
  --surface-hover: var(--bg-surface-hover);
  --border: var(--border-color);
  --text: var(--text-primary);
}

/* --------------------------------------------------------------------------
   2. Modern CSS Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Inherit font styles for form controls and clickable elements */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Selects sem a classe .form-select seguem o tema (escuro por padrao, claro no
   .light-theme). Sem isto o navegador desenha o fundo e as opcoes em branco
   (ex.: setor na sanfona de comandos). As variaveis sao as mesmas do
   .form-select; onde a classe existir, ela vence por especificidade. */
select {
  color: var(--text-primary, #f8fafc);
  background-color: var(--input-bg, #0f172a);
  border: 1px solid var(--border, #1e293b);
  border-radius: 8px;
}

select option {
  background-color: var(--input-bg, #0f172a);
  color: var(--text-primary, #f8fafc);
}

/* Remove default list formatting */
ol,
ul {
  list-style: none;
}

/* Remove default link underline */
a {
  color: inherit;
  text-decoration: none;
}

/* Responsive image defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* Remove table border spacing */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* --------------------------------------------------------------------------
   3. Custom Dark-Themed Scrollbar
   -------------------------------------------------------------------------- */
/* Firefox Scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: #2d3b52 #0a0e1a;
}

/* Webkit Scrollbars (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: 4px;
  border: 2px solid var(--bg-body);
  transition: var(--transition-fast);
}

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

::-webkit-scrollbar-corner {
  background: var(--bg-body);
}

/* --------------------------------------------------------------------------
   4. Selection Highlight Styles
   -------------------------------------------------------------------------- */
::selection {
  background-color: rgba(0, 180, 216, 0.3);
  color: var(--text-primary);
}

::-moz-selection {
  background-color: rgba(0, 180, 216, 0.3);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   5. Smooth Focus Ring Styles
   -------------------------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary-cyan);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
  transition: var(--transition-fast);
}

/* --------------------------------------------------------------------------
   6. Typography Scale & Hierarchy
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 1.875rem);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(1.15rem, 2.5vw, 1.375rem);
  font-weight: var(--font-weight-semibold);
}

h4 {
  font-size: clamp(1rem, 2vw, 1.125rem);
  font-weight: var(--font-weight-medium);
}

p {
  font-size: 1rem;
  font-weight: var(--font-weight-regular);
  line-height: 1.6;
  color: var(--text-secondary);
}

small,
.text-small {
  font-size: 0.875rem;
  font-weight: var(--font-weight-regular);
  line-height: 1.4;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   7. Text Color & Styling Utility Classes
   -------------------------------------------------------------------------- */
.text-primary {
  color: var(--text-primary) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-success {
  color: var(--color-success) !important;
}

.text-warning {
  color: var(--color-warning) !important;
}

.text-danger {
  color: var(--color-danger) !important;
}

.text-cyan {
  color: var(--primary-cyan) !important;
}

.text-blue {
  color: var(--primary-blue) !important;
}

.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --------------------------------------------------------------------------
   8. Responsive Font Sizes & Layout Scale Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  html {
    font-size: 15.5px;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14.5px;
  }
}

/* Refresh button spin animation */
@keyframes spin-refresh {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.btn .fa-sync-alt.spinning,
.btn .fa-sync.spinning {
  animation: spin-refresh 0.8s linear infinite;
}
