/* ==========================================================================
   PRODIGY SOFTWARE - COMPONENTS & INTERACTIVE UI
   ========================================================================== */

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.925rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--grad-primary);
  color: #050811;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-bright);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.btn-outline-cyan {
  background: transparent;
  color: var(--accent-cyan);
  border-color: rgba(0, 242, 254, 0.4);
}

.btn-outline-cyan:hover {
  background: rgba(0, 242, 254, 0.1);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.825rem;
}

.btn-lg {
  padding: 0.85rem 1.65rem;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Download Split Button / Dropdown */
.download-group {
  position: relative;
  display: inline-flex;
}

.download-split-btn {
  display: flex;
  align-items: center;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
}

.download-main-btn {
  background: var(--grad-primary);
  color: #050811;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  transition: filter var(--transition-fast);
}

.download-main-btn:hover {
  filter: brightness(1.1);
}

.download-toggle-btn {
  background: #00c9d6;
  color: #050811;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0.75rem 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  max-width: 90vw;
  background: #0d1220;
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 0.65rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.95), 0 0 25px rgba(0, 242, 254, 0.25);
  z-index: 1000;
  display: none;
  animation: fadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.download-group.open .download-dropdown-menu {
  display: block;
}

.download-group.open {
  z-index: 1000;
}

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

.download-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  transition: all var(--transition-fast);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.download-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-bright);
}

.download-option * {
  pointer-events: none;
}

.download-option-icon {
  width: 34px;
  height: 34px;
  background: rgba(0, 242, 254, 0.1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.download-option-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-bright);
}

.download-option-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   APPLICATION CARD
   -------------------------------------------------------------------------- */

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 1.75rem;
  position: relative;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  overflow: visible; /* Prevents dropdown menu from being cut off by card boundary */
}

.app-card.has-open-dropdown,
.app-card:has(.download-group.open) {
  z-index: 100;
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--grad-primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.app-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(0, 242, 254, 0.12);
}

.app-card:hover::before {
  opacity: 1;
}

.app-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.app-card-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--border-radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  object-fit: contain;
}

.app-card-title-wrap {
  flex: 1;
}

.app-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.25rem;
}

.app-card-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: var(--border-radius-pill);
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.app-card-tagline {
  color: var(--text-muted);
  font-size: 0.925rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  flex-grow: 0;
}

/* Feature Bullets inside Card */
.app-card-features {
  list-style: none;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.app-card-feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.app-card-feature-icon {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

/* Card Specs Chips */
.app-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  flex-wrap: wrap;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-chip span {
  color: var(--text-muted);
}

/* Card Footer Actions */
.app-card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-card-actions .btn {
  flex: 1;
}

/* --------------------------------------------------------------------------
   MODAL DIALOG (APP DETAILS & ADMIN FORMS)
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-xl);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.7);
  transform: scale(0.95) translateY(20px);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.modal-backdrop.active .modal-window {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #0d121f;
  flex-shrink: 0; /* Prevents header from being crushed or cut off */
  position: relative;
  z-index: 20;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.modal-app-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  padding: 4px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-bright);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-left: 1rem;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-bright);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 2rem;
  background: #090e1a;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0; /* Ensures tab menu is never cut or compressed */
  overflow-x: auto;
  scrollbar-width: none; /* Hide default thick scrollbar */
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 15;
}

.modal-tabs::-webkit-scrollbar {
  display: none;
}

.modal-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-pill);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1;
}

.modal-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-bright);
  border-color: var(--border-medium);
}

.modal-tab-btn.active {
  background: var(--grad-primary);
  color: #050811;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.35);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Details Overview */
.modal-desc-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-main);
}

/* Feature Highlights Grid - Stretched to Equal Heights & Full Column Widths */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  align-items: stretch;
  width: 100%;
}

.feature-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.feature-box:hover {
  border-color: rgba(0, 242, 254, 0.35);
  background: rgba(255, 255, 255, 0.035);
  transform: translateY(-2px);
}

.feature-box-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}

.feature-box-title svg {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.feature-box-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1; /* Stretch to fill available vertical space */
}

/* Specifications Table */
.specs-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.specs-table tr {
  border-bottom: 1px solid var(--border-subtle);
}

.specs-table tr:last-child {
  border-bottom: none;
}

.specs-table td {
  padding: 0.85rem 1.25rem;
  font-size: 0.925rem;
}

.specs-table td:first-child {
  font-weight: 600;
  color: var(--text-dim);
  width: 35%;
  background: rgba(255, 255, 255, 0.02);
}

.specs-table td:last-child {
  color: var(--text-bright);
  font-family: var(--font-mono);
}

/* Screenshot Lightbox & Carousel */
.screenshots-gallery {
  margin-bottom: 2rem;
}

.gallery-main-view {
  width: 100%;
  height: 380px;
  background: #000;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.gallery-main-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  color: #fff;
  padding: 1.25rem 1.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.gallery-thumbnails {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.gallery-thumb {
  width: 80px;
  height: 55px;
  border-radius: 6px;
  border: 2px solid var(--border-subtle);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.6;
  transition: all var(--transition-fast);
}

.gallery-thumb:hover {
  opacity: 0.9;
  border-color: var(--text-muted);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   INTERACTIVE SIMULATORS (SDM MATRIX & BASKET WIDGET)
   -------------------------------------------------------------------------- */

.simulator-card {
  background: #050812;
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.simulator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.sim-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
}

.sim-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* SDM Dynamic Matrix Simulator */
.sdm-sim-matrix {
  background: #0a1120;
  border: 2px solid #1e3a8a;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 1rem;
}

.sdm-matrix-grid {
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  gap: 3px;
  height: 48px;
  background: #060b14;
  padding: 4px;
  border-radius: 4px;
  border: 1px solid #1e293b;
}

.sdm-chunk-block {
  border-radius: 2px;
  background: #ffffff;
  transition: background-color 0.2s ease;
}

.sdm-chunk-block.active {
  background: #00f2fe;
  box-shadow: 0 0 8px #00f2fe;
  animation: pulseBlock 0.8s infinite alternate;
}

.sdm-chunk-block.completed {
  background: #2563eb;
  border: 1px solid #60a5fa;
}

@keyframes pulseBlock {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

.sdm-sim-telemetry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem 1rem;
  border-radius: 6px;
}

/* BasketCopier Simulator */
.basket-sim-stage {
  min-height: 220px;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.08) 0%, transparent 70%), #070c18;
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2rem;
  transition: all var(--transition-fast);
}

.basket-sim-stage.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.05);
}

.basket-floating-widget {
  width: 140px;
  height: 140px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.basket-floating-widget.bounce {
  animation: basketBounce 0.5s ease;
}

@keyframes basketBounce {
  0% { transform: scale(1) translateY(0); }
  40% { transform: scale(1.15) translateY(-18px); }
  70% { transform: scale(0.95) translateY(4px); }
  100% { transform: scale(1) translateY(0); }
}

.basket-img-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.6));
}

.basket-count-bubble {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #ef4444;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6);
  border: 2px solid #000;
}

.basket-size-pill {
  position: absolute;
  bottom: 12px;
  background: #5c3a21;
  border: 1px solid #92542a;
  color: #fed7aa;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--border-radius-pill);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  font-family: var(--font-sans);
}

.basket-drop-instruction {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1.25rem;
  color: var(--text-bright);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
}

.toast.toast-success svg {
  color: var(--accent-emerald);
}

.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.5);
}

.toast.toast-error svg {
  color: var(--accent-rose);
}
