/* planner.css */
:root {
  --bg: #080a0f;
  --surface: #0e111a;
  --border: rgba(255, 255, 255, 0.1);
  --text: #eef0f8;
  --muted: #8b92a5;
  --accent: #00c8ff;
  --accent-hover: #0099cc;
}

body[data-page="planner"] {
  overflow: hidden; /* App-like feel */
  background: var(--bg);
}

/* Layout */
.planner-layout {
  display: flex;
  height: calc(100vh - 70px);
  margin-top: 70px;
  width: 100vw;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

/* TradingView Style Sidebar */
.tv-sidebar {
  width: 52px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 11;
  transition: width 0.3s ease;
  overflow: visible;
}

.tv-sidebar.expanded {
  width: 220px;
}

.tv-sidebar-top {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.tv-sidebar.expanded .tv-sidebar-top {
  justify-content: flex-start;
  padding-left: 12px;
}

.tv-group {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tv-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: 0.2s;
  padding: 0;
  justify-content: center;
  position: relative;
}

.tv-sidebar.expanded .tv-btn {
  justify-content: flex-start;
  padding-left: 14px;
}

.tv-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tv-btn.active {
  color: var(--accent);
  background: rgba(0, 200, 255, 0.1);
  border-right: 2px solid var(--accent);
}

.tv-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.tv-text {
  font-size: 13px;
  margin-left: 10px;
  white-space: nowrap;
  display: none;
}

.tv-sidebar.expanded .tv-text {
  display: block;
}

.tv-arrow {
  font-size: 8px;
  position: absolute;
  right: 4px;
  bottom: 4px;
  color: var(--muted);
}

.tv-sidebar.expanded .tv-arrow {
  right: 12px;
  bottom: auto;
}

/* Submenu */
.tv-submenu {
  position: absolute;
  left: 52px;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 4px 4px 15px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  min-width: 180px;
  z-index: 100;
}

.tv-sidebar.expanded .tv-submenu {
  left: 220px;
}

.tv-group.has-submenu:hover .tv-submenu {
  display: flex;
}

.tv-subbtn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 15px;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.tv-subbtn:hover {
  background: rgba(0, 200, 255, 0.1);
  color: var(--text);
}

/* Topbar inside Main */
.planner-topbar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 17, 26, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  gap: 8px;
  z-index: 12;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.topbar-btn {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.topbar-btn.danger:hover {
  background: rgba(255, 71, 87, 0.2);
  color: #ff4757;
}

/* Canvas Wrapper */
#canvas-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: crosshair;
}

/* Overlays / Modals specific to Planner */
.planner-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  z-index: 999;
  width: 320px;
  display: none;
}

.planner-modal.active {
  display: block;
}

.planner-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 998;
  display: none;
}
.planner-overlay.active {
  display: block;
}

/* Floating Status */
.planner-status {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0,0,0,0.7);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  z-index: 12;
}

/* Forms */
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  margin-bottom: 16px;
}

/* Mobile warning */
.mobile-warning {
  display: none;
}

@media (max-width: 900px) {
  .planner-layout {
    flex-direction: column;
  }
  .planner-sidebar {
    width: 100%;
    height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .mobile-warning {
    display: block;
    background: rgba(255, 165, 0, 0.1);
    color: orange;
    padding: 10px;
    text-align: center;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 165, 0, 0.2);
}

/* Floating Toolbar */
.floating-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(14, 17, 26, 0.95);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  display: none;
  align-items: center;
  gap: 6px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  pointer-events: auto;
  backdrop-filter: blur(5px);
}

.floating-toolbar.active {
  display: flex;
}

.color-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: 0.2s;
}

.color-btn:hover {
  border-color: #fff;
  transform: scale(1.1);
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.tb-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.2s;
}

.tb-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.tb-btn.danger {
  color: #ff4757;
}

.tb-btn.danger:hover {
  background: rgba(255, 71, 87, 0.2);
}
