/* ==========================================================================
   Classicalia Google Theme — Shared Dashboard Stylesheet
   A clean, consistent Google-inspired design system.
   ========================================================================== */

/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */

:root {
  /* Primary palette */
  --g-blue: #0066ff;
  --g-red: #EA4335;
  --g-yellow: #FBBC04;
  --g-green: #34A853;

  /* Neutrals */
  --g-text: #1a1f3c;
  --g-text-secondary: #4a5070;
  --g-border: #dde1ee;
  --g-bg: #f0f2f8;
  --g-card-bg: #FFFFFF;
  --g-hover: #e8f0fe;

  /* Extended palette — tinted backgrounds */
  --g-blue-light: #dbeafe;
  --g-red-light: #fee2e2;
  --g-yellow-light: #fef3c7;
  --g-green-light: #d1fae5;
  --g-gray-light: #f4f5f9;
  --g-surface-dim: #e8eaee;

  /* Typography */
  --g-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --g-font-size: 15px;
  --g-font-size-sm: 12px;
  --g-font-size-lg: 16px;
  --g-font-size-xl: 18px;
  --g-font-size-xxl: 24px;
  --g-font-weight: 400;
  --g-font-weight-medium: 500;

  /* Spacing */
  --g-space-4: 4px;
  --g-space-8: 8px;
  --g-space-12: 12px;
  --g-space-16: 16px;
  --g-space-24: 24px;
  --g-space-32: 32px;
  --g-space-48: 48px;

  /* Border radius */
  --g-radius-sm: 6px;
  --g-radius: 12px;
  --g-radius-lg: 14px;
  --g-radius-pill: 8px;
  --g-radius-circle: 50%;

  /* Shadows */
  --g-shadow-hover: 0 2px 10px rgba(13,20,51,0.09), 0 1px 3px rgba(13,20,51,0.05);
  --g-shadow-raised: 0 6px 22px rgba(13,20,51,0.13), 0 2px 5px rgba(13,20,51,0.07);
  --g-shadow-modal: 0 20px 40px rgba(13,20,51,0.2);

  /* Transitions */
  --g-transition: 0.2s ease;
}

/* ==========================================================================
   2. Reset / Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--g-bg);
  font-family: var(--g-font);
  font-size: var(--g-font-size);
  font-weight: var(--g-font-weight);
  color: var(--g-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--g-space-16);
  font-weight: var(--g-font-weight-medium);
  line-height: 1.3;
  color: var(--g-text);
}

h1 { font-size: 28px; }
h2 { font-size: var(--g-font-size-xxl); }
h3 { font-size: var(--g-font-size-xl); }
h4 { font-size: var(--g-font-size-lg); }

p {
  margin: 0 0 var(--g-space-16);
}

a {
  color: var(--g-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ==========================================================================
   3. Layout
   ========================================================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--g-space-24);
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--g-space-24);
}

/* ==========================================================================
   4. Top Bar
   ========================================================================== */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 var(--g-space-24);
  background: #0d1433;
  border-bottom: none;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: var(--g-space-8);
  font-size: var(--g-font-size-xl);
  font-weight: var(--g-font-weight-medium);
  color: #ffffff;
  text-decoration: none;
  margin-right: var(--g-space-32);
  white-space: nowrap;
}

.top-bar-brand:hover {
  text-decoration: none;
}

.top-bar-nav {
  display: flex;
  align-items: center;
  gap: var(--g-space-4);
  flex: 1;
  overflow-x: auto;
}

.top-bar-nav a {
  display: inline-flex;
  align-items: center;
  padding: var(--g-space-8) var(--g-space-12);
  border-radius: var(--g-radius-pill);
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--g-font-size);
  font-weight: var(--g-font-weight-medium);
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--g-transition), color var(--g-transition);
}

.top-bar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
}

.top-bar-nav a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--g-space-8);
  margin-left: auto;
  color: rgba(255, 255, 255, 0.7);
}

/* Buttons & text inside dark top-bar */
.top-bar .btn-ghost {
  color: rgba(255, 255, 255, 0.7);
}
.top-bar .btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.top-bar .chip {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}
.top-bar h1, .top-bar span, .top-bar .text-muted {
  color: rgba(255, 255, 255, 0.85);
}

/* ==========================================================================
   5. Cards
   ========================================================================== */

.card {
  background: var(--g-card-bg);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius);
  padding: var(--g-space-24);
  box-shadow: var(--g-shadow-hover);
  transition: box-shadow var(--g-transition);
}

.card:hover {
  box-shadow: var(--g-shadow-raised);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--g-space-16);
  margin-bottom: var(--g-space-16);
  border-bottom: 1px solid var(--g-border);
}

.card-title {
  font-size: var(--g-font-size-xl);
  font-weight: var(--g-font-weight-medium);
  color: var(--g-text);
  margin: 0;
}

.card-body {
  /* default flow */
}

/* ==========================================================================
   6. Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--g-space-8);
  height: 36px;
  padding: 0 var(--g-space-16);
  border: none;
  border-radius: var(--g-radius-pill);
  font-family: var(--g-font);
  font-size: var(--g-font-size);
  font-weight: var(--g-font-weight-medium);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--g-transition), box-shadow var(--g-transition), opacity var(--g-transition);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--g-blue);
  color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
  background: #1a74ff;
  box-shadow: var(--g-shadow-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--g-hover);
}

.btn-danger {
  background: var(--g-red);
  color: #FFFFFF;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  box-shadow: var(--g-shadow-hover);
}

.btn-success {
  background: var(--g-green);
  color: #FFFFFF;
}

.btn-success:hover:not(:disabled) {
  background: #2da352;
  box-shadow: var(--g-shadow-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--g-text-secondary);
  border: none;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--g-hover);
  color: var(--g-blue);
}

.btn-sm {
  height: 28px;
  font-size: var(--g-font-size-sm);
  padding: 0 var(--g-space-12);
}

.btn-icon {
  width: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 28px;
}

/* ==========================================================================
   7. Chips / Badges
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--g-space-12);
  border-radius: var(--g-radius-pill);
  font-size: var(--g-font-size-sm);
  font-weight: var(--g-font-weight-medium);
  white-space: nowrap;
}

.chip-blue {
  background: var(--g-blue-light);
  color: var(--g-blue);
}

.chip-red {
  background: var(--g-red-light);
  color: var(--g-red);
}

.chip-yellow {
  background: var(--g-yellow-light);
  color: #b45309;
}

.chip-green {
  background: var(--g-green-light);
  color: var(--g-green);
}

.chip-gray {
  background: var(--g-gray-light);
  color: var(--g-text-secondary);
}

/* ==========================================================================
   8. Tables
   ========================================================================== */

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.table th {
  text-align: left;
  font-size: var(--g-font-size-sm);
  font-weight: var(--g-font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--g-text-secondary);
  padding: var(--g-space-12) var(--g-space-16);
  border-bottom: 2px solid var(--g-border);
  white-space: nowrap;
}

.table td {
  padding: var(--g-space-12) var(--g-space-16);
  border-bottom: 1px solid var(--g-border);
  color: var(--g-text);
}

.table tr:hover td {
  background: var(--g-bg);
}

.table-compact th,
.table-compact td {
  padding: var(--g-space-8) var(--g-space-12);
}

/* ==========================================================================
   9. Tabs
   ========================================================================== */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--g-border);
  overflow-x: auto;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: var(--g-space-12) var(--g-space-16);
  border: none;
  background: transparent;
  font-family: var(--g-font);
  font-size: var(--g-font-size);
  font-weight: var(--g-font-weight);
  color: var(--g-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--g-transition), color var(--g-transition);
}

.tab:hover {
  background: var(--g-bg);
  color: var(--g-text);
}

.tab.active {
  color: var(--g-blue);
  font-weight: var(--g-font-weight-medium);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--g-blue);
  border-radius: 3px 3px 0 0;
}

/* ==========================================================================
   10. Metric Cards
   ========================================================================== */

.metric-card {
  background: var(--g-card-bg);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius);
  padding: var(--g-space-24);
  text-align: center;
  box-shadow: var(--g-shadow-hover);
  transition: box-shadow var(--g-transition);
}

.metric-card:hover {
  box-shadow: var(--g-shadow-raised);
}

.metric-value {
  font-size: 32px;
  font-weight: var(--g-font-weight-medium);
  color: var(--g-text);
  line-height: 1.2;
}

.metric-label {
  font-size: var(--g-font-size-sm);
  font-weight: var(--g-font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--g-text-secondary);
  margin-top: var(--g-space-4);
}

/* ==========================================================================
   11. Stats Row
   ========================================================================== */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--g-space-16);
}

/* ==========================================================================
   12. Forms
   ========================================================================== */

.form-group {
  margin-bottom: var(--g-space-16);
}

.form-label {
  display: block;
  font-size: var(--g-font-size-sm);
  font-weight: var(--g-font-weight-medium);
  color: var(--g-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: var(--g-space-4);
}

.form-input,
.form-select {
  width: 100%;
  height: 40px;
  padding: 0 var(--g-space-12);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-sm);
  font-family: var(--g-font);
  font-size: var(--g-font-size);
  color: var(--g-text);
  background: var(--g-card-bg);
  transition: border-color var(--g-transition), box-shadow var(--g-transition);
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--g-blue);
  box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.2);
}

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

textarea.form-input {
  height: auto;
  min-height: 80px;
  padding: var(--g-space-12);
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5070' d='M3 5l3 3 3-3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ==========================================================================
   13. Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--g-card-bg);
  border-radius: var(--g-radius);
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--g-shadow-modal);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--g-space-24) var(--g-space-24) 0;
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
}

.modal-body {
  padding: var(--g-space-24);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--g-space-8);
  padding: 0 var(--g-space-24) var(--g-space-24);
}

/* ==========================================================================
   14. Status Indicators
   ========================================================================== */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--g-radius-circle);
}

.status-dot-blue  { background: var(--g-blue); }
.status-dot-red   { background: var(--g-red); }
.status-dot-yellow { background: var(--g-yellow); }
.status-dot-green { background: var(--g-green); }
.status-dot-gray  { background: var(--g-text-secondary); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--g-space-4);
  height: 20px;
  padding: 0 var(--g-space-8);
  border-radius: var(--g-radius-pill);
  font-size: 11px;
  font-weight: var(--g-font-weight-medium);
}

.status-badge-blue {
  background: var(--g-blue-light);
  color: var(--g-blue);
}

.status-badge-red {
  background: var(--g-red-light);
  color: var(--g-red);
}

.status-badge-yellow {
  background: var(--g-yellow-light);
  color: #b45309;
}

.status-badge-green {
  background: var(--g-green-light);
  color: var(--g-green);
}

.status-badge-gray {
  background: var(--g-gray-light);
  color: var(--g-text-secondary);
}

/* ==========================================================================
   15. Quadrant Grid (Interventions)
   ========================================================================== */

.quadrant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--g-space-16);
}

.quadrant {
  border-radius: var(--g-radius);
  padding: var(--g-space-16);
}

.quadrant-stretch {
  background: var(--g-green-light);
}

.quadrant-effort {
  background: var(--g-yellow-light);
}

.quadrant-commitment {
  background: var(--g-blue-light);
}

.quadrant-support {
  background: var(--g-red-light);
}

/* ==========================================================================
   16. Progress Bars
   ========================================================================== */

.progress-bar {
  height: 8px;
  background: var(--g-surface-dim);
  border-radius: var(--g-radius-sm);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--g-radius-sm);
  transition: width 0.3s ease;
}

.progress-fill-blue   { background: var(--g-blue); }
.progress-fill-red    { background: var(--g-red); }
.progress-fill-yellow { background: var(--g-yellow); }
.progress-fill-green  { background: var(--g-green); }

/* ==========================================================================
   17. Heatmap Cells
   ========================================================================== */

.heatmap-cell {
  border-radius: 2px;
  aspect-ratio: 1;
}

.heatmap-level-0 { background: var(--g-surface-dim); }
.heatmap-level-1 { background: #bbf7d0; }
.heatmap-level-2 { background: #6ee7b7; }
.heatmap-level-3 { background: #34A853; }
.heatmap-level-4 { background: #059669; }

/* ==========================================================================
   18. Avatars
   ========================================================================== */

.avatar {
  border-radius: var(--g-radius-circle);
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-md {
  width: 48px;
  height: 48px;
}

.avatar-lg {
  width: 80px;
  height: 80px;
}

/* ==========================================================================
   19. Alerts / Notices
   ========================================================================== */

.alert {
  padding: var(--g-space-12) var(--g-space-16);
  border-radius: var(--g-radius);
  border-left: 4px solid;
  font-size: var(--g-font-size);
  line-height: 1.5;
}

.alert-info {
  background: var(--g-blue-light);
  border-left-color: var(--g-blue);
  color: #1e40af;
}

.alert-warning {
  background: var(--g-yellow-light);
  border-left-color: var(--g-yellow);
  color: #b45309;
}

.alert-error {
  background: var(--g-red-light);
  border-left-color: var(--g-red);
  color: #b91c1c;
}

.alert-success {
  background: var(--g-green-light);
  border-left-color: var(--g-green);
  color: #047857;
}

/* ==========================================================================
   20. Empty States
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: var(--g-space-48);
  color: var(--g-text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  opacity: 0.5;
  margin-bottom: var(--g-space-16);
}

.empty-state-text {
  font-size: var(--g-font-size-lg);
  margin: 0;
}

/* ==========================================================================
   21. Loading Spinner
   ========================================================================== */

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--g-border);
  border-top-color: var(--g-blue);
  border-radius: var(--g-radius-circle);
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   22. Utility Classes
   ========================================================================== */

/* Text alignment */
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Text color */
.text-muted   { color: var(--g-text-secondary); }
.text-primary { color: var(--g-blue); }
.text-danger  { color: var(--g-red); }
.text-success { color: var(--g-green); }

/* Spacing — margin-top */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

/* Spacing — margin-bottom */
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

/* Centering */
.mx-auto { margin-left: auto; margin-right: auto; }

/* Flexbox */
.flex         { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }

/* Gaps */
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* Visibility */
.hidden { display: none !important; }

/* Grid columns */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--g-space-16); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--g-space-16); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--g-space-16); }

/* ==========================================================================
   23. Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .quadrant-grid {
    grid-template-columns: 1fr 1fr;
  }

  .container {
    padding: 0 var(--g-space-16);
  }
}

@media (max-width: 480px) {
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .quadrant-grid {
    grid-template-columns: 1fr;
  }

  .top-bar {
    height: 56px;
    padding: 0 var(--g-space-16);
  }

  .top-bar-brand {
    font-size: var(--g-font-size-lg);
    margin-right: var(--g-space-16);
  }

  .table {
    font-size: var(--g-font-size-sm);
  }

  .table th,
  .table td {
    padding: var(--g-space-8) var(--g-space-12);
  }

  .card {
    padding: var(--g-space-16);
  }

  .modal {
    width: 95%;
  }
}

/* ==========================================================================
   24. Transitions / Animations
   ========================================================================== */

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

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

/* ==========================================================================
   25. Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--g-border);
  border-radius: var(--g-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--g-text-secondary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--g-border) transparent;
}
