/* =============================================
   MOBILE STYLES - Ultra Kompakt mit !important
   ============================================= */
@media (max-width: 768px) {
  body {
    font-size: 0.7rem !important;
    padding-bottom: 0.5rem !important;
  }

  /* Navbar - Ultra Mini */
  .navbar {
    padding: 0.3rem 0.8rem !important;
    margin-bottom: 0.3rem !important;
    height: 36px !important;
  }

  .brand-logo {
    width: 24px !important;
    height: 24px !important;
  }

  .navbar .brand {
    gap: 0.5rem !important;
  }

  .navbar .brand span {
    font-size: 0.8rem !important;
    letter-spacing: -0.3px !important;
  }

  .mode-badge {
    display: none !important;
  }

  .help-btn {
    font-size: 0.65rem !important;
    padding: 0.3rem 0.5rem !important;
  }

  /* Container */
  #container {
    padding: 0 0.5rem !important;
  }

  /* Controls - ALLES NEBENEINANDER */
  .controls {
    padding: 0.5rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 8px !important;
    background: rgba(15, 15, 25, 0.9) !important;
    backdrop-filter: blur(12px) !important;
  }

  /* Erste Zeile: Pair, Depth, Distance NEBENEINANDER */
  .control-row:first-child {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.3rem !important;
    margin: 0 0 0.3rem 0 !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
  }

  .control-row:first-child .control-group {
    flex: 1 !important;
    min-width: 0 !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
    border: none !important;
    padding: 0 !important;
  }

  .control-row:first-child .control-group label {
    font-size: 0.6rem !important;
    white-space: nowrap !important;
  }

  .control-row:first-child input,
  .control-row:first-child select {
    width: 100% !important;
    padding: 0.3rem 0.4rem !important;
    font-size: 0.65rem !important;
  }

  /* Zweite Zeile: Min Order, Min Wall, Sensitivity, Stabilität NEBENEINANDER */
  .control-row:nth-child(2) {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.3rem !important;
    margin: 0 0 0.3rem 0 !important;
  }

  .control-row:nth-child(2) .control-group {
    flex-direction: column !important;
    gap: 0.2rem !important;
    border: none !important;
    padding: 0 !important;
  }

  .control-row:nth-child(2) .control-group label {
    font-size: 0.6rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .control-row:nth-child(2) input,
  .control-row:nth-child(2) select {
    width: 100% !important;
    padding: 0.3rem 0.4rem !important;
    font-size: 0.65rem !important;
  }

  /* Dritte Zeile: Start, Stop, Buttons, TP-Select NEBENEINANDER */
  .control-row:nth-child(3) {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr !important;
    gap: 0.3rem !important;
    margin: 0 !important;
  }

  .control-row:nth-child(3) button {
    width: 100% !important;
    padding: 0.4rem 0.2rem !important;
    font-size: 0.6rem !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .control-row:nth-child(3) .icon-btn {
    padding: 0.4rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .control-row:nth-child(3) .icon-btn img {
    height: 16px !important;
  }

  .control-row:nth-child(3) select {
    width: 100% !important;
    padding: 0.3rem 0.2rem !important;
    font-size: 0.55rem !important;
    opacity: 1 !important;
  }

  /* Banners - Ultra Kompakt */
  .info-banner, .warning-banner {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.6rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 6px !important;
  }

  .live-indicator {
    width: 6px !important;
    height: 6px !important;
    margin-right: 0.3rem !important;
  }

  /* MANIPULATIONSWAHRSCHEINLICHKEIT - Klein */
  #container > div[style*="Manipulationswahrscheinlichkeit"] {
    padding: 0.4rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 8px !important;
  }

  #container > div[style*="Manipulationswahrscheinlichkeit"] > div:first-child {
    margin-bottom: 0.3rem !important;
    flex-wrap: wrap !important;
  }

  #container > div[style*="Manipulationswahrscheinlichkeit"] span {
    font-size: 0.6rem !important;
  }

  #manipulationProbabilityBar {
    height: 14px !important;
    border-radius: 6px !important;
  }

  #manipulationProbabilityFill {
    font-size: 0.55rem !important;
  }

  /* MARKT-AKTEURE - EINE ZEILE HORIZONTAL */
  #container > div[style*="Markt-Akteure"] {
    padding: 0.4rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 8px !important;
  }

  /* Header verstecken */
  #container > div[style*="Markt-Akteure"] > div:first-child {
    display: none !important;
  }

  /* Akteure Grid - HORIZONTAL EINE ZEILE */
  #container > div[style*="Markt-Akteure"] > div[style*="grid"] {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    gap: 0.2rem !important;
    margin-bottom: 0.25rem !important;
    overflow: visible !important;
    grid-template-columns: unset !important;
  }

  #container > div[style*="Markt-Akteure"] > div[style*="grid"] > div {
    text-align: center !important;
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Emoji - KLEIN */
  #shrimpEmoji,
  #fishEmoji,
  #dolphinEmoji,
  #sharkEmoji,
  #whaleEmoji,
  #megaWhaleEmoji {
    font-size: 0.9rem !important;
    margin-bottom: 0.1rem !important;
    line-height: 1 !important;
  }

  /* Labels verstecken */
  #container > div[style*="Markt-Akteure"] > div[style*="grid"] > div > div:nth-child(2) {
    display: none !important;
  }

  /* Counts - MINI */
  #shrimpCount,
  #fishCount,
  #dolphinCount,
  #sharkCount,
  #whaleCount2,
  #megaWhaleCount {
    font-size: 0.65rem !important;
    line-height: 1 !important;
    margin-bottom: 0 !important;
  }

  /* Volumen Range verstecken */
  #container > div[style*="Markt-Akteure"] > div[style*="grid"] > div > div:nth-child(4) {
    display: none !important;
  }

  /* Aktivitäts-Bar - KLEIN */
  #shrimpBar,
  #fishBar,
  #dolphinBar,
  #sharkBar,
  #whaleBar,
  #megaWhaleBar {
    font-size: 0.45rem !important;
  }

  #container > div[style*="Markt-Akteure"] > div > div[style*="height"] {
    height: 14px !important;
    border-radius: 6px !important;
  }

  /* Stats - HORIZONTAL IN EINER ZEILE MIT SCROLL */
  .stats {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.4rem !important;
    margin: 0.3rem 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
  }

  .stats::-webkit-scrollbar {
    display: none !important;
  }

  .stat-box {
    flex: 0 0 auto !important;
    min-width: 70px !important;
    padding: 0.4rem !important;
    border-radius: 6px !important;
    scroll-snap-align: start !important;
  }

  .stat-label {
    font-size: 0.55rem !important;
    margin-bottom: 0.2rem !important;
    white-space: nowrap !important;
  }

  .stat-value {
    font-size: 0.85rem !important;
  }

  #tpLiveIndicator {
    width: 10px !important;
    height: 10px !important;
  }

  /* Imbalance Bar */
  .imbalance-bar {
    height: 24px !important;
    margin: 0.3rem 0 !important;
    border-radius: 6px !important;
  }

  .imbalance-buy, .imbalance-sell {
    font-size: 0.65rem !important;
  }

  /* Alert Box */
  .alert-box {
    padding: 0.5rem !important;
    font-size: 0.8rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 6px !important;
  }

  /* TRADE SIGNALS + AKTIVE WALLS - NEBENEINANDER */
  .trade-signals-container:nth-of-type(1),
  .trade-signals-container:nth-of-type(2) {
    display: inline-block !important;
    width: calc(50% - 0.15rem) !important;
    vertical-align: top !important;
    padding: 0.6rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 10px !important;
  }

  .trade-signals-container:nth-of-type(1) {
    margin-right: 0.3rem !important;
  }

  /* Containers */
  .trade-signals-container {
    padding: 0.7rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 10px !important;
  }

  .section-header {
    font-size: 0.75rem !important;
    margin-bottom: 0.5rem !important;
    padding-bottom: 0.3rem !important;
  }

  /* Signal Cards */
  .signal-card {
    padding: 0.6rem !important;
    margin: 0.3rem 0 !important;
    border-radius: 8px !important;
  }

  .signal-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.3rem !important;
    font-size: 0.7rem !important;
  }

  .signal-reason {
    padding: 0.4rem !important;
    font-size: 0.6rem !important;
    margin: 0.3rem 0 !important;
  }

  .level-row {
    padding: 0.3rem !important;
    margin: 0.2rem 0 !important;
  }

  .level-label {
    font-size: 0.55rem !important;
  }

  .level-value {
    font-size: 0.7rem !important;
  }

  .level-value small {
    font-size: 0.55rem !important;
  }

  .signal-rr {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.3rem !important;
  }

  .rr-box {
    padding: 0.4rem !important;
  }

  .rr-label {
    font-size: 0.5rem !important;
  }

  .rr-value {
    font-size: 1rem !important;
  }

  /* WALLS - NEBENEINANDER (BUY + SELL) */
  .wall-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.3rem !important;
    margin: 0.3rem 0 !important;
  }

  .wall-section {
    flex: 1 !important;
    padding: 0.6rem !important;
    min-height: 250px !important;
    max-height: 400px !important;
    border-radius: 10px !important;
  }

  .wall-item {
    padding: 0.6rem !important;
    padding-right: 1.8rem !important;
    margin: 0.3rem 0 !important;
  }

  .whale-badge {
    font-size: 1rem !important;
    top: 0.4rem !important;
    right: 0.4rem !important;
  }

  .wall-header {
    font-size: 0.75rem !important;
  }

  .wall-price {
    font-size: 0.9rem !important;
    margin: 0.3rem 0 !important;
  }

  .wall-detail {
    font-size: 0.6rem !important;
    padding: 0.25rem 0 !important;
  }

  .wall-detail-label {
    font-size: 0.5rem !important;
  }

  .wall-detail-value {
    font-size: 0.65rem !important;
  }

  .size-badge {
    padding: 0.15rem 0.3rem !important;
    font-size: 0.5rem !important;
  }

  /* History */
  .history-container {
    padding: 0.7rem !important;
    max-height: 350px !important;
    border-radius: 10px !important;
    margin: 0.3rem 0 !important;
  }

  .history-item {
    padding: 0.5rem !important;
    margin: 0.3rem 0 !important;
  }

  .history-header {
    font-size: 0.7rem !important;
  }

  .history-details {
    font-size: 0.6rem !important;
  }

  /* Empty State */
  .empty-state {
    height: 150px !important;
    font-size: 0.7rem !important;
  }

  .empty-icon {
    font-size: 1.5rem !important;
  }

  /* Modal */
  .modal-content {
    width: 95% !important;
    margin: 5% auto !important;
    padding: 1rem !important;
  }

  .modal-header {
    font-size: 1rem !important;
  }
}

/* Extra Small (iPhone SE, iPhone 12 mini) */
@media (max-width: 375px) {
  .navbar .brand span {
    font-size: 0.7rem !important;
  }

  .control-row:nth-child(2) {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .stat-box {
    min-width: 65px !important;
  }

  #shrimpEmoji,
  #fishEmoji,
  #dolphinEmoji,
  #sharkEmoji,
  #whaleEmoji,
  #megaWhaleEmoji {
    font-size: 0.8rem !important;
  }

  #shrimpCount,
  #fishCount,
  #dolphinCount,
  #sharkCount,
  #whaleCount2,
  #megaWhaleCount {
    font-size: 0.6rem !important;
  }

  /* Trade Signals + Aktive Walls untereinander auf kleinen Screens */
  .trade-signals-container:nth-of-type(1),
  .trade-signals-container:nth-of-type(2) {
    width: 100% !important;
    margin-right: 0 !important;
  }

  /* Walls untereinander auf kleinen Screens */
  .wall-container {
    flex-direction: column !important;
  }
}

/* Landscape - Optimize */
@media (max-width: 768px) and (orientation: landscape) {
  .stats {
    flex-wrap: nowrap !important;
  }
}
