/* ==========================================================================
   SPARKPROMPT AI • APPLE DARK MODE STYLING
   ========================================================================== */

:root {
  --bg: #000000;
  --bg-secondary: #0c0c0e;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-hover: rgba(255, 255, 255, 0.2);
  
  --text-primary: #ffffff;
  --text-secondary: #94949b;
  --text-tertiary: #6e6e73;
  
  --apple-blue: #2997ff;
  --apple-blue-hover: #0077ed;
  --apple-green: #30d158;
  --apple-purple: #bf5af2;
  --apple-orange: #ff9f0a;

  --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', Menlo, Monaco, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-system);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(41, 151, 255, 0.2), rgba(191, 90, 242, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-title span {
  color: var(--text-secondary);
  font-weight: 400;
}

/* CONTAINER */
.app-container {
  max-width: 1560px;
  width: 94%;
  margin: 0 auto;
  padding: 2rem 1rem 5rem;
  flex: 1;
  position: relative;
  z-index: 10;
}

/* TOP CONTROLS & FILTER BAR */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-segmented {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
}

.filter-segment-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 7px 16px;
  border-radius: 8px;
  font-family: var(--font-system);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-segment-btn:hover { color: #ffffff; }
.filter-segment-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.search-field {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 9px 16px;
  color: #ffffff;
  font-family: var(--font-system);
  font-size: 0.85rem;
  width: 280px;
  outline: none;
  transition: all 0.2s;
}

.search-field:focus {
  border-color: var(--apple-blue);
  background: rgba(255, 255, 255, 0.08);
}

/* BUTTONS */
.btn-apple-primary {
  background: #ffffff;
  color: #000000;
  padding: 9px 18px;
  border-radius: 980px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-apple-primary:hover {
  background: #f0f0f2;
  transform: scale(1.03);
}

.btn-apple-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 980px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--surface-border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-apple-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-apple-accent {
  background: linear-gradient(135deg, #2997ff, #0071e3);
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 980px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(41, 151, 255, 0.3);
}

.btn-apple-accent:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(41, 151, 255, 0.45);
}

/* NOTES GRID */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 22px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
}

.note-card:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.85rem;
  gap: 10px;
}

.card-del-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.card-del-btn:hover {
  background: rgba(255, 69, 58, 0.2);
  border-color: rgba(255, 69, 58, 0.5);
  color: #ff453a;
  transform: scale(1.1);
}

.note-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.25;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 980px;
  border: 1px solid var(--surface-border);
}

.status-idea { background: rgba(255, 159, 10, 0.12); color: var(--apple-orange); border-color: rgba(255, 159, 10, 0.3); }
.status-in_progress { background: rgba(41, 151, 255, 0.12); color: var(--apple-blue); border-color: rgba(41, 151, 255, 0.3); }
.status-favorite { background: rgba(255, 214, 10, 0.12); color: #ffd60a; border-color: rgba(255, 214, 10, 0.3); }
.status-completed { background: rgba(48, 209, 88, 0.12); color: var(--apple-green); border-color: rgba(48, 209, 88, 0.3); }

.note-content-preview {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 1.25rem;
}

.note-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 1rem;
}

.prompt-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--apple-purple);
  font-weight: 500;
}

/* MODAL OVERLAYS */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1.5rem;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: rgba(24, 24, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  padding: 2.25rem;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  animation: applePop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

@keyframes applePop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #ffffff;
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* FORM FIELDS */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 12px 16px;
  color: #ffffff;
  font-family: var(--font-system);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--apple-blue);
  background: rgba(255, 255, 255, 0.08);
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
}

/* PROMPT STUDIO TABS */
.prompt-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.prompt-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--font-system);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.prompt-tab-btn:hover { color: #ffffff; }
.prompt-tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
}

.prompt-output-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 1.5rem;
  min-height: 220px;
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.6;
  color: #e5e5ea;
  white-space: pre-wrap;
  position: relative;
  margin-bottom: 1.25rem;
}

.copy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 22px;
  border-radius: 980px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 999999;
  display: none;
  animation: toastPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastPop {
  0% { transform: translate(-50%, 15px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}
