/**
 * Material Preset Templates CSS
 * Specific styling for FIXED_DIMENSION vs VARIABLE_DIMENSION material preset templates
 * Version: 1.0.0
 */

/* ==========================================================================
   Template Container System
   ========================================================================== */

.material-template-container {
  position: relative;
  width: 100%;
}

.template-content {
  width: 100%;
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
}

.template-content.transitioning {
  opacity: 0;
}

/* Hidden template storage */
.template-hidden {
  display: none !important;
}

/* ==========================================================================
   VARIABLE_DIMENSION Material Template (FABRIC)
   ========================================================================== */

.variable-dimension-template {
  /* Inherits existing styles from main CSS */
}

.variable-dimension-template .input-row.columns-3 {
  /* Specific grid for FABRIC with swap button */
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  gap: var(--space-18);
  align-items: end;
}

.variable-dimension-template .swap-button {
  /* Swap button specific to FABRIC template */
  height: 24px;
  width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 0;
}

.variable-dimension-template .swap-button:hover {
  background-color: var(--color-button-delete-hover);
}

/* ==========================================================================
   FIXED_DIMENSION Material Template (PLYWOOD/FOAM)
   ========================================================================== */

.fixed-dimension-template {
  /* Clean layout without swap button */
}

.fixed-dimension-template .input-row.columns-2 {
  /* Material Preset + Grain Pattern row */
  display: grid;
  grid-template-columns: 60% 1fr;
  gap: var(--space-18);
}

.fixed-dimension-template .input-row.columns-4 {
  /* Width + Length + Kerf row (no swap button) */
  display: grid;
  grid-template-columns: 60px 1fr 1fr 1fr;
  gap: var(--space-12);
}

.fixed-dimension-template .material-input-readonly {
  /* Read-only styling for standard fixed materials */
  background-color: var(--color-background-darker);
  color: var(--color-foreground-darker);
  cursor: not-allowed;
  border-color: var(--color-background-brighter);
}

.fixed-dimension-template .material-input-readonly:focus {
  /* Override focus styles for read-only inputs */
  outline: none;
  box-shadow: 0 0 0 2px var(--color-background-brighter);
}

.fixed-dimension-template .material-input-editable {
  /* Normal styling for custom fixed materials */
  background-color: var(--color-background-primary);
  color: var(--color-foreground-primary);
  cursor: text;
  border-color: var(--color-background-brighter);
}

/* ==========================================================================
   Pattern/Grain Specific Styling
   ========================================================================== */

.variable-dimension-template .pattern-label::before {
  content: "Stripe Pattern";
}

.fixed-dimension-template .pattern-label::before {
  content: "Grain Direction";
}

/* Ensure pattern labels are consistent */
.template-pattern-label {
  font-weight: 500;
  color: var(--color-text-primary);
}

/* ==========================================================================
   Material System Indicators
   ========================================================================== */

.material-system-indicator {
  position: absolute;
  top: -8px;
  right: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.7;
}

.material-system-indicator.variable-dimensions {
  background-color: var(--color-primary);
  color: white;
}

.material-system-indicator.fixed-dimensions {
  background-color: var(--color-secondary);
  color: white;
}

/* Hide indicators in production (for development only) */
.material-system-indicator.production-hidden {
  display: none;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */



/* ==========================================================================
   Animation and Transitions
   ========================================================================== */

.template-fade-in {
  animation: templateFadeIn 0.3s ease-in-out;
}

.template-fade-out {
  animation: templateFadeOut 0.2s ease-in-out;
}

@keyframes templateFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes templateFadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

/* ==========================================================================
   Material Type Specific Colors (Optional Enhancement)
   ========================================================================== */

.material-template-container.fabric-template {
  /* Subtle accent for FABRIC materials */
  border-left: 3px solid var(--color-primary);
}

.material-template-container.plywood-template {
  /* Subtle accent for PLYWOOD materials */
  border-left: 3px solid #8B4513; /* Brown for wood */
}

.material-template-container.foam-template {
  /* Subtle accent for FOAM materials */
  border-left: 3px solid #FFB347; /* Orange for foam */
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.material-template-container [role="group"] {
  border: none;
}

.material-template-container .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .fixed-dimension-template .material-input-readonly {
    border: 2px solid;
    background-color: transparent;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .template-content,
  .template-fade-in,
  .template-fade-out {
    animation: none;
    transition: none;
  }
}

/* ==========================================================================
   CSS Variable Definitions for Template System
   ========================================================================== */

:root {
  --color-background-readonly: #f5f5f5;
  --color-background-brighter: #d0d0d0;
  --template-transition-duration: 0.2s;
  --template-border-radius: 4px;
  --template-spacing-unit: 8px;
}

/* Dark theme support */
[data-theme="dark"] {
  --color-background-readonly: #2a2a2a;
  --color-background-brighter: #555555;
}