/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1a1a1a 0, #050505 55%, #000 100%);
  color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* App shell */
.app-shell {
  position: relative;
  width: 100%;
  max-width: 1100px;
  padding: 24px;
  display: flex;
  flex-direction: row;
}

/* ========================================= */
/* HISTORY PANEL */
/* ========================================= */
.history-toggle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 60px;
  border-radius: 0 999px 999px 0;
  border: none;
  background: linear-gradient(135deg, #ff7a1a, #ff3b1a);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255, 80, 0, 0.7);
  z-index: 30;
}

.history-panel {
  position: fixed;
  left: -320px; /* gömd */
  top: 0;
  bottom: 0;
  width: 240px;
  background: rgba(5, 5, 5, 0.96);
  border-right: 1px solid rgba(255, 120, 40, 0.3);
  border-radius: 0 12px 12px 0;
  padding: 12px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.9);
  transition: left 0.25s ease;
  overflow-y: auto;
  z-index: 20;
}

.history-panel.open {
  left: 0; /* synlig */
}

.history-panel h2 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e0e0e0;
}

#history-list {
  font-size: 0.8rem;
}

.history-item {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #222;
}

.history-item-question {
  color: #ffddaa;
  margin-bottom: 4px;
}

.history-item-answer {
  color: #cccccc;
}

/* ========================================= */
/* MAIN PANEL */
/* ========================================= */
.main-panel {
  flex: 1;
  margin-left: 40px;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.eye-wrapper {
  width: 160px;
  height: 160px;
  margin: 0 auto 12px auto;
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(255, 80, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #3b1a0a 0, #120604 60%, #000 100%);
}

#sauron-eye {
  width: 130px;
  height: 130px;
  transition: transform 0.3s ease, filter 0.3s ease;
}

/* Scanning animation */
#sauron-eye.scanning {
  animation: scanPulse 1.1s infinite;
  filter: drop-shadow(0 0 18px rgba(255, 120, 40, 0.9));
}

@keyframes scanPulse {
  0% { transform: scale(1.0); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1.0); }
}

.title {
  font-size: 2.2rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fefefe;
}

.subtitle {
  margin-top: 4px;
  font-size: 0.9rem;
  color: #b0b0b0;
}

/* Ask section */
.ask-section {
  background: rgba(10, 10, 10, 0.9);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 120, 40, 0.18);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.8);
  margin-bottom: 16px;
}

.ask-section textarea {
  width: 100%;
  min-height: 120px;
  background: #050505;
  border-radius: 10px;
  border: 1px solid #333;
  color: #f5f5f5;
  padding: 10px;
  resize: vertical;
  font-size: 0.95rem;
}

.ask-section textarea:focus {
  outline: none;
  border-color: rgba(255, 120, 40, 0.7);
  box-shadow: 0 0 10px rgba(255, 120, 40, 0.4);
}

#ask-btn {
  margin-top: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff7a1a, #ff3b1a);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  float: right;
  box-shadow: 0 0 12px rgba(255, 80, 0, 0.7);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

#ask-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(255, 120, 40, 0.9);
  filter: brightness(1.05);
}

#ask-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 8px rgba(255, 80, 0, 0.6);
}

/* Answer section */
.answer-section {
  background: rgba(10, 10, 10, 0.9);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 120, 40, 0.18);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.8);
}

.answer-section h2 {
  margin-bottom: 10px;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e0e0e0;
}

.answer-box {
  min-height: 120px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #f5f5f5;
}

.answer-box .placeholder {
  color: #777;
}

/* ========================================= */
/* MOBILE FIXES + BOTTOM-SHEET HISTORIK */
/* ========================================= */
@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
    padding: 16px;
  }

  .main-panel {
    margin-left: 0;
    width: 100%;
  }

  textarea#question {
    width: 100%;
    font-size: 1.1rem;
    min-height: 140px;
  }

  #ask-btn {
    width: 100%;
    font-size: 1.2rem;
    padding: 14px;
    float: none;
  }

  .answer-box {
    font-size: 1.05rem;
    padding: 12px;
  }

  /* Bottom-sheet historik */
  .history-panel {
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: 60vh;
    bottom: -60vh;
    border-radius: 16px 16px 0 0;
    border-right: none;
    border-top: 1px solid rgba(255,120,40,0.25);
    padding: 16px;
    box-shadow: 0 -6px 25px rgba(0,0,0,0.8);
    transition: bottom 0.3s ease;
    z-index: 200;
    overflow-y: auto;
  }

  .history-panel.open {
    bottom: 0;
  }

  /* Drag-handle */
  .drag-handle {
    width: 60px;
    height: 5px;
    background: #555;
    border-radius: 100px;
    margin: 6px auto 12px auto;
  }

  /* Flytande knapp nere vänster */
  #history-toggle {
    position: fixed !important;
    left: 12px !important;
    bottom: 12px !important;

    margin: 0 !important;
    transform: none !important;

    display: block !important;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff7a1a, #ff3b1a);
    color: white;
    font-size: 20px;
    border: none;
    box-shadow: 0 0 8px rgba(255,80,0,0.7);
    z-index: 999999; /* Om något täcker den */
    cursor: pointer;
  }
}
