import { css, cssManager } from '@design.estate/dees-element';

/**
 * Shared component styles for geo components
 */
export const geoComponentStyles = css`
  :host {
    display: block;
    box-sizing: border-box;
  }

  :host([hidden]) {
    display: none;
  }

  *,
  *::before,
  *::after {
    box-sizing: inherit;
  }
`;

/**
 * Map container styles
 */
export const mapContainerStyles = css`
  .map-container {
    --geo-overlay-inset: 12px;
    --geo-overlay-gap: 8px;

    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
    overflow: hidden;
    border-radius: 8px;
  }

  .map-wrapper {
    position: absolute;
    inset: 0;
  }

  /* Overlay grid for UI elements */
  .map-overlay {
    position: absolute;
    inset: var(--geo-overlay-inset);
    pointer-events: none;
    z-index: 5;

    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "top-left    .      top-right"
      ".           .      ."
      "bottom-left .      bottom-right";
    gap: var(--geo-overlay-gap);
  }

  .map-overlay > * {
    pointer-events: auto;
  }

  .overlay-top-left {
    grid-area: top-left;
    display: flex;
    align-items: flex-start;
    gap: var(--geo-overlay-gap);
  }

  .overlay-top-right {
    grid-area: top-right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--geo-overlay-gap);
  }

  .overlay-bottom-left {
    grid-area: bottom-left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--geo-overlay-gap);
  }

  .overlay-bottom-right {
    grid-area: bottom-right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--geo-overlay-gap);
  }
`;

/**
 * Toolbar styles
 */
export const toolbarStyles = css`
  .toolbar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.95)', 'rgba(30, 30, 30, 0.9)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-self: flex-start;
  }

  .toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .toolbar-divider {
    height: 1px;
    margin: 4px 0;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .tool-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .tool-button:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
  }

  .tool-button.active {
    background: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .tool-button svg {
    width: 20px;
    height: 20px;
  }

  .tool-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
`;

/**
 * Search styles for address search functionality
 */
export const searchStyles = css`
  .search-container {
    width: 280px;
    position: relative;
  }

  .search-input-wrapper {
    display: flex;
    align-items: center;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.95)', 'rgba(30, 30, 30, 0.9)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .search-input-wrapper:focus-within {
    border-color: var(--geo-tool-active, #0084ff);
  }

  .search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.4)', 'rgba(255, 255, 255, 0.5)')};
    flex-shrink: 0;
  }

  .search-icon svg {
    width: 16px;
    height: 16px;
  }

  .search-input {
    flex: 1;
    height: 36px;
    padding: 0 12px 0 0;
    border: none;
    background: transparent;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    font-size: 13px;
    font-family: inherit;
    outline: none;
  }

  .search-input::placeholder {
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.4)', 'rgba(255, 255, 255, 0.4)')};
  }

  .search-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .search-spinner svg {
    width: 16px;
    height: 16px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.4)', 'rgba(255, 255, 255, 0.5)')};
    animation: spin 1s linear infinite;
  }

  @keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  .search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 4px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.4)', 'rgba(255, 255, 255, 0.5)')};
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .search-clear:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(255, 255, 255, 0.8)')};
  }

  .search-clear svg {
    width: 14px;
    height: 14px;
  }

  .search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.95)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 20;
  }

  .search-results:empty {
    display: none;
  }

  .search-result {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.05)')};
  }

  .search-result:last-child {
    border-bottom: none;
  }

  .search-result:hover,
  .search-result.highlighted {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
  }

  .search-result-name {
    font-size: 13px;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    line-height: 1.3;
  }

  .search-result-type {
    font-size: 11px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    text-transform: capitalize;
  }

  .search-no-results {
    padding: 12px;
    text-align: center;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    font-size: 13px;
  }
`;

/**
 * Navigation panel styles for A-to-B routing
 */
export const navigationStyles = css`
  .navigation-panel {
    width: 300px;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.95)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: hidden;
    align-self: flex-start;
  }

  .nav-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .nav-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--geo-tool-active, #0084ff);
  }

  .nav-header-icon svg {
    width: 18px;
    height: 18px;
  }

  .nav-header-title {
    font-size: 13px;
    font-weight: 600;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
  }

  .nav-mode-selector {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .nav-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.6)')};
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .nav-mode-btn:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.8)', 'rgba(255, 255, 255, 0.9)')};
  }

  .nav-mode-btn.active {
    background: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .nav-mode-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Traffic toggle in navigation panel */
  .nav-traffic-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .nav-traffic-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.6)', 'rgba(255, 255, 255, 0.7)')};
  }

  .nav-traffic-toggle-label svg {
    width: 14px;
    height: 14px;
    color: var(--geo-tool-active, #0084ff);
  }

  .nav-traffic-toggle-btn {
    position: relative;
    width: 36px;
    height: 20px;
    border: none;
    border-radius: 10px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(255, 255, 255, 0.2)')};
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0;
  }

  .nav-traffic-toggle-btn.active {
    background: var(--geo-tool-active, #0084ff);
  }

  .toggle-track {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
  }

  .toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
  }

  .nav-traffic-toggle-btn.active .toggle-thumb {
    transform: translateX(16px);
  }

  .nav-inputs {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .nav-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .nav-input-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .nav-input-marker.start {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
  }

  .nav-input-marker.end {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
  }

  .nav-input-wrapper {
    flex: 1;
    position: relative;
  }

  .nav-input {
    width: 100%;
    height: 36px;
    padding: 0 36px 0 12px;
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(255, 255, 255, 0.15)')};
    border-radius: 6px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.03)', 'rgba(0, 0, 0, 0.2)')};
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
  }

  .nav-input:focus {
    border-color: var(--geo-tool-active, #0084ff);
  }

  .nav-input::placeholder {
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.4)', 'rgba(255, 255, 255, 0.4)')};
  }

  .nav-input.has-value {
    padding-right: 60px;
  }

  .nav-set-map-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.4)', 'rgba(255, 255, 255, 0.5)')};
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .nav-set-map-btn:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.8)', 'rgba(255, 255, 255, 0.9)')};
  }

  .nav-set-map-btn.active {
    background: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .nav-set-map-btn svg {
    width: 14px;
    height: 14px;
  }

  .nav-input-clear {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.3)', 'rgba(255, 255, 255, 0.4)')};
    cursor: pointer;
    transition: color 0.15s ease;
  }

  .nav-input-clear:hover {
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(255, 255, 255, 0.8)')};
  }

  .nav-input-clear svg {
    width: 12px;
    height: 12px;
  }

  .nav-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.98)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 6px;
    z-index: 20;
  }

  .nav-search-result {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.05)')};
  }

  .nav-search-result:last-child {
    border-bottom: none;
  }

  .nav-search-result:hover,
  .nav-search-result.highlighted {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
  }

  .nav-search-result-name {
    font-size: 12px;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-search-result-type {
    font-size: 10px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    text-transform: capitalize;
  }

  .nav-actions {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
  }

  .nav-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
  }

  .nav-action-btn.primary {
    background: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .nav-action-btn.primary:hover:not(:disabled) {
    background: #0073e6;
  }

  .nav-action-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .nav-action-btn.secondary {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.08)', 'rgba(255, 255, 255, 0.1)')};
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(255, 255, 255, 0.8)')};
  }

  .nav-action-btn.secondary:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.12)', 'rgba(255, 255, 255, 0.15)')};
  }

  .nav-action-btn svg {
    width: 16px;
    height: 16px;
  }

  .nav-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px;
    background: rgba(0, 132, 255, 0.1);
    border-top: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .nav-summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
  }

  .nav-summary-item svg {
    width: 16px;
    height: 16px;
    color: var(--geo-tool-active, #0084ff);
  }

  .nav-steps {
    max-height: 250px;
    overflow-y: auto;
  }

  .nav-step {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.05)')};
    transition: background-color 0.15s ease;
    cursor: pointer;
  }

  .nav-step:last-child {
    border-bottom: none;
  }

  .nav-step:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.03)', 'rgba(255, 255, 255, 0.05)')};
  }

  .nav-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.08)', 'rgba(255, 255, 255, 0.1)')};
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(255, 255, 255, 0.8)')};
    font-size: 14px;
    flex-shrink: 0;
  }

  .nav-step-content {
    flex: 1;
    min-width: 0;
  }

  .nav-step-instruction {
    font-size: 13px;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    line-height: 1.4;
    margin-bottom: 2px;
  }

  .nav-step-distance {
    font-size: 11px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
  }

  /* Current step - highlighted during active navigation */
  .nav-step.current {
    position: relative;
    background: ${cssManager.bdTheme('rgba(59, 130, 246, 0.1)', 'rgba(59, 130, 246, 0.15)')};
    border-left: 3px solid #3b82f6;
    padding-left: 9px;
  }

  /* Completed steps - muted appearance */
  .nav-step.completed {
    opacity: 0.6;
  }

  .nav-step.completed .nav-step-icon {
    background: ${cssManager.bdTheme('rgba(34, 197, 94, 0.2)', 'rgba(34, 197, 94, 0.25)')};
    color: #22c55e;
  }

  /* Progress bar on current step */
  .nav-step-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
    border-radius: 0 2px 2px 0;
    transition: width 0.3s ease-out;
  }

  .nav-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.15);
    border-top: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 12px;
  }

  .nav-error svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  .nav-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.6)')};
    font-size: 13px;
  }

  .nav-loading svg {
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
  }

  .nav-empty-steps {
    padding: 16px 12px;
    text-align: center;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    font-size: 12px;
  }

  /* Directions view styles */
  .nav-directions-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .nav-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.08)', 'rgba(255, 255, 255, 0.1)')};
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    cursor: pointer;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
  }

  .nav-back-btn:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.12)', 'rgba(255, 255, 255, 0.2)')};
  }

  .nav-back-btn svg {
    width: 18px;
    height: 18px;
  }

  .nav-directions-summary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
  }

  .nav-directions-summary svg {
    width: 14px;
    height: 14px;
    color: var(--geo-tool-active, #0084ff);
  }

  .nav-directions-separator {
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.3)', 'rgba(255, 255, 255, 0.4)')};
    margin: 0 4px;
  }

  /* Make steps section taller when it's the main content in directions view */
  .nav-directions-view .nav-steps {
    max-height: none;
    flex: 1;
    overflow-y: auto;
  }

  .nav-directions-view {
    display: flex;
    flex-direction: column;
  }

  /* Traffic-aware route info */
  .nav-traffic-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 152, 0, 0.1);
    border-radius: 6px;
    margin: 8px 12px;
  }

  .nav-traffic-info.low {
    background: rgba(0, 200, 83, 0.1);
  }

  .nav-traffic-info.moderate {
    background: rgba(255, 235, 59, 0.15);
  }

  .nav-traffic-info.heavy {
    background: rgba(255, 152, 0, 0.15);
  }

  .nav-traffic-info.severe {
    background: rgba(244, 67, 54, 0.15);
  }

  .nav-traffic-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .nav-traffic-indicator.low {
    background: #00c853;
  }

  .nav-traffic-indicator.moderate {
    background: #ffeb3b;
  }

  .nav-traffic-indicator.heavy {
    background: #ff9800;
  }

  .nav-traffic-indicator.severe {
    background: #f44336;
  }

  .nav-traffic-text {
    font-size: 12px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(255, 255, 255, 0.8)')};
  }

  .nav-traffic-delay {
    font-size: 11px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    margin-left: auto;
  }
`;

/**
 * Traffic control styles
 */
/**
 * Header toolbar styles for toolbar above map
 */
export const headerToolbarStyles = css`
  /* CSS Grid layout for sidebars that push the map */
  .geo-component {
    display: grid;
    grid-template-columns: var(--left-panel-width, 0px) 1fr var(--right-panel-width, 0px);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header header header"
      "left-panel map-area right-panel";
    height: 100%;
    width: 100%;
    transition: grid-template-columns 0.25s ease;
  }

  .header-toolbar {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.95)')};
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    min-height: 52px;
    position: relative;
    z-index: 10;
  }

  .toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .toolbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 200px;
  }

  .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .header-toolbar .toolbar-divider {
    width: 1px;
    height: 24px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(255, 255, 255, 0.15)')};
    margin: 0 4px;
  }

  /* Header toolbar button styles */
  .header-toolbar .tool-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .header-toolbar .tool-button:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
  }

  .header-toolbar .tool-button.active {
    background: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .header-toolbar .tool-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .header-toolbar .tool-button svg {
    width: 18px;
    height: 18px;
  }

  /* Search container in header */
  .header-toolbar .search-container {
    width: 100%;
    max-width: 300px;
  }

  /* Left Sidebar - Navigation Panel */
  .left-sidebar {
    grid-area: left-panel;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.95)')};
    border-right: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .left-sidebar.collapsed {
    border-right: none;
  }

  .left-sidebar .navigation-panel {
    width: 300px;
    min-width: 300px;
    border: none;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    height: 100%;
    overflow-y: auto;
  }

  /* Right Sidebar - Draw Panel */
  .right-sidebar {
    grid-area: right-panel;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.95)')};
    border-left: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .right-sidebar.collapsed {
    border-left: none;
  }

  /* Draw Panel Styles */
  .draw-panel {
    width: 180px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
  }

  .draw-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .draw-panel-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--geo-tool-active, #0084ff);
  }

  .draw-panel-header-icon svg {
    width: 18px;
    height: 18px;
  }

  .draw-panel-header-title {
    font-size: 13px;
    font-weight: 600;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
  }

  .draw-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
  }

  .draw-tool-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    background: transparent;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  .draw-tool-button:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
    border-color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.2)', 'rgba(255, 255, 255, 0.2)')};
  }

  .draw-tool-button.active {
    background: var(--geo-tool-active, #0084ff);
    border-color: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .draw-tool-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .draw-tool-button svg {
    width: 22px;
    height: 22px;
  }

  .draw-tool-button-label {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
  }

  .draw-panel-divider {
    height: 1px;
    margin: 4px 12px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .draw-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  .draw-action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    background: transparent;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }

  .draw-action-button:hover {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.05)', 'rgba(255, 255, 255, 0.1)')};
    border-color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.2)', 'rgba(255, 255, 255, 0.2)')};
  }

  .draw-action-button.active {
    background: var(--geo-tool-active, #0084ff);
    border-color: var(--geo-tool-active, #0084ff);
  }

  .draw-action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .draw-action-button svg {
    width: 16px;
    height: 16px;
  }

  .draw-action-button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: ${cssManager.bdTheme('#dc2626', '#fca5a5')};
  }

  /* Map container takes grid area */
  .geo-component .map-container {
    grid-area: map-area;
    position: relative;
    min-height: 0;
    min-width: 0;
  }
`;

/**
 * Traffic control styles
 */
export const trafficStyles = css`
  .traffic-control {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .traffic-toggle-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.95)', 'rgba(30, 30, 30, 0.9)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }

  .traffic-toggle-btn:hover:not(:disabled) {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.08)', 'rgba(255, 255, 255, 0.15)')};
  }

  .traffic-toggle-btn.active {
    background: var(--geo-tool-active, #0084ff);
    border-color: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .traffic-toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .traffic-toggle-btn svg {
    width: 20px;
    height: 20px;
  }

  .traffic-loading-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.95)', 'rgba(30, 30, 30, 0.9)')};
    border-radius: 50%;
  }

  .traffic-loading-indicator svg {
    width: 10px;
    height: 10px;
    animation: spin 1s linear infinite;
  }

  .traffic-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.95)', 'rgba(30, 30, 30, 0.9)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 6px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .traffic-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00c853;
    animation: pulse 2s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }

  .traffic-status-text {
    font-size: 11px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.6)', 'rgba(255, 255, 255, 0.7)')};
  }

  .traffic-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #f44336;
    cursor: help;
  }

  .traffic-error svg {
    width: 16px;
    height: 16px;
  }

  /* Traffic Legend */
  .traffic-legend {
    padding: 10px 12px;
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.95)', 'rgba(30, 30, 30, 0.9)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .traffic-legend-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    margin-bottom: 8px;
  }

  .traffic-legend-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .traffic-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(255, 255, 255, 0.8)')};
  }

  .traffic-legend-color {
    width: 16px;
    height: 4px;
    border-radius: 2px;
  }

  .traffic-legend-updated {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    font-size: 10px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.4)', 'rgba(255, 255, 255, 0.4)')};
  }
`;

/**
 * MapLibre marker styles - CRITICAL for correct marker positioning
 * MapLibre markers use CSS transforms for positioning, which requires position: absolute
 */
export const maplibreMarkerStyles = css`
  .maplibregl-marker {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
  }
`;

/**
 * Navigation guidance styles for GPS tracking and voice guidance
 */
export const guidanceStyles = css`
  /* GPS Position Marker */
  .gps-position-marker {
    width: 32px;
    height: 32px;
    cursor: default;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  }

  /* Guidance Panel - shown during active navigation */
  .guidance-panel {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.95)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 24px;
    min-width: 280px;
    max-width: 400px;
    z-index: 15;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  .guidance-maneuver {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
  }

  .guidance-maneuver-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--geo-tool-active, #0084ff);
    border-radius: 12px;
    font-size: 28px;
    color: #fff;
    flex-shrink: 0;
  }

  .guidance-maneuver-distance {
    font-size: 36px;
    font-weight: 700;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    line-height: 1;
  }

  .guidance-instruction {
    font-size: 16px;
    font-weight: 500;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    margin-bottom: 12px;
    line-height: 1.4;
  }

  .guidance-remaining {
    font-size: 13px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.6)')};
    padding-top: 8px;
    border-top: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .guidance-off-route {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: ${cssManager.bdTheme('#dc2626', '#fca5a5')};
    font-size: 13px;
    font-weight: 500;
    text-align: center;
  }

  /* Simulation Controls Panel */
  .simulation-panel {
    background: ${cssManager.bdTheme('rgba(255, 255, 255, 0.98)', 'rgba(30, 30, 30, 0.95)')};
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px;
  }

  .simulation-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .simulation-panel-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--geo-tool-active, #0084ff);
  }

  .simulation-panel-header-icon svg {
    width: 18px;
    height: 18px;
  }

  .simulation-panel-header-title {
    font-size: 13px;
    font-weight: 600;
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
  }

  .simulation-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
  }

  .simulation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(255, 255, 255, 0.15)')};
    border-radius: 8px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.03)', 'rgba(0, 0, 0, 0.2)')};
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  .simulation-btn:hover:not(:disabled) {
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.08)', 'rgba(255, 255, 255, 0.1)')};
    border-color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.25)', 'rgba(255, 255, 255, 0.25)')};
  }

  .simulation-btn.active {
    background: var(--geo-tool-active, #0084ff);
    border-color: var(--geo-tool-active, #0084ff);
    color: #fff;
  }

  .simulation-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .simulation-btn svg {
    width: 18px;
    height: 18px;
  }

  .simulation-btn.play svg {
    width: 16px;
    height: 16px;
  }

  /* Speed selector */
  .simulation-speed {
    margin-bottom: 12px;
  }

  .simulation-speed-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    margin-bottom: 6px;
  }

  .simulation-speed-label svg {
    width: 12px;
    height: 12px;
  }

  .simulation-speed-select {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(255, 255, 255, 0.15)')};
    border-radius: 6px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.03)', 'rgba(0, 0, 0, 0.2)')};
    color: ${cssManager.bdTheme('#1a1a1a', '#ffffff')};
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
  }

  .simulation-speed-select:focus {
    border-color: var(--geo-tool-active, #0084ff);
  }

  /* Voice toggle */
  .simulation-voice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
  }

  .simulation-voice-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.7)', 'rgba(255, 255, 255, 0.8)')};
  }

  .simulation-voice-label svg {
    width: 16px;
    height: 16px;
    color: var(--geo-tool-active, #0084ff);
  }

  .simulation-voice-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    border: none;
    border-radius: 11px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(255, 255, 255, 0.2)')};
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0;
  }

  .simulation-voice-toggle.active {
    background: var(--geo-tool-active, #0084ff);
  }

  .simulation-voice-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
  }

  .simulation-voice-toggle.active .simulation-voice-toggle-thumb {
    transform: translateX(18px);
  }

  /* Progress bar */
  .simulation-progress {
    margin-bottom: 8px;
  }

  .simulation-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    margin-bottom: 4px;
  }

  .simulation-progress-bar {
    width: 100%;
    height: 6px;
    background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
    border-radius: 3px;
    overflow: hidden;
  }

  .simulation-progress-fill {
    height: 100%;
    background: var(--geo-tool-active, #0084ff);
    border-radius: 3px;
    transition: width 0.3s ease;
  }

  /* Status text */
  .simulation-status {
    font-size: 12px;
    color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.5)', 'rgba(255, 255, 255, 0.5)')};
    text-align: center;
    padding-top: 8px;
  }

  .simulation-status.running {
    color: #22c55e;
  }

  .simulation-status.paused {
    color: #f59e0b;
  }

  .simulation-status.completed {
    color: var(--geo-tool-active, #0084ff);
  }
`;
