/* === mobile.css — IQ Option-style mobile layout === */

@media only screen and (max-width: 768px) {

  /* Full-screen app layout */
  body {
    padding: 0 !important;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #0c1526;
  }

  /* Compact top bar */
  #top-bar {
    height: 50px;
    min-height: 50px;
    padding: 0 12px;
    flex-shrink: 0;
  }

  .broker-logo {
    width: 30px;
    height: 30px;
  }

  .broker-name {
    font-size: 16px;
  }

  #Login-user-id {
    display: none !important;
  }

  /* Main area stacks vertically */
  #main-area {
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    display: flex;
  }

  /* Chart fills available space */
  #chart-container {
    width: 100% !important;
    flex: 1;
    min-height: 0;
    height: auto !important;
    margin: 0 !important;
    border-radius: 0;
    box-shadow: none;
    filter: none;
    position: relative;
  }

  /* Bottom trading panel */
  .trading-panel {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    border-left: none !important;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: 0 !important;
    padding: 8px 10px !important;
    flex-shrink: 0;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px !important;
    align-content: flex-start;
    background: #0f1923 !important;
  }

  /* Hide non-essential panel elements on mobile */
  .balance-section,
  .asset-button,
  .promify-footer-logo {
    display: none !important;
  }

  .trade-history-shell {
    width: 100%;
    order: 4;
  }

  .trade-history-toggle {
    min-height: 34px;
    font-size: 12px;
    padding: 6px 8px;
    margin: 0 !important;
  }

  #trade-history {
    width: 100%;
    height: 120px !important;
    max-height: 120px !important;
    margin-top: 6px !important;
    font-size: 11px;
  }

  #trade-history[hidden] {
    display: none !important;
  }

  /* Timer — full width row */
  .timer-display {
    width: 100%;
    font-size: 18px;
    font-weight: 800;
    padding: 2px 4px;
    background: rgba(0,229,255,0.06);
    border: 1px solid rgba(0,229,255,0.15);
    border-radius: 6px;
    text-align: center;
    order: 0;
  }

  /* Amount and duration side by side */
  .amount-section {
    flex: 1;
    min-width: 0;
    order: 1;
    gap: 4px !important;
  }

  .duration-section {
    flex: 1;
    min-width: 0;
    order: 2;
  }

  .amount-input,
  .duration-select {
    width: 100% !important;
    font-size: 13px;
    padding: 6px 8px;
    box-sizing: border-box;
  }

  /* Prevent iOS auto-zoom on focus (requires font-size >= 16px) */
  .amount-input {
    font-size: 16px;
  }

  .duration-select {
    width: 100% !important;
  }

  /* SUBE / BAJA side by side, large */
  .trade-buttons-row {
    width: 100%;
    order: 3;
    display: flex;
    gap: 8px;
  }

  .trade-button {
    flex: 1;
    font-size: 17px !important;
    padding: 14px 8px !important;
    min-height: 52px;
  }

  /* Mobile bottom navigation */
  #mobile-bottom-nav {
    display: flex !important;
    height: 52px;
    min-height: 52px;
    background: #0c1526;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
  }

  .nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 9px;
    gap: 3px;
    cursor: pointer;
    padding: 4px 2px;
    letter-spacing: 0.03em;
    transition: color 0.2s;
  }

  .nav-tab.active {
    color: #00E5FF;
  }

  .nav-tab:disabled,
  .nav-tab.asset-locked {
    opacity: 0.38;
    cursor: not-allowed;
  }

  .nav-tab svg {
    width: 19px;
    height: 19px;
    stroke-width: 1.75;
  }

  /* Admin panel */
  #panel {
    display: none !important;
  }

  /* Drawing tools — hidden on mobile */
  #three-dots-menu-2,
  #dropdown-menu-2,
  .drawing-tools {
    display: none !important;
  }

  /* Admin panel width fix */
  .admin-panel {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Login form */
  .login-container {
    width: 90% !important;
    max-width: 380px !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  /* Price marker */
  #price-marker {
    font-size: 11px;
    padding: 3px 6px;
  }

  /* Trade result overlay */
  .trade-result-overlay {
    width: min(340px, calc(100vw - 24px)) !important;
    padding: 14px !important;
    border-radius: 18px !important;
  }

  .trade-result-brand {
    justify-content: flex-start;
    gap: 11px;
    padding-left: 2px;
    padding-right: 2px;
    padding-bottom: 12px;
  }

  .trade-result-logo-shell {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.22), rgba(33, 150, 243, 0.1)) !important;
    border-color: rgba(33, 150, 243, 0.42) !important;
  }

  .trade-result-logo {
    display: block !important;
    width: 34px !important;
    height: 34px !important;
    color: #2196F3 !important;
  }

  .trade-result-brand-copy {
    min-width: 0;
  }

  .trade-result-brand-name {
    font-size: 15px;
  }

  .trade-result-brand-sub,
  .trade-result-kicker,
  .trade-result-state {
    font-size: 10px;
  }

  .trade-result-status {
    padding: 14px 6px;
  }

  .trade-result-details {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .trade-result-actions {
    grid-template-columns: 1fr;
  }

  .trade-result-action.ghost {
    grid-column: auto;
  }

  .trade-capture-preview {
    padding: 10px;
  }

  .trade-capture-preview-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .trade-result-overlay .result-text {
    font-size: 34px;
  }

  .trade-result-overlay .profit-amount {
    font-size: 20px;
  }

  .trade-finished-marker {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
  }

  .trade-finished-marker .trade-entry-badge {
    max-width: none;
  }

  .trade-finished-badge {
    min-height: 26px;
    padding: 4px 8px;
    gap: 6px;
  }

  .teb-symbol {
    width: 17px;
    height: 17px;
    font-size: 12px;
  }

  .teb-result-amount {
    font-size: 10px;
  }

  /* ── Top bar: responsive 3-column layout ──────────────────────── */
  #top-bar {
    height: 52px !important;
    min-height: 52px !important;
    padding: 0 12px !important;
    gap: 0 !important;
  }

  /* Logo: compact, no flex expansion */
  .broker-header {
    flex: 0 0 auto !important;
    gap: 6px !important;
  }
  .broker-logo { width: 26px !important; height: 26px !important; }
  .broker-name { font-size: 13px !important; }

  /* Center section: takes remaining space, centered */
  .tb-right {
    flex: 1 !important;
    justify-content: center !important;
    gap: 6px !important;
    position: static !important;
  }

  /* Avatar: smaller */
  .tb-avatar {
    width: 32px !important;
    height: 32px !important;
  }
  .tb-avatar-badge {
    width: 12px !important;
    height: 12px !important;
  }
  #tb-avatar-initials { font-size: 12px !important; }

  /* Balance pill: compact */
  .tb-balance-pill {
    padding: 5px 9px !important;
    gap: 5px !important;
    border-radius: 20px !important;
  }
  .tb-bal-amount {
    font-size: 12px !important;
    min-width: 60px !important;
  }
  .tb-curr-dot { width: 7px !important; height: 7px !important; }
  .tb-bal-btn svg { width: 14px !important; height: 11px !important; }

  /* Deposit: icon only on mobile */
  .tb-deposit-outer {
    flex: 0 0 auto !important;
  }
  .tb-deposit-btn {
    padding: 0 !important;
    font-size: 0 !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  .tb-deposit-btn svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Account dropdown: full-width on mobile */
  .tb-acct-drop {
    top: 52px !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 0 0 10px 10px !important;
    min-width: unset !important;
  }

  /* Trading panel separator: no left border on mobile */
  .trading-panel::before { display: none !important; }
  .trading-panel { box-shadow: none !important; }

  /* Active trade: collapse panel to just the timer so chart fills screen */
  .trading-panel.trade-active {
    flex-wrap: nowrap !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 4px 12px !important;
    overflow: hidden !important;
    align-items: center !important;
    gap: 0 !important;
  }
  .trading-panel.trade-active .amount-section,
  .trading-panel.trade-active .duration-section,
  .trading-panel.trade-active .trade-buttons-row,
  .trading-panel.trade-active .trade-history-shell {
    display: none !important;
  }
  .trading-panel.trade-active .timer-display {
    width: 100% !important;
    font-size: 20px !important;
    padding: 6px !important;
    margin: 0 !important;
    order: unset !important;
    border-radius: 6px !important;
  }

  #candle-timer {
    left: auto !important;
    right: 54px !important;
    bottom: 18px !important;
    padding: 4px 8px !important;
    gap: 6px !important;
  }
}

/* Landscape on small screens — give chart more height */
@media only screen and (max-width: 768px) and (orientation: landscape) {
  .timer-display {
    display: none;
  }

  .trading-panel {
    padding: 6px 10px !important;
  }

  .trade-button {
    padding: 10px 8px !important;
    min-height: 40px;
    font-size: 15px !important;
  }
}
