/* =========================================
   desktop.css - Desktop Layouts & Sidebar
   ========================================= */

@media (min-width: 1024px) {

  /* HIDE MOBILE ELEMENTS */
  .mobile-container,
  .mobile-header,
  .mobile-drawer-overlay,
  .mobile-drawer,
  .mobile-only {
    display: none !important;
  }

  /* Enhanced Desktop Background */
  body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
      radial-gradient(circle at 20% 50%,
        rgba(0, 220, 130, 0.15) 0%,
        transparent 50%),
      radial-gradient(circle at 80% 80%,
        rgba(168, 85, 247, 0.12) 0%,
        transparent 50%),
      radial-gradient(circle at 40% 20%,
        rgba(14, 165, 233, 0.12) 0%,
        transparent 50%);
    animation: gradientShift 30s ease infinite;
    pointer-events: none;
  }

  /* Layout with Animation */
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .layout {
    display: flex !important;
    width: 100%;
    max-width: 1600px;
    height: 100vh;
    gap: 20px;
    padding: 20px;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.5s ease;
  }

  /* =========================================
     Sidebar
     ========================================= */
  .sidebar {
    width: 320px;
    min-height: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  }

  .sidebar::before {
    content: "";
    position: absolute;
    top: -50px;
    left: -50px;
    right: -50px;
    height: 200px;
    background: var(--accent-gradient);
    opacity: 0.15;
    filter: blur(100px);
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
  }

  .sidebar.collapsed {
    width: 60px;
    padding: 20px 12px;
  }

  .sidebar.collapsed>*:not(.sidebar-header) {
    display: none !important;
  }

  .sidebar.collapsed .sidebar-header {
    justify-content: center;
  }

  .sidebar.collapsed .logo-container,
  .sidebar.collapsed .brand {
    display: none !important;
  }

  .sidebar.collapsed .toggle-btn {
    width: 36px;
    height: 36px;
    margin: 0;
  }

  /* Smooth transition for collapsing */
  .sidebar>* {
    transition: opacity 0.2s ease;
  }

  .sidebar.collapsed>* {
    opacity: 0;
  }

  .sidebar.collapsed .sidebar-header {
    opacity: 1;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
  }

  .logo {
    width: 42px;
    height: 42px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
    animation: logoGlow 2s ease-in-out infinite;
  }

  @keyframes logoGlow {

    0%,
    100% {
      box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
    }

    50% {
      box-shadow: 0 4px 20px rgba(0, 220, 130, 0.5);
    }
  }

  .brand {
    display: flex;
    flex-direction: column;
  }

  .brand-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
  }

  .brand-subtitle {
    font-size: 11px;
    color: var(--text-tertiary);
  }

  .toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: rgba(0, 220, 130, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
  }

  .toggle-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    transform: scale(1.05);
  }

  /* Action Group */
  .action-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  /* Buttons */
  .btn {
    flex: 1;
    min-width: 0;
    padding: 12px 18px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    transition: all var(--transition-base);
  }

  .btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
  }

  .btn:hover::before {
    transform: translateX(100%);
  }

  .btn.primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
  }

  .btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 220, 130, 0.4);
  }

  .btn.secondary {
    background: linear-gradient(135deg, var(--red-accent), #ec4458);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
  }

  .btn.secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
  }

  /* History List */
  .history-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    min-height: 0;
  }

  .history-list::-webkit-scrollbar {
    width: 4px;
  }

  .history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
  }

  .history-item {
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    min-height: 60px;
  }

  .history-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
  }

  .history-item.active .session-meta,
  .history-item.active .session-time {
    color: rgba(255, 255, 255, 0.9);
  }

  .history-item:hover:not(.active) {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    transform: translateX(4px);
  }

  .session-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
  }

  .session-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-tertiary);
  }

  .session-time {
    font-size: 10px;
    color: var(--text-tertiary);
  }

  .delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    background: rgba(244, 63, 94, 0.1);
    border: none;
    color: var(--red-accent);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .history-item:hover .delete-btn {
    opacity: 1;
  }

  .delete-btn:hover {
    background: rgba(244, 63, 94, 0.2);
  }

  /* Theme Toggle */
  .theme-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    position: relative;
  }

  .theme-option {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-align: center;
    z-index: 1;
    transition: all var(--transition-base);
  }

  .theme-option:hover {
    color: var(--text-secondary);
  }

  .theme-option.active {
    color: white;
  }

  .theme-toggle .slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--accent-gradient);
    border-radius: 8px;
    transition: transform var(--transition-spring);
    z-index: 0;
  }

  .theme-toggle.light .slider {
    transform: translateX(100%);
  }

  /* =========================================
     Main App
     ========================================= */
  .app {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    min-width: 0;
    animation: slideUp 0.5s var(--ease-out-expo) 0.1s both;
  }

  /* Header */
  .header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 15px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  }

  .header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--accent-primary),
        transparent);
    animation: shimmer 3s infinite;
  }

  .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .assistant-avatar {
    width: 52px;
    height: 52px;
    background: var(--accent-gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
    animation: pulse 4s ease-in-out infinite;
  }

  /* User Profile */
  .user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    transition: all var(--transition-base);
  }

  .user-profile:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
  }

  .logout-button {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
  }

  .logout-button:hover {
    border-color: var(--red-accent);
    color: var(--red-accent);
    background: rgba(244, 63, 94, 0.1);
  }

  /* =========================================
     Chat Container
     ========================================= */
  .chat-container {
    flex: 1;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  }

  /* Progress Tracker */
  .progress-tracker {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
  }

  .progress-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
  }

  .step {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
  }

  .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-tertiary);
    transition: all var(--transition-base);
  }

  .step.active .step-number {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
  }

  .step.completed .step-number {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
  }

  .step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    white-space: nowrap;
  }

  .step.active .step-label {
    color: var(--text-primary);
  }

  .step-connector {
    width: 170px;
    height: 3px;
    background: var(--border-color);
    position: relative;
    overflow: hidden;
  }

  .step-connector::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    transition: width var(--transition-slow);
  }

  .step.completed+.step-connector::before {
    width: 100%;
  }

  /* Phase Indicator */
  .phase-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
  }

  .phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: phasePulse 2s infinite;
  }

  @keyframes phasePulse {

    0%,
    100% {
      opacity: 1;
      transform: scale(1);
    }

    50% {
      opacity: 0.6;
      transform: scale(0.8);
    }
  }

  .phase-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
  }

  /* =========================================
     Messages
     ========================================= */
  .messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .messages::-webkit-scrollbar {
    width: 4px;
  }

  .messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 2px;
  }

  .messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
  }

  .messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
  }

  .message-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: messageSlide 0.4s var(--ease-out-expo);
    max-width: 100%;
  }

  @keyframes messageSlide {
    from {
      opacity: 0;
      transform: translateY(10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .message-row.user {
    justify-content: flex-end;
  }

  .message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
  }

  .message-avatar.assistant {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
  }

  .message-avatar.user {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
  }

  .message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }

  .message-bubble {
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    transition: all var(--transition-base);
  }

  .message-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    max-width: 100%;
    border: 1px solid var(--border-color);
  }

  .message-bubble code {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
  }

  .message-row.assistant .message-bubble {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 20px 20px 20px 4px;
  }

  .message-row.user .message-bubble {
    background: var(--accent-gradient);
    color: white;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.2);
  }

  .message-bubble a {
    color: var(--accent-light);
    text-decoration: underline;
    cursor: pointer;
    transition: opacity var(--transition-fast);
  }

  .message-bubble a:hover {
    opacity: 0.8;
    text-decoration: none;
  }

  .message-row.user .message-bubble a {
    color: white;
    text-decoration: underline;
  }

  /* Typing Indicator */
  .typing-bubble {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px 16px 16px 4px;
  }

  .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: typing 1.4s infinite;
  }

  .typing-dot:nth-child(2) {
    animation-delay: 0.2s;
  }

  .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
  }

  /* =========================================
     Input Section
     ========================================= */
  .input-section {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
  }

  .input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 10px;
    transition: all var(--transition-base);
  }

  .input-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(0, 220, 130, 0.1);
  }

  .input-wrapper {
    flex: 1;
    position: relative;
  }

  .input-field {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    resize: none;
    font-family: inherit;
    font-size: 14px;
    max-height: 120px;
    line-height: 1.5;
  }

  .input-field::placeholder {
    color: var(--text-tertiary);
  }

  .send-button {
    min-width: 100px;
    padding: 12px 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
  }

  .send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 220, 130, 0.4);
  }

  .send-button:active {
    transform: translateY(0);
  }

  /* Help Text */
  .help-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 0 4px;
    font-size: 12px;
    color: var(--text-tertiary);
  }

  .help-examples {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .help-example {
    color: var(--accent-primary);
    cursor: pointer;
    transition: all var(--transition-base);
  }

  .help-example:hover {
    text-decoration: underline;
  }

  /* =========================================
     Quick Bar & Actions
     ========================================= */
  .quick-bar {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }

  .quick-chip {
    padding: 10px 16px;
    border-radius: 24px;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
  }

  .quick-chip:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .quick-chip.enrich {
    border-color: var(--blue-accent);
    color: var(--blue-accent);
  }

  .quick-chip.pitch {
    border-color: var(--purple-accent);
    color: var(--purple-accent);
  }

  .quick-chip.pdf {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
  }

  .quick-chip.sheets {
    border-color: var(--orange-accent);
    color: var(--orange-accent);
  }

  .action-bar {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }

  .action-button {
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-base);
  }

  .action-button.enrich {
    background: linear-gradient(135deg, var(--blue-accent), #0284c7);
    color: white;
  }

  .action-button.pitch {
    background: linear-gradient(135deg, var(--purple-accent), #9333ea);
    color: white;
  }

  .action-button.pdf {
    background: var(--accent-gradient);
    color: white;
  }

  .action-button.sheets {
    background: linear-gradient(135deg, var(--orange-accent), #ea580c);
    color: white;
  }

  .action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  }

  /* =========================================
     Company Cards
     ========================================= */
  .company-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    margin: 8px 0;
    transition: all var(--transition-fast);
    max-width: 100%;
  }

  .company-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0, 220, 130, 0.1);
    transform: translateY(-2px);
  }

  .company-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .company-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .company-badges {
    display: flex;
    gap: 6px;
  }

  .badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .badge.enriched {
    background: rgba(0, 220, 130, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 220, 130, 0.3);
  }

  .badge.pitch {
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple-accent);
    border: 1px solid rgba(168, 85, 247, 0.3);
  }

  .company-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
  }

  .company-detail {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .company-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
  }

  .company-action {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .company-action:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-hover);
  }

  .company-action.replace:hover {
    border-color: var(--red-accent);
    color: var(--red-accent);
    background: rgba(244, 63, 94, 0.1);
  }
}

/* Custom Modifications */

:root {
  --sidebar-item-radius: 12px;
  --accent-teal: #00c091;
  --accent-glow: rgba(0, 192, 145, 0.15);
  --text-main: #2d3436;
  --text-muted: #636e72;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 6px 14px;
  border-radius: var(--sidebar-item-radius);
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
}

/* Hover State - Subtle Lift & Glass Effect */
.history-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 192, 145, 0.2);
  color: var(--text-main);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

/* Active State - Gradient & Soft Glow */
.history-item.active {
  background: linear-gradient(135deg, #00c091 0%, #00a37b 100%);
  color: #ffffff !important;
  border: none;
  box-shadow: 0 8px 20px var(--accent-glow);
  transform: scale(1.02);
}

/* Content Layout */
.history-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.history-title {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Icons styling */
.icon-chat {
  flex-shrink: 0;
  opacity: 0.7;
  transition: var(--transition-smooth);
}

.history-item.active .icon-chat {
  opacity: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Delete Button - Premium Minimalist */
.history-delete {
  background: transparent;
  border: none;
  color: inherit;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-smooth);
}

.history-item:hover .history-delete {
  opacity: 0.6;
}

.history-delete:hover {
  opacity: 1 !important;
  background: rgba(255, 77, 77, 0.1);
  color: #ff4757 !important;
}

.history-item.active .history-delete:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white !important;
}

.input-disclaimer {
  width: 100%;
  text-align: center;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1px;
  white-space: nowrap;
  /* Forces it into one elegant line */
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--disclaimer-text);
}

/* Optional: Add a very faint line above it to anchor it to the bottom */
.input-disclaimer::before {
  content: "";
  display: block;
  width: 30px;
  height: 1px;
  background: var(--disclaimer-line);
  margin: 0 auto 8px;
}

/* Sidebar Signature */
.brand-signature {
  /* margin-top: 16px;
  padding: 12px; */
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-signature span:first-child {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
}

/* Remove default browser link styling */
.brand-signature a {
  text-decoration: none;
  outline: none;
}

/* Add a clean hover effect using your theme's accent color */
.brand-signature a:hover .think-tech-logo {
  color: var(--accent-primary, #00dc82);
}

.think-tech-logo {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-teal);
  /* Using your primary green/teal */
  letter-spacing: -0.02em;
}

/* New Container to hold Logo + Brand text together */
.auth-header-lockup {
  display: flex;
  flex-direction: column;
  /* Stacks them vertically */
  align-items: center;
  /* Centers them horizontally */
  justify-content: center;
  gap: 12px;
  /* Space between Logo and Text */
  margin-bottom: 24px;
  /* Space before "Welcome Back" */
}

/* The "SL" Green Box */
.auth-logo-icon {
  width: 48px;
  height: 48px;
  background: #00c091;
  color: white;
  font-weight: 700;
  font-size: 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 192, 145, 0.3);
}

/* The "Think Technology" Text */
.auth-vendor-tag {
  font-size: 11px;
  color: #94a3b8;
  /* Muted grey */
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.auth-vendor-tag strong {
  font-weight: 600;
  color: #64748b;
  /* Slightly darker for the brand name */
}

/* =========================================
   Premium Upgrade Button (Outlined Style)
   ========================================= */
.upgrade-btn {
  /* Layout Fixes (Prevents stretching) */
  flex: none !important;
  display: flex !important;
  justify-content: center;
  align-items: center;
  max-height: fit-content;
  min-height: 44px;
  margin-top: auto;
  margin-bottom: 8px;
  text-decoration: none;

  /* Your requested style for the default state */
  background: var(--bg-elevated) !important;
  border: 1px solid var(--accent-primary) !important;
  color: var(--accent-primary) !important;

  /* General button styling */
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

/* Hover Effect: Invert to solid accent color with a soft glow */
.upgrade-btn:hover {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
  /* Dark text for high contrast against the bright green */
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 220, 130, 0.3);
}

/* Click/Active Effect */
.upgrade-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 220, 130, 0.2);
}

/* ── Stop Button — Desktop ─────────────────────────────────────────── */
.stop-button {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.07);
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;
  flex-shrink: 0;
}

.stop-button:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.75);
}

.stop-button:active {
  transform: scale(0.96);
}

/* Light mode */
body.light-mode .stop-button {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
}


/* =========================================
   Message Edit Feature
   ========================================= */

/* Make sure the content wrapper can anchor the absolutely positioned button */
.message-content, 
.mobile-message-content {
  position: relative;
}

/* Add padding to the user's bubble so text doesn't run into the icon */
.message-row.user .message-bubble,
.mobile-message.user .mobile-message-bubble {
  padding-right: 20px; 
}

/* ── Edit Button ──────────────────────────────────────────────── */
.msg-edit-btn {
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  
/* Flow normally below the bubble, aligned to the right */
  position: static !important;
  align-self: flex-end; 
  margin: -4px 4px 0 0 !important; /* Pull it slightly closer to the bubble */
  padding: 4px !important;
  
  /* Strip clunky box styles */
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  
  /* Sleek icon color */
  color: rgba(255, 255, 255, 0.6) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-edit-btn svg,
.msg-edit-btn .edit-icon {
  width: 15px;
  height: 15px;
  transition: opacity var(--transition-fast);
}

/* Show on hover or mobile */
.message-row.user:hover .msg-edit-btn,
.msg-edit-btn.mobile,
.msg-edit-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Brighten and slightly scale on hover */
.msg-edit-btn:hover {
  color: #ffffff !important;
  transform: scale(1.15);
  background: transparent !important;
  border-color: transparent !important;
}

.msg-edit-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Focus state for accessibility */
.msg-edit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-primary);
}

/* ── Edit Container ─────────────────────────────────────────────── */
.msg-edit-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  animation: fadeInScale 0.2s var(--ease-out-expo);
}

/* ── Edit Textarea ──────────────────────────────────────────────── */
.msg-edit-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 300px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.msg-edit-textarea::placeholder {
  color: var(--text-tertiary);
}

.msg-edit-textarea:hover {
  border-color: var(--border-hover);
}

.msg-edit-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow:
    0 0 0 4px rgba(0, 220, 130, 0.1),
    var(--shadow-md);
  background: var(--bg-tertiary);
}

/* Character count (optional enhancement) */
.msg-edit-char-count {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: -8px;
}

.msg-edit-char-count.warning {
  color: var(--orange-accent);
}

.msg-edit-char-count.error {
  color: var(--red-accent);
}

/* ── Action Buttons ─────────────────────────────────────────────── */
.msg-edit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.msg-edit-confirm,
.msg-edit-cancel {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

/* Confirm Button - Primary Action */
.msg-edit-confirm {
  background: var(--accent-gradient);
  color: #000;
  box-shadow: var(--shadow-sm);
}

.msg-edit-confirm:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow:
    var(--shadow-md),
    0 4px 20px rgba(0, 220, 130, 0.25);
}

.msg-edit-confirm:active {
  transform: translateY(0) scale(0.98);
}

.msg-edit-confirm:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--bg-primary),
    0 0 0 4px var(--accent-primary);
}

.msg-edit-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Cancel Button - Secondary Action */
.msg-edit-cancel {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.msg-edit-cancel:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.msg-edit-cancel:active {
  transform: translateY(0) scale(0.98);
}

.msg-edit-cancel:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--bg-primary),
    0 0 0 4px var(--text-tertiary);
}

/* ── Loading State ──────────────────────────────────────────────── */
.msg-edit-confirm.loading {
  pointer-events: none;
  position: relative;
}

.msg-edit-confirm.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spinner 0.6s linear infinite;
}

/* ── Light Mode Overrides ───────────────────────────────────────── */
body.light-mode .msg-edit-btn {
  background: transparent !important;
  color: rgba(0, 0, 0, 0.4) !important; /* Darker icon for white bubbles */
}

body.light-mode .msg-edit-btn:hover {
  background: transparent !important;
  color: var(--accent-primary) !important;
  border-color: transparent !important;
}

body.light-mode .msg-edit-textarea {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

body.light-mode .msg-edit-textarea:focus {
  background: #ffffff;
  border-color: var(--accent-primary);
  box-shadow:
    0 0 0 4px rgba(0, 184, 148, 0.12),
    var(--shadow-md);
}

body.light-mode .msg-edit-confirm {
  color: #ffffff;
}

body.light-mode .msg-edit-cancel {
  background: #ffffff;
  border-color: var(--border-color);
}

body.light-mode .msg-edit-cancel:hover {
  background: var(--bg-secondary);
  border-color: var(--border-hover);
}

/* ── Mobile Optimizations ───────────────────────────────────────── */
@media (max-width: 768px) {
  .msg-edit-btn {
    opacity: 1;
    pointer-events: auto;
    padding: 4px !important;
  }

  .msg-edit-container {
    max-width: 100%;
  }

  .msg-edit-textarea {
    font-size: 16px;
    /* Prevents zoom on iOS */
    min-height: 100px;
    padding: 16px;
  }

  .msg-edit-actions {
    flex-direction: row;
    gap: 12px;
  }

  .msg-edit-confirm,
  .msg-edit-cancel {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    justify-content: center;
  }
}

/* ── Reduced Motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .msg-edit-btn,
  .msg-edit-textarea,
  .msg-edit-confirm,
  .msg-edit-cancel {
    transition: none;
  }

  .msg-edit-container {
    animation: none;
  }
}

/* ── High Contrast Mode ─────────────────────────────────────────── */
@media (prefers-contrast: high) {
  .msg-edit-btn,
  .msg-edit-textarea,
  .msg-edit-cancel {
    border-width: 2px;
  }

  .msg-edit-textarea:focus {
    border-width: 3px;
  }
}