.form-group{
  display: flex;
  flex-direction: row;
  margin-bottom: 12px;
  width: 100%;

  label{
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 240px;
    padding: 0 8px 0 0;
    font-size: 14px;
    color: var(--text-secondary);
  }

  .form-control{
    align-items: center;
    display: flex;
    flex: 1;
    justify-content: flex-end;
    padding: 0 0 0 8px;
    height: 36px;
    width: 100%;

    color: var(--text-primary);
    background: var(--bg-primary);
    border: var(--border-color) 1px solid;
    outline: none;

  }
}

.form-actions{
    margin-top: 1rem;
    display: flex;
    flex-direction: row;
    gap: .5rem;
    justify-content: end;
}

ul.errorlist{ display: flex; flex-direction: column; width: 100%; list-style: none; }
ul.errorlist li{ color: var(--danger-color); }

/* ========================================
   BUTTON STYLES - Koyfin Layout
   ======================================== */

/* Base Button Styles */
.btn,
button:not(.logout-btn):not(.menu-toggle):not(.theme-toggle):not(.header-btn):not(.toolbar-btn):not(.sidebar-search-clear) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.btn:focus,
button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ========================================
   PRIMARY BUTTONS
   ======================================== */

.btn-primary,
.upgrade-btn {
  background: var(--accent-blue);
  color: #FFF;
  border-color: var(--accent-blue);
}

.btn-primary:hover,
.upgrade-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active,
.upgrade-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ========================================
   SECONDARY BUTTONS
   ======================================== */

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-color-dark);
}

.btn-secondary:active {
  background: var(--bg-tertiary);
}

/* ========================================
   OUTLINE BUTTONS
   ======================================== */

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--border-color-dark);
}

.btn-outline:active {
  background: var(--bg-tertiary);
}

/* ========================================
   SUCCESS BUTTONS
   ======================================== */

.btn-success {
  background: var(--success-color);
  color: var(--white);
  border-color: var(--success-color);
}

.btn-success:hover {
  background: var(--success-hover);
  border-color: var(--success-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-success:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ========================================
   DANGER BUTTONS
   ======================================== */

.btn-danger {
  background: var(--danger-color);
  color: var(--white);
  border-color: var(--danger-color);
}

.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ========================================
   WARNING BUTTONS
   ======================================== */

.btn-warning {
  background: var(--warning-color);
  color: var(--white);
  border-color: var(--warning-color);
}

.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-warning:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ========================================
   INFO BUTTONS
   ======================================== */

.btn-info {
  background: var(--info-color);
  color: var(--white);
  border-color: var(--info-color);
}

.btn-info:hover {
  background: #2563eb;
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-info:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ========================================
   GHOST BUTTONS (Transparent)
   ======================================== */

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-ghost:active {
  background: var(--bg-tertiary);
}

/* ========================================
   HEADER BUTTONS
   ======================================== */

.header-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--bg-hover);
}

.header-btn:active {
  background: var(--bg-tertiary);
}

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

/* ========================================
   TOOLBAR BUTTONS
   ======================================== */

.toolbar-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  font-weight: var(--font-weight-medium);
}

.toolbar-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.toolbar-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.toolbar-btn svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   ICON BUTTONS
   ======================================== */

.btn-icon,
.menu-toggle,
.theme-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.btn-icon:hover,
.menu-toggle:hover,
.theme-toggle:hover {
  background: var(--bg-hover);
}

.btn-icon:active,
.menu-toggle:active,
.theme-toggle:active {
  background: var(--bg-tertiary);
}

.btn-icon svg,
.menu-toggle svg,
.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Icon Button Sizes */
.btn-icon-sm {
  width: 24px;
  height: 24px;
}

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

.btn-icon-lg {
  width: 40px;
  height: 40px;
}

.btn-icon-lg svg {
  width: 24px;
  height: 24px;
}

/* ========================================
   BUTTON SIZES
   ======================================== */

.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
  border-radius: var(--border-radius-sm);
}

.btn-md {
  padding: 8px 16px;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-base);
  border-radius: var(--border-radius);
}

.btn-xl {
  padding: 16px 32px;
  font-size: var(--text-lg);
  border-radius: var(--border-radius-lg);
}

/* ========================================
   BUTTON GROUPS
   ======================================== */

.btn-group {
  display: inline-flex;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

.btn-group .btn,
.btn-group button {
  border-radius: 0;
  margin-left: -1px;
}

.btn-group .btn:first-child,
.btn-group button:first-child {
  border-top-left-radius: var(--border-radius-sm);
  border-bottom-left-radius: var(--border-radius-sm);
  margin-left: 0;
}

.btn-group .btn:last-child,
.btn-group button:last-child {
  border-top-right-radius: var(--border-radius-sm);
  border-bottom-right-radius: var(--border-radius-sm);
}

.btn-group .btn:hover,
.btn-group button:hover {
  z-index: 1;
}

/* ========================================
   LOGOUT BUTTON (Sidebar Footer)
   ======================================== */

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--border-radius-sm);
}

.logout-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.logout-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.logout-text {
  font-weight: var(--font-weight-medium);
}

/* Hide text when sidebar is collapsed */
.sidebar.collapsed .logout-text {
  display: none;
}

/* ========================================
   SPECIAL BUTTONS
   ======================================== */

/* Upgrade Button (Header) */
.upgrade-btn {
  background: var(--accent-blue);
  color: var(--white);
  border: none;
  padding: 6px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all var(--transition-fast);
}

.upgrade-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.upgrade-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Sidebar Search Clear Button */
.sidebar-search-clear {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  font-size: 12px;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-search-clear:active {
  background: var(--bg-tertiary);
}

/* ========================================
   LOADING STATES
   ======================================== */

.btn-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: button-spin 0.6s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   BUTTON WITH ICONS
   ======================================== */

.btn-with-icon-left {
  padding-left: 12px;
}

.btn-with-icon-right {
  padding-right: 12px;
}

.btn svg,
.btn i {
  flex-shrink: 0;
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   BLOCK BUTTONS (Full Width)
   ======================================== */

.btn-block {
  width: 100%;
  display: flex;
}

/* ========================================
   LINK BUTTONS (Look like links)
   ======================================== */

.btn-link {
  background: transparent;
  border: none;
  color: var(--accent-blue);
  padding: 0;
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
  background: transparent;
}

.btn-link:active {
  color: #2563eb;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
  .btn,
  button {
    padding: 8px 14px;
    font-size: var(--text-sm);
  }

  .btn-lg {
    padding: 10px 20px;
    font-size: var(--text-base);
  }

  .toolbar-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .upgrade-btn {
    padding: 5px 12px;
    font-size: 11px;
  }

  /* Stack button groups on mobile */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn,
  .btn-group button {
    width: 100%;
    border-radius: 0;
    margin-left: 0;
    margin-top: -1px;
  }

  .btn-group .btn:first-child,
  .btn-group button:first-child {
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    margin-top: 0;
  }

  .btn-group .btn:last-child,
  .btn-group button:last-child {
    border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus visible for keyboard navigation */
.btn:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  box-shadow: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn,
  button {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .btn,
  button {
    transition: none;
  }

  .btn-loading::after {
    animation: none;
  }
}