/* This file is for your main application CSS */
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

@import "syntax.css";

@layer components {
  .aspect-video {
    @apply max-w-lg
  }
}

/* Make code blocks smaller on mobile */
@media (max-width: 768px) {
  .prose pre {
    font-size: 0.75rem;
  }
  
  .prose code {
    font-size: 0.75rem;
  }
  
  /* Also make CodeExample component font smaller */
  .font-mono {
    font-size: 0.75rem;
  }
}

.aspect-video {
  max-width: 500px;
}

@layer components {
  .prose li p {
    @apply m-0;
  }
}

/* Alerts and form errors used by phx.new */
.alert {
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.alert-info {
  color: #31708f;
  background-color: #d9edf7;
  border-color: #bce8f1;
}

.alert-warning {
  color: #8a6d3b;
  background-color: #fcf8e3;
  border-color: #faebcc;
}

.alert-danger {
  color: #a94442;
  background-color: #f2dede;
  border-color: #ebccd1;
}

.alert p {
  margin-bottom: 0;
}

.alert:empty {
  display: none;
}

.invalid-feedback {
  color: #a94442;
  display: block;
  margin: -1rem 0 2rem;
}

/* LiveView specific classes for your customization */
.phx-no-feedback.invalid-feedback,
.phx-no-feedback .invalid-feedback {
  display: none;
}

.phx-click-loading {
  opacity: 0.5;
  transition: opacity 1s ease-out;
}

.phx-loading {
  cursor: wait;
}

.phx-modal {
  opacity: 1 !important;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

.phx-modal-content {
  background-color: #fefefe;
  margin: 15vh auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
}

.phx-modal-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.phx-modal-close:hover,
.phx-modal-close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}


/* Prevent scrolling beneath Topbar due to URL fragment */
html {
  scroll-padding-top: 8.5rem;
}

@media (min-width: 1280px) {
  html {
    scroll-padding-top: 5rem;
  }
}

html {
  scroll-behavior: smooth;
}

/* Ensure dark-mode is applied to native elements, eg scrollbars */
.dark {
  color-scheme: dark;
}

/* Constrain sidebar container size to screen height - Topbar height - mobile button height*/
.sidebar-container {
  max-height: calc(100vh - 8.5rem);
}

@media (min-width: 1280px) {

  /* Constrain sidebar container size to screen height - Topbar height */
  .sidebar-container {
    max-height: calc(100vh - 5rem);
  }
}

.perspective-grid {
  background-image: repeating-linear-gradient(90deg, rgba(200,50,50,0.2) 0%, rgba(200,50,50,0.2) 1%, transparent 1%, transparent 50%),
                  repeating-linear-gradient(180deg, rgba(200,50,50,0.2) 0%, rgba(200,50,50,0.2) 1%, transparent 1%, transparent 50%);
  background-size: 100px 100px;
  transform: perspective(500px) rotateX(60deg);
  transform-origin: bottom;
}

.perspective-grid-reverse {
  background-image: repeating-linear-gradient(90deg, rgba(200, 50, 50, 0.2) 0%, rgba(200, 50, 50, 0.2) 1%, transparent 1%, transparent 50%),
                    repeating-linear-gradient(180deg, rgba(200, 50, 50, 0.2) 0%, rgba(200, 50, 50, 0.2) 1%, transparent 1%, transparent 50%);
  background-size: 100px 100px;
  transform: perspective(500px) rotateX(-60deg); /* Changed from 60deg to -60deg */
  transform-origin: top; /* Changed from bottom to top */
}

/* Ash Animation Styles */
#typing-cursor {
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

#visualization-panel {
  /* Removed opacity transition to prevent interference with stage transitions */
}

.stage-dot {
  transition: all 0.3s ease;
}

.stage-dot.bg-primary-light-500 {
  box-shadow: 0 0 10px rgba(255, 87, 87, 0.5);
}

/* Code display styling */
#code-display {
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.5;
  overflow-y: hidden;
}

/* Syntax highlighting for Elixir code */
#code-display .keyword { color: #ff79c6; }
#code-display .function { color: #50fa7b; }
#code-display .string { color: #f1fa8c; }
#code-display .atom { color: #8be9fd; }
#code-display .module { color: #bd93f9; }
#code-display .comment { color: #6272a4; }

/* Stage visualization transitions */
.stage-visualization {
  transition: all 0.5s ease-in-out;
}

.stage-summary {
  transition: all 0.3s ease-in-out;
}

.stage-summary .bg-slate-900\/80 {
  background: rgba(15, 23, 42, 0.6);
}

.stage-summary h3 {
  font-size: 0.75rem;
}

.stage-summary .text-sm {
  font-size: 0.6rem;
}

/* Summary grid layout */
#summary-grid {
  transition: all 0.3s ease-in-out;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(71, 85, 105, 0.2);
}

/* Ensure grid columns work properly */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Summary card styling */
.stage-summary {
  min-height: 80px;
  width: 100%;
}

.stage-summary .bg-slate-900\/80 {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Animation container responsive adjustments */
@media (max-width: 1024px) {
  #ash-animation .grid {
    grid-template-columns: 1fr;
  }
  
  #visualization-panel {
    min-height: 300px;
  }
  
  .stage-summary {
    transform: scale(0.9);
  }
  
  #summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    margin-bottom: 0.75rem;
  }
  
  .stage-summary {
    min-height: 70px;
    width: 100%;
  }
}
