/* ========================================== */
/* ROOT VARIABLES                             */
/* ========================================== */
:root {
  --bg-main: #0f1115;
  --bg-panel: #161920;
  --bg-card: #1f2430;
  --accent: #2f6fed;
  --text-main: #e6e8ee;
  --text-muted: #8b94a7;
  --border: #2d3446;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
}

/* ========================================== */
/* BASE RESET & BODY                          */
/* ========================================== */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

/* ========================================== */
/* HEADER NAVIGATION                          */
/* ========================================== */
.trg-nav-wrapper {
  background: #0f1115;
  border-bottom: 1px solid #2d3446;
  font-family: inherit;
  position: relative;
  z-index: 1000;
}

.trg-nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 20px;
  flex-wrap: wrap;
}

.trg-logo {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.trg-menu {
  display: flex;
  gap: 24px;
  align-items: center;
}

.trg-dropdown {
  position: relative;
}

.trg-dropbtn {
  background: transparent;
  border: none;
  color: #8b94a7;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
  font-family: inherit;
}

.trg-dropbtn:hover {
  color: #ffffff;
}

.trg-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #161920;
  border: 1px solid #2d3446;
  border-radius: 6px;
  min-width: 280px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 9999;
  padding: 8px 0;
}

.trg-dropdown:hover .trg-dropdown-content {
  display: block;
}

.trg-dropdown-content a {
  display: block;
  padding: 10px 16px;
  color: #a3adc2;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.2s, color 0.2s;
}

.trg-dropdown-content a:hover {
  background: #20242e;
  color: #ffffff;
}

.trg-caret {
  font-size: 0.7rem;
}

/* ========================================== */
/* BUILDER CONTAINER                          */
/* ========================================== */
.builder-container {
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  height: 85vh;
  min-height: 700px;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 1200px;
  margin: 0 auto;
}

/* ========================================== */
/* PANELS                                     */
/* ========================================== */
.panel {
  background: var(--bg-panel);
  padding: 1.25rem;
  overflow-y: auto;
}

.panel h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.panel h3:first-child {
  margin-top: 0;
}

.panel label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.5rem;
}

.panel textarea,
.panel input,
.panel select {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s;
  margin-top: 0.25rem;
}

.panel textarea:focus,
.panel input:focus,
.panel select:focus {
  outline: none;
  border-color: var(--accent);
}

.panel textarea {
  resize: vertical;
  min-height: 40px;
}

/* ========================================== */
/* TIMELINE AREA                              */
/* ========================================== */
.timeline-area {
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.timeline-area h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.timeline-strip {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  flex: 1;
  align-items: flex-start;
  scroll-snap-type: x mandatory;
}

/* ========================================== */
/* SHOT CARDS                                 */
/* ========================================== */
.shot-card {
  flex: 0 0 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  scroll-snap-align: start;
  transition: border-color 0.2s;
}

.shot-card:hover {
  border-color: var(--accent);
}

.shot-card h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.shot-card label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: block;
  margin-top: 0.5rem;
}

.shot-card select,
.shot-card input,
.shot-card textarea {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: inherit;
  margin-top: 0.2rem;
}

.shot-card textarea {
  resize: vertical;
  min-height: 40px;
}

.shot-card .remove-shot {
  background: transparent;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 1.2rem;
  float: right;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.shot-card .remove-shot:hover {
  opacity: 1;
}

/* ========================================== */
/* ADD SHOT BUTTON                            */
/* ========================================== */
.add-shot-btn {
  flex: 0 0 160px;
  min-height: 220px;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
}

.add-shot-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
  background: rgba(47, 111, 237, 0.05);
}

/* ========================================== */
/* PROMPT PREVIEW                             */
/* ========================================== */
#prompt-preview {
  width: 100%;
  min-height: 120px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #a7f3d0;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  resize: vertical;
  line-height: 1.6;
}

/* ========================================== */
/* BUTTONS                                    */
/* ========================================== */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  width: 100%;
  margin-top: 0.75rem;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1a5adf;
}

/* QUICK ADD BUTTONS */
.preset-btn {
  background: rgba(47, 111, 237, 0.1); 
  border: 1px solid rgba(47, 111, 237, 0.4);
  color: #a7c0f3; 
  padding: 4px 10px; 
  border-radius: 12px; 
  font-size: 0.75rem;
  cursor: pointer; 
  white-space: nowrap; 
  transition: background 0.2s;
}

.preset-btn:hover { 
  background: rgba(47, 111, 237, 0.25); 
}

/* ========================================== */
/* LINTER OUTPUT                              */
/* ========================================== */
#linter-output {
  margin-top: 0.5rem;
  min-height: 60px;
}

.diag-item {
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.diag-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-left: 3px solid var(--success);
}

.diag-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border-left: 3px solid var(--warning);
}

.diag-caution {
  background: rgba(245, 158, 11, 0.05);
  color: #fbbf24;
  border-left: 3px solid var(--warning);
}

.diag-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-left: 3px solid var(--error);
}

/* ========================================== */
/* SCROLLBAR STYLING                          */
/* ========================================== */
.timeline-strip::-webkit-scrollbar {
  height: 6px;
}

.timeline-strip::-webkit-scrollbar-track {
  background: var(--bg-main);
}

.timeline-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.timeline-strip::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================== */
/* MODAL STYLES                               */
/* ========================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 420px;
  padding: 30px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: modalSlideIn 0.3s ease;
}

/* For larger modals like projects dashboard */
.modal-content.large {
  max-width: 800px;
}

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

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.close-modal:hover {
  color: #fff;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.auth-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 10px;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
}

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.auth-tab:hover {
  color: #fff;
}

/* ========================================== */
/* TOAST NOTIFICATIONS                        */
/* ========================================== */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease;
  max-width: 400px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

.toast.info {
  border-left: 4px solid var(--accent);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========================================== */
/* PROJECT CARDS IN DASHBOARD                 */
/* ========================================== */
.project-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.project-card:hover {
  border-color: var(--accent);
  background: #1a1f2e;
}

.project-card-title {
  color: #fff;
  font-weight: 600;
  margin-bottom: 4px;
}

.project-card-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.project-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.project-card-actions button {
  padding: 4px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.2s;
}

.project-card-actions button:hover {
  border-color: var(--accent);
  color: #fff;
}

/* ========================================== */
/* FOOTER STYLES                              */
/* ========================================== */
.trg-footer-wrapper {
  background: #0f1115;
  border-top: 1px solid #2d3446;
  padding: 60px 20px 20px;
  font-family: inherit;
  margin-top: 40px;
}

.trg-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  margin-bottom: 40px;
}

.trg-footer-col h4 {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 20px;
  margin-top: 0;
}

.trg-footer-col a {
  display: block;
  color: #8b94a7;
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 12px;
  transition: color 0.2s;
}

.trg-footer-col a:hover {
  color: #ffffff;
}

.trg-footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid #2d3446;
  max-width: 1200px;
  margin: 0 auto;
  color: #8b94a7;
  font-size: 0.8rem;
}

.trg-footer-bottom a {
  color: #2f6fed;
  text-decoration: none;
  transition: color 0.2s;
}

.trg-footer-bottom a:hover {
  color: #5c93f9;
}

/* ========================================== */
/* USER INDICATOR                             */
/* ========================================== */
#user-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  color: var(--success);
  font-size: 0.75rem;
  background: var(--bg-panel);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  z-index: 100;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}

#user-indicator a {
  color: var(--error);
  text-decoration: none;
  margin-left: 4px;
}

#user-indicator a:hover {
  text-decoration: underline;
}

/* ========================================== */
/* RESPONSIVE                                 */
/* ========================================== */
@media (max-width: 1100px) {
  .builder-container {
    grid-template-columns: 1fr;
    height: auto;
    gap: 1px;
    min-height: auto;
  }

  .panel {
    max-height: 300px;
  }

  .timeline-area {
    min-height: 400px;
  }

  .timeline-strip {
    flex-wrap: nowrap;
  }

  .shot-card {
    flex: 0 0 260px;
  }
}

@media (max-width: 960px) {
  .trg-menu {
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 15px;
  }
  
  .trg-nav-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .trg-dropdown-content {
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(255,255,255,0.02);
    border-left: 2px solid #2d3446;
    border-radius: 0;
    margin-top: 8px;
    padding-left: 10px;
    min-width: 100%;
  }
}

@media (max-width: 600px) {
  .shot-card {
    flex: 0 0 220px;
    padding: 0.75rem;
  }

  .add-shot-btn {
    flex: 0 0 120px;
    min-height: 180px;
  }

  .panel {
    padding: 0.75rem;
  }

  .modal-content {
    padding: 20px;
    margin: 10px;
  }

  #user-indicator {
    top: 10px;
    right: 10px;
    font-size: 0.65rem;
    padding: 4px 10px;
  }
}