/* =========================================================================
   REFLECTION APP STYLES
   Minimalist, Premium, Glassmorphism Aesthetics
   ========================================================================= */

   .reflection-layout {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #0f141a; /* deep premium dark */
    color: #e2e8f0;
    font-family: 'Inter', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .reflection-layout.view-hidden {
    display: none !important;
  }
  
  /* --- Header --- */
  .reflection-header {
    display: flex;
    align-items: center;
    padding: 24px 32px;
    background: rgba(15, 20, 26, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 2px solid rgba(16, 185, 129, 0.3);
    z-index: 10;
  }
  
  .reflection-back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
  }
  
  .reflection-back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }
  
  .reflection-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
  }
  
  /* --- Tabs --- */
  .reflection-tabs {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    gap: 10px;
  }
  
  .ref-tab {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--muted, #94a3b8);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
  }
  
  .ref-tab.active {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 2px 0 0 rgba(16, 185, 129, 0.5);
  }

  .ref-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
  }
  
  /* --- Views --- */
  .reflection-view {
    display: none;
    flex: 1;
    overflow-y: auto;
    position: relative;
  }
  
  .reflection-view.active {
    display: block;
    scroll-behavior: smooth;
  }
  
  /* --- Checkin Container --- */
  .checkin-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 0 24px;
    position: relative;
  }
  
  .checkin-step {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .checkin-step.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
    left: 0;
    right: 0;
  }
  
  .checkin-step h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent, #3b82f6);
    margin-bottom: 12px;
  }
  
  .checkin-step h1 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -1px;
  }
  
  .checkin-step .subtitle {
    color: var(--muted, #94a3b8);
    font-size: 16px;
    margin-bottom: 32px;
  }
  
  /* Inputs */
  .input-modes {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
  }
  
  .input-modes:focus-within {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.03);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.06);
  }
  
  .input-modes textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    line-height: 1.6;
    resize: none;
    min-height: 120px;
    outline: none;
    font-family: inherit;
  }
  
  .input-modes textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
  }
  
  .mic-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(59, 130, 246, 0.2);
    color: #fff;
    border: 1px solid rgba(59, 130, 246, 0.4);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
  }
  
  .mic-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    transform: scale(1.05);
  }
  
  .mic-btn.recording {
    background: rgba(239, 68, 68, 0.8);
    border-color: #ef4444;
    animation: pulseMic 1.5s infinite;
  }
  
  @keyframes pulseMic {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  }
  
  .ref-btn-next {
    background: #fff;
    color: #000;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
  }
  
  .ref-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255,255,255,0.1);
  }
  
  /* --- Patterns View --- */
  .patterns-container {
    display: flex;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 24px;
    gap: 24px;
  }
  
  .patterns-sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  
  .patterns-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .pattern-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
  }
  
  .pattern-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .pattern-card.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
  }
  
  .pattern-card-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
  }
  
  .pattern-card-date {
    font-size: 12px;
    color: var(--muted);
  }
  
  /* Main Right Area */
  .patterns-main {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
  }
  
  .pattern-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }
  
  .pattern-toolbar h2 {
    font-size: 28px;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
  }
  
  .btn-icon {
    background: rgba(255,255,255,0.05);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
  }
  .btn-icon:hover {
    background: rgba(255,255,255,0.15);
  }
  
  .themes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
  }
  
  .theme-pill {
    background: rgba(255,255,255,0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
  }
  
  .mindmap-wrapper {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 24px;
    overflow: hidden;
    min-height: 300px;
    position: relative;
  }
  
  .time-travel-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .time-travel-bar input[type="range"] {
    flex: 1;
    accent-color: #3b82f6;
  }
  
  /* --- Mobile Adjustments --- */
  @media (max-width: 768px) {
    .patterns-container {
      flex-direction: column;
      padding: 0 16px 16px;
      overflow-y: auto;
    }
    
    .patterns-sidebar {
      width: 100%;
      height: 250px;
      flex-shrink: 0;
    }
    
    .patterns-main {
      padding: 20px;
      height: 600px;
      flex-shrink: 0;
    }
    
    .checkin-step h1 {
      font-size: 28px;
    }
  }

/* --- Edit Pattern Modal --- */
.reflection-modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.reflection-modal-content {
  background: #1a1f26;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.reflection-modal-content h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 20px;
  color: #fff;
}

.reflection-modal-content label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 16px;
}

.ref-input, .ref-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
}

.ref-input:focus, .ref-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(255,255,255,0.08);
}

/* --- Past Check-ins --- */
.checkins-history-container {
  max-width: 700px;
  margin: 40px auto;
  padding: 0 24px 40px;
}

.checkins-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkin-history-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s;
}

.checkin-history-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.checkin-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.checkin-history-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #3b82f6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.checkin-history-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.checkin-history-card:hover .checkin-history-actions {
  opacity: 1;
}

.checkin-history-preview {
  font-size: 15px;
  color: #e2e8f0;
  margin-bottom: 10px;
  line-height: 1.5;
}

.checkin-history-answers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkin-answer-pill {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--muted, #94a3b8);
}

/* --- Stale Patterns Notice --- */
.stale-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(234, 179, 8, 0.08);
  border-bottom: 1px solid rgba(234, 179, 8, 0.25);
  color: #fbbf24;
  padding: 10px 24px;
  font-size: 13px;
  gap: 12px;
}

.stale-notice-btn {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #fbbf24;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.stale-notice-btn:hover {
  background: rgba(234, 179, 8, 0.3);
}

/* --- Mobile: show actions always on touch --- */
@media (max-width: 768px) {
  .checkin-history-actions {
    opacity: 1;
  }
}
