/* ==========  COMPONENT UTILITIES  ========== */
/* Reusable classes to replace inline styles throughout the application */

/*
 * NAMING CONVENTION:
 * - Properties use standard CSS names (m = margin, p = padding, w = width)
 * - Directions: t = top, b = bottom, l = left, r = right, x = horizontal, y = vertical
 * - Values use hyphens for decimals: 0-5 = 0.5rem, 1-5 = 1.5rem
 * - Integer values: 0, 1, 2, 3 map directly to rem values
 * 
 * SPACING SCALE:
 * - 0    = 0
 * - 0-5  = 0.5rem  (8px)
 * - 0-75 = 0.75rem (12px)
 * - 1    = 1rem    (16px)
 * - 1-5  = 1.5rem  (24px)
 * - 2    = 2rem    (32px)
 * - 3    = 3rem    (48px)
 * 
 * EXAMPLES:
 * - .mt-1-5  = margin-top: 1.5rem
 * - .px-2    = padding-left and padding-right: 2rem
 * - .mb-0-75 = margin-bottom: 0.75rem
 * - .my-1    = margin-top and margin-bottom: 1rem
 */

/* Additional size variables for common patterns */
:root {
  --form-max-height: 300px;
  --modal-max-height: 1000px;
  --sidebar-min-width: 200px;
  --card-min-width: 300px;
  --prompt-preview-max-height: 100px;
}

/* ==========  LAYOUT CONTAINERS  ========== */
.auth-container {
  max-width: 500px;
  margin: 0 auto;
}

.message-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.content-container-md {
  max-width: 800px;
  margin: 0 auto;
}

.content-container-lg {
  max-width: 900px;
  margin: 0 auto;
}

/* ==========  WIDTH UTILITIES  ========== */
.w-full {
  width: 100%;
}

.max-w-500 {
  max-width: 500px;
}

.max-w-600 {
  max-width: 600px;
}

.max-w-900 {
  max-width: 900px;
}

/* ==========  MARGIN UTILITIES  ========== */
/* Consistent spacing scale: 0, 0.5, 0.75, 1, 1.5, 2, 3 rem */

/* Margin All Sides */
.m-0 {
  margin: 0;
}

/* Margin Horizontal (left and right) */
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Margin Top */
.mt-0 {
  margin-top: 0;
}

.mt-0-5 {
  margin-top: 0.5rem;
}

.mt-0-75 {
  margin-top: 0.75rem;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-1-5 {
  margin-top: 1.5rem;
}

.mt-2 {
  margin-top: 2rem;
}

.mt-3 {
  margin-top: 3rem;
}

/* Margin Bottom */
.mb-0 {
  margin-bottom: 0;
}

.mb-0-5 {
  margin-bottom: 0.5rem;
}

.mb-0-75 {
  margin-bottom: 0.75rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-1-5 {
  margin-bottom: 1.5rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.mb-3 {
  margin-bottom: 3rem;
}

/* Margin Left */
.ml-0-5 {
  margin-left: 0.5rem;
}

.ml-1 {
  margin-left: 1rem;
}

/* Margin Right */
.mr-1 {
  margin-right: 1rem;
}

/* Margin Vertical (top and bottom) */
.my-0 {
  margin-top: 0;
  margin-bottom: 0;
}

.my-1 {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.my-1-5 {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.my-2 {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.my-3 {
  margin-top: 3rem;
  margin-bottom: 3rem;
}

/* ==========  PADDING UTILITIES  ========== */
/* Consistent spacing scale: 0.5, 1, 1.5, 2, 3 rem */

/* Padding All Sides */
.p-1 {
  padding: 1rem;
}

.p-1-5 {
  padding: 1.5rem;
}

.p-2 {
  padding: 2rem;
}

/* Padding Vertical (top and bottom) */
.py-1 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.py-1-5 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.py-2 {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.py-3 {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

/* Padding Horizontal (left and right) */
.px-1 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.px-1-5 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.px-2 {
  padding-left: 2rem;
  padding-right: 2rem;
}

/* ==========  TEXT UTILITIES  ========== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

/* ==========  FLEX UTILITIES  ========== */
.flex {
  display: flex;
}

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

.flex-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-0-5 {
  gap: 0.5rem;
}

.gap-1 {
  gap: 1rem;
}

/* ==========  AUTH PAGE COMPONENTS  ========== */
.auth-title {
  margin-bottom: 1.5rem;
}

.auth-link {
  font-size: 0.9rem;
  color: var(--color-primary);
}

.auth-footer-text {
  margin-top: 1rem;
  text-align: center;
}

.password-hint {
  color: var(--color-muted-dark);
}

/* ==========  MESSAGE PAGE COMPONENTS  ========== */
.message-icon {
  font-size: 48px;
  margin-bottom: 1rem;
}

.message-title {
  margin-bottom: 1rem;
}

.message-content {
  margin: 2rem 0;
}

.message-actions {
  margin: 2rem 0;
}

.info-box {
  background: var(--color-bg-light);
  padding: 1.5rem;
  border-radius: 4px;
  margin: 2rem 0;
}

.info-box-muted {
  color: var(--color-muted-dark);
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ==========  BUTTON ENHANCEMENTS  ========== */
.btn-min-width {
  min-width: 200px;
}

/* ==========  LINK STYLES  ========== */
.link-small {
  font-size: 0.9rem;
}

.link-muted {
  color: var(--color-text-light);
}

/* ==========  FORM ENHANCEMENTS  ========== */
.form-hint {
  display: block;
  margin-top: 0.5rem;
  color: var(--color-muted-dark);
  font-size: 0.9rem;
}

/* ==========  PREMIUM PAGE COMPONENTS  ========== */
.premium-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.tier-card {
  padding: 2rem;
  border-radius: 8px;
  border: 2px solid;
}

.tier-card-free {
  background: var(--color-bg-light);
  border-color: var(--color-border);
}

.tier-card-premium {
  background: #fff3cd;
  border-color: var(--color-warning);
}

.tier-card h3 {
  margin-bottom: 1rem;
}

.tier-list {
  list-style: none;
  padding: 0;
}

.tier-list li {
  padding: 0.5rem 0;
}

.tier-list-unavailable {
  color: var(--color-danger);
}

.premium-cta {
  text-align: center;
  padding: 2rem;
  background: var(--color-bg-light);
  border-radius: 8px;
}

.premium-cta-text {
  margin-bottom: 1rem;
  color: var(--color-text-light);
}

.btn-large {
  font-size: 1.125rem;
  padding: 0.75rem 2rem;
}

@media (max-width: 768px) {
  .premium-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========  ERROR PAGE COMPONENTS  ========== */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem 1rem;
}

.error-icon {
  font-size: 6rem;
  margin-bottom: 1rem;
}

.error-icon-blue {
  color: var(--color-primary);
  animation: float 3s ease-in-out infinite;
}

.error-icon-warning {
  color: var(--color-warning);
  animation: pulse 2s ease-in-out infinite;
}

.error-icon-danger {
  color: var(--color-danger);
  animation: shake 0.5s ease-in-out;
}

.error-icon-danger-blink {
  color: var(--color-danger);
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

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

.error-code {
  font-size: 8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.error-code-blue {
  color: var(--color-primary);
  background: linear-gradient(90deg, var(--color-primary), #d85c28);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-background-clip: text;
  -moz-text-fill-color: transparent;
  background-clip: text;
}

.error-code-warning {
  color: var(--color-warning);
  background: linear-gradient(90deg, var(--color-warning), #e67e22);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-background-clip: text;
  -moz-text-fill-color: transparent;
  background-clip: text;
}

.error-code-danger {
  color: var(--color-danger);
  background: linear-gradient(90deg, var(--color-danger), var(--color-danger-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-background-clip: text;
  -moz-text-fill-color: transparent;
  background-clip: text;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .error-code-blue { color: var(--color-primary); }
  .error-code-warning { color: var(--color-warning); }
  .error-code-danger { color: var(--color-danger); }
  .error-code-blue,
  .error-code-warning,
  .error-code-danger {
    -webkit-text-fill-color: inherit;
    -moz-text-fill-color: inherit;
  }
}

.error-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
}

.error-message {
  font-size: 1.25rem;
  color: var(--color-text-light);
  margin-bottom: 2rem;
  max-width: 600px;
}

.error-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.error-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
  text-decoration: none;
  border-radius: 50px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.error-btn-primary {
  background-color: #d85c28;
  color: white;
}

.error-btn-primary:hover {
  background-color: #c04d20;
  transform: translateY(-2px);
}

.error-btn-secondary {
  background-color: var(--color-primary);
  color: white;
}

.error-btn-secondary:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-2px);
}

.error-btn i {
  font-size: 1.2em;
}

/* ==========  RESPONSIVE ADJUSTMENTS  ========== */
@media (max-width: 768px) {
  .auth-container,
  .message-container,
  .content-container-md,
  .content-container-lg {
    padding: 0 1rem;
  }
  
  .error-code {
    font-size: 5rem;
  }
  
  .error-title {
    font-size: 1.5rem;
  }
  
  .error-message {
    font-size: 1rem;
  }
  
  .error-actions {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
  }
  
  .error-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .error-icon-blue,
  .error-icon-warning,
  .error-icon-danger,
  .error-icon-danger-blink {
    animation: none;
  }
}
