/*
 * Teacher's Pet - Application Styles
 * Using DaisyUI Retro theme with Soviet Constructivism elements
 */

/* ============================================
   DaisyUI Retro Theme Customization
   Override primary color from pink to retro yellow (#D2B04C)
   ============================================ */

[data-theme="retro"] {
  /* Override primary color: #D2B04C (Vintage Mustard) */
  /* Using oklch format for DaisyUI compatibility */
  /* #D2B04C converted to oklch: approximately oklch(0.75 0.12 85) */
  --p: 0.75 0.12 85;
  /* Primary focus (hover state) - slightly darker */
  --pf: 0.70 0.12 85;
  /* Primary content (text on primary background) - white for contrast */
  --pc: 1 0 0;
  /* Info color (same as primary for consistency) */
  --in: 0.75 0.12 85;
  /* Success color (same as primary for consistency) */
  --su: 0.75 0.12 85;
}

/* ============================================
   Global Typography - 14px base
   ============================================ */

body {
  font-family: 'PT Sans', sans-serif; /* Base body font */
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Headings use Oswald font */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Oswald', sans-serif;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4, h5, h6 { font-size: 1rem; }

input, select, textarea, button {
  font-size: 0.875rem;
}

label {
  font-size: 0.875rem;
}

/* ============================================
   Responsive Table/Cards Switching
   ============================================ */

@media (min-width: 768px) {
  .grades-cards {
    display: none !important;
  }
  .grades-table-wrapper {
    display: block;
  }
}

@media (max-width: 767px) {
  .grades-table-wrapper {
    display: none !important;
  }
  .grades-cards {
    display: block !important;
  }
}

/* ============================================
   Grades Table Styles
   ============================================ */

.grades-table {
  font-size: 0.875rem;
  line-height: 1.25rem;
  table-layout: auto !important; /* Allow column resizing */
}

/* Resizable columns */
.grades-table th[data-resizable-column="true"] {
  position: relative;
  overflow: visible;
  white-space: normal !important;
  width: auto !important;
  min-width: 150px;
  max-width: 300px;
}

.grades-table th[data-resizable-column="true"] .resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 20;
  background: transparent;
  transition: background-color 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.grades-table th[data-resizable-column="true"] .resizer:hover {
  background: oklch(var(--p) / 0.3);
}

.grades-table th[data-resizable-column="true"]:hover .resizer {
  background: oklch(var(--p) / 0.2);
}

/* Text wrapping in metric headers */
.grades-table th[data-resizable-column="true"] .flex.flex-col > div:first-child > span:first-child {
  word-wrap: break-word !important;
  word-break: break-word !important;
  hyphens: auto;
  line-height: 1.3;
  max-height: 6.5em; /* Approximately 5 lines (1.3 * 5) */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  white-space: normal !important;
}

/* Menu button visibility - show on hover, but don't take space when hidden */
.grades-table th[data-resizable-column="true"] .dropdown button[data-action*="metric-header-menu"] {
  opacity: 0.3;
  transition: opacity 0.2s;
  display: inline-flex !important; /* Always render */
}

.grades-table th[data-resizable-column="true"]:hover .dropdown button[data-action*="metric-header-menu"] {
  opacity: 1;
}

/* Ensure cells match header width */
.grades-table tbody td {
  white-space: nowrap;
  overflow: visible !important; /* Allow dropdowns to overflow */
  text-overflow: ellipsis;
  position: relative; /* For absolute positioned dropdowns */
}

/* Allow dropdowns to overflow table wrapper */
.grades-table-wrapper {
  overflow: visible !important;
}

.grades-table-wrapper .card {
  overflow: visible !important;
}

.grades-table-wrapper .overflow-x-auto {
  overflow-x: auto;
  overflow-y: visible !important; /* Allow vertical overflow for dropdowns */
}

/* Scale buttons in table */
.grades-table .join {
  border-radius: 0.375rem;
  overflow: hidden;
}

.grades-table .join-item.btn-xs {
  min-width: 1.75rem;
  height: 1.5rem;
  padding: 0 0.25rem;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  body {
    background: white !important;
  }
}

/* ============================================
   Selection Styles
   ============================================ */

::selection {
  background: oklch(var(--p) / 0.2);
  color: oklch(var(--bc));
}

::-moz-selection {
  background: oklch(var(--p) / 0.2);
  color: oklch(var(--bc));
}

.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ============================================
   Link Styles
   ============================================ */

a {
  color: oklch(var(--p));
}

a:hover {
  opacity: 0.8;
}

/* Override for navigation links */
nav a,
.btn,
.no-underline {
  text-decoration: none;
}

/* ============================================
   SOVIET CONSTRUCTIVISM THEME
   ============================================ */

/* 7.1 Paper Texture Background */
body {
  background-image:
    radial-gradient(circle at 20% 80%, oklch(var(--p) / 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, oklch(var(--s) / 0.03) 0%, transparent 50%);
}

/* 7.2 Diagonal Stripes Pattern */
.constructivist-stripes {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    oklch(var(--p) / 0.08) 10px,
    oklch(var(--p) / 0.08) 20px
  );
}

.constructivist-stripes-dense {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    oklch(var(--p) / 0.06) 5px,
    oklch(var(--p) / 0.06) 10px
  );
}

/* Card with stripe decoration */
.card-constructivist {
  position: relative;
  overflow: hidden;
}

.card-constructivist::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    oklch(var(--p) / 0.1) 4px,
    oklch(var(--p) / 0.1) 8px
  );
  border-radius: 0 var(--rounded-btn, 0.5rem) var(--rounded-btn, 0.5rem) 0;
  pointer-events: none;
}

/* 7.3 Geometric Shapes */
.constructivist-corner {
  position: relative;
  overflow: hidden;
}

.constructivist-corner::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 40px 40px 0;
  border-color: transparent oklch(var(--p) / 0.15) transparent transparent;
  pointer-events: none;
}

/* Decorative underline for headings */
.constructivist-underline {
  position: relative;
  padding-bottom: 0.75rem;
}

.constructivist-underline::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60%;
  height: 4px;
  background: linear-gradient(
    90deg,
    oklch(var(--p)) 0%,
    oklch(var(--p)) 70%,
    transparent 70%
  );
}

/* Circle accent */
.constructivist-circle {
  position: relative;
}

.constructivist-circle::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  width: 30px;
  height: 30px;
  border: 3px solid oklch(var(--p) / 0.2);
  border-radius: 50%;
  pointer-events: none;
}

/* 7.4 Animations */
@keyframes constructivist-float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(5px, -5px) rotate(1deg);
  }
  50% {
    transform: translate(0, -10px) rotate(0deg);
  }
  75% {
    transform: translate(-5px, -5px) rotate(-1deg);
  }
}

@keyframes constructivist-pulse {
  0%, 100% {
    opacity: 0.08;
  }
  50% {
    opacity: 0.15;
  }
}

/* Animated background element */
.constructivist-bg-element {
  position: absolute;
  width: 80px;
  height: 80px;
  border: 3px solid oklch(var(--p) / 0.1);
  animation: constructivist-float 25s ease-in-out infinite;
  pointer-events: none;
}

.constructivist-bg-element--square {
  transform: rotate(45deg);
}

.constructivist-bg-element--circle {
  border-radius: 50%;
}

/* Pulsing stripes */
.constructivist-stripes-animated {
  animation: constructivist-pulse 4s ease-in-out infinite;
}

/* 7.5 Header decoration */
.header-constructivist {
  position: relative;
  /* overflow: hidden removed to allow dropdown menus to be visible */
}

.header-constructivist::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    oklch(var(--p) / 0.06) 6px,
    oklch(var(--p) / 0.06) 12px
  );
  pointer-events: none;
  clip-path: inset(0);
}

/* 7.6 Typography enhancements */
.font-constructivist {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
