/**
 * Unity AI Lab — Apps Shared Theme (gothic redesign chrome)
 * Creators: Hackall360, Sponge, GFourteen, Alfreddo, Red
 * https://www.unityailab.com
 * unityailabcontact@gmail.com
 * Version: v2.1.6
 *
 * Slim utility layer for the 8 app demos. The heavy lifting lives in:
 *   • redesign/shared-tokens.css — palette, fonts, font-faces (single source)
 *   • redesign/variations.css    — `.vD-nav-*` styles (matches GothicNavbar)
 * Both are auto-loaded by apps/shared-nav.js, so per-app HTML stays lean.
 *
 * What this file DOES:
 *   • Background ambience (.unity-background-overlay + .unity-red-streaks)
 *   • Scrollbar + selection theming
 *   • Body padding for the fixed gothic navbar
 *   • Legacy .unity-* utility classes still referenced by app pages
 *     (.unity-btn, .unity-card, .unity-panel, .unity-input, .unity-select,
 *      .unity-textarea, .unity-chat-container, .unity-message-*, .app-* etc.)
 *
 * What this file NO LONGER does (moved upstream):
 *   • :root token declarations           → redesign/shared-tokens.css
 *   • @font-face Trajan Pro                → redesign/shared-tokens.css
 *   • #unity-nav-wrapper Bootstrap navbar  → redesign/variations.css `.vD-nav-*`
 *   • Navbar scroll-state JS               → apps/shared-nav.js
 */

/* App-only token extension — gradient not present in shared-tokens.css. */
:root {
  --gradient-dark: linear-gradient(135deg, #000000 0%, #1a1a1a 50%, #0a0a0a 100%);
}

/* ===================================
   Background Ambience
   =================================== */
.unity-background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    rgba(26, 26, 26, 0.8) 0%,
    rgba(10, 10, 10, 1) 100%
  );
  z-index: -2;
  pointer-events: none;
}

.unity-red-streaks {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(
      90deg,
      transparent 0%,
      transparent 48%,
      rgba(220, 20, 60, 0.03) 50%,
      transparent 52%,
      transparent 100%
    ),
    linear-gradient(
      180deg,
      transparent 0%,
      transparent 48%,
      rgba(220, 20, 60, 0.02) 50%,
      transparent 52%,
      transparent 100%
    );
  background-size: 80px 80px;
  z-index: -1;
  animation: streaksMove 20s linear infinite;
  pointer-events: none;
}

@keyframes streaksMove {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 80px 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .unity-red-streaks {
    animation: none;
  }
}

/* ===================================
   Body padding for fixed gothic navbar
   (mirrors `.vD-page` from variations.css)
   =================================== */
body.unity-nav-active {
  padding-top: 70px;
}

@media (max-width: 1024px) {
  body.unity-nav-active {
    padding-top: 62px;
  }
}

/* Utility class shared-nav.js uses to suppress per-app legacy home links. */
.unity-hidden-home {
  display: none !important;
}

/* ===================================
   Scrollbar + Selection
   =================================== */
::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: var(--primary-black);
}
::-webkit-scrollbar-thumb {
  background: var(--gradient-red);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--crimson-red);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--crimson-red) var(--primary-black);
}

::selection {
  background: var(--crimson-red);
  color: var(--white);
}
::-moz-selection {
  background: var(--crimson-red);
  color: var(--white);
}

/* ===================================
   App Shell — content container chrome
   =================================== */
.app-container {
  max-width: 1400px;
  margin: 80px auto 40px;
  padding: 30px;
  background: rgba(26, 26, 26, 0.9);
  border-radius: 4px;
  border: 1px solid rgba(220, 20, 60, 0.2);
  box-shadow: 0 10px 30px rgba(220, 20, 60, 0.2);
}

.app-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(220, 20, 60, 0.2);
}

.app-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 0 20px rgba(220, 20, 60, 0.5);
  letter-spacing: 3px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.app-subtitle {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--bone);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ===================================
   Gothic Buttons
   =================================== */
.unity-btn {
  padding: 12px 30px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 1px solid var(--crimson-red);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(220, 20, 60, 0.2);
}

.unity-btn-primary {
  background: var(--gradient-red);
  color: var(--white);
  border-color: var(--crimson-red);
}

.unity-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(220, 20, 60, 0.4);
  border-color: var(--accent-red);
}

.unity-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(220, 20, 60, 0.3);
}

.unity-btn-primary:disabled {
  background: var(--dark-grey);
  border-color: var(--mid-grey);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

.unity-btn-secondary {
  background: transparent;
  color: var(--bone);
  border-color: var(--crimson-red);
}

.unity-btn-secondary:hover {
  background: rgba(220, 20, 60, 0.1);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(220, 20, 60, 0.3);
}

/* ===================================
   Form Elements
   =================================== */
.unity-input,
.unity-select,
.unity-textarea {
  width: 100%;
  padding: 12px 15px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: rgba(26, 26, 26, 0.8);
  color: var(--bone);
  border: 1px solid rgba(220, 20, 60, 0.3);
  border-radius: 2px;
  transition: all 0.3s ease;
  outline: none;
}

.unity-input:focus,
.unity-select:focus,
.unity-textarea:focus {
  background: rgba(26, 26, 26, 1);
  border-color: var(--crimson-red);
  box-shadow: 0 0 20px rgba(220, 20, 60, 0.3);
}

.unity-input::placeholder,
.unity-textarea::placeholder {
  color: rgba(232, 226, 212, 0.45);
  font-style: italic;
}

.unity-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23dc143c'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 1.2em;
  padding-right: 40px;
  cursor: pointer;
}

.unity-select:hover {
  border-color: var(--crimson-red);
}

/* ===================================
   Cards + Panels
   =================================== */
.unity-card {
  background: rgba(42, 42, 42, 0.6);
  padding: 25px;
  border-radius: 4px;
  border: 1px solid rgba(220, 20, 60, 0.2);
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.unity-card:hover {
  border-color: var(--crimson-red);
  box-shadow: 0 8px 25px rgba(220, 20, 60, 0.2);
  transform: translateY(-3px);
}

.unity-card-header {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(220, 20, 60, 0.2);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.unity-card-body {
  color: var(--light-grey);
  line-height: 1.6;
}

.unity-panel {
  background: rgba(21, 21, 21, 0.9);
  padding: 20px;
  border-radius: 4px;
  border: 1px solid rgba(220, 20, 60, 0.2);
  margin-bottom: 20px;
}

.unity-panel-header {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--crimson-red);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

/* ===================================
   Chat / Message Components
   =================================== */
.unity-chat-container {
  background: rgba(21, 21, 21, 0.8);
  border: 1px solid rgba(220, 20, 60, 0.2);
  border-radius: 4px;
  padding: 20px;
  height: 500px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.unity-message {
  margin-bottom: 15px;
  padding: 12px 15px;
  border-radius: 2px;
  line-height: 1.6;
}

.unity-message-user {
  background: rgba(220, 20, 60, 0.1);
  border-left: 3px solid var(--crimson-red);
  color: var(--white);
}

.unity-message-ai {
  background: rgba(42, 42, 42, 0.6);
  border-left: 3px solid var(--bone);
  color: var(--light-grey);
}

/* ===================================
   Misc utilities
   =================================== */
.unity-media-container {
  width: 100%;
  background: rgba(21, 21, 21, 0.8);
  border: 1px solid rgba(220, 20, 60, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}
.unity-media-container img {
  width: 100%;
  height: auto;
  display: block;
}

.unity-control-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.unity-control-group > * {
  flex: 1;
  min-width: 200px;
}

.unity-text-primary {
  color: var(--crimson-red);
}
.unity-text-secondary {
  color: var(--light-grey);
}
.unity-text-white {
  color: var(--white);
}
.unity-text-center {
  text-align: center;
}

.unity-mt-1 {
  margin-top: 10px;
}
.unity-mt-2 {
  margin-top: 20px;
}
.unity-mt-3 {
  margin-top: 30px;
}
.unity-mb-1 {
  margin-bottom: 10px;
}
.unity-mb-2 {
  margin-bottom: 20px;
}
.unity-mb-3 {
  margin-bottom: 30px;
}
.unity-p-1 {
  padding: 10px;
}
.unity-p-2 {
  padding: 20px;
}
.unity-p-3 {
  padding: 30px;
}

.unity-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(220, 20, 60, 0.3);
  border-top-color: var(--crimson-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
  .app-container {
    margin: 70px 15px 20px;
    padding: 20px;
  }
  .app-title {
    font-size: 1.8rem;
    letter-spacing: 2px;
  }
  .app-subtitle {
    font-size: 0.8rem;
  }
  .unity-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
  }
  .unity-control-group {
    flex-direction: column;
  }
  .unity-control-group > * {
    min-width: 100%;
  }
  .unity-chat-container {
    height: 400px;
  }
}
