/* MEMO:
purple-600 is rgb(147, 51, 234)
purple-400 is rgb(192, 132, 252)
DEF: purple-500 is rgb(168, 85, 247)
*/


/* ----------- BG COLORS ------------- */

/* SUBTLE ELEVATION BACKGROUND FOR MAIN COLOR dark:bg-[#111111] */
.fbp-bg-elevated {
    background-color: rgb(250, 250, 250); /* bg-slate-50 - slightly darker than pure white */
}

.dark .fbp-bg-elevated {
    background-color: rgb(26, 26, 26); /* dark:bg-gray-900 - slightly lighter than default dark theme bg */
}


/* Interactive elevation - extends base with hover */
.fbp-bg-elevated-interactive {
    background-color: rgb(250, 250, 250);
}

.dark .fbp-bg-elevated-interactive {
    background-color: rgb(26, 26, 26);
}

.fbp-bg-elevated-interactive:hover {
    background-color: rgb(245, 245, 245);
}

.dark .fbp-bg-elevated-interactive:hover {
    background-color: rgb(31, 31, 31);
}

/* BASE BORDERS */
.fbp-border {
    border: 1px solid rgba(226, 232, 240);  /* gray-200  */
}

.dark .fbp-border {
    border: 1px solid rgba(38, 38, 38);     /* neutral-800 */
}

.fbp-border-r {
    border-right-color: rgba(226, 232, 240);  /* match fbp-border  */
}
.dark .fbp-border-r {
    border-right-color: rgba(38, 38, 38);     /* match fbp-border*/
}

.fbp-border-b {
    border-bottom-color: rgba(226, 232, 240);  /* match fbp-border  */
}
.dark .fbp-border-b {
    border-bottom-color: rgba(38, 38, 38);     /* match fbp-border*/
}

.fbp-border-l {
    border-left-color: rgba(226, 232, 240);  /* match fbp-border  */
}
.dark .fbp-border-l {
    border-left-color: rgba(38, 38, 38);     /* match fbp-border*/
}

.fbp-border-t {
    border-top-color: rgba(226, 232, 240);  /* match fbp-border  */
}
.dark .fbp-border-t {
    border-top-color: rgba(38, 38, 38);     /* match fbp-border*/
}

.fbp-label-outputs {
    color: rgb(37, 99, 235); /* blue-600 */
}

.dark .fbp-label-outputs {
    color: rgb(96, 165, 250); /* blue-400 */
}

.fbp-label-inputs {
    color: rgb(16, 185, 129); /* emerald-600 */
}

.dark .fbp-label-inputs {
    color: rgb(52, 211, 153); /* emerald-400 */
}

/* ---------------- TEXT COLORS ------------- */

/* Primary Text - Headers, Important Content */
.fbp-text-primary {
    color: rgb(15, 23, 42); /* text-slate-900 */
}
.dark .fbp-text-primary {
    color: rgb(248, 250, 252); /* dark:text-slate-50 */
}

/* Secondary Text - Body, Main Content */
.fbp-text-secondary {
    color: rgb(51, 65, 85); /* text-slate-700 */
}
.dark .fbp-text-secondary {
    color: rgb(203, 213, 225); /* dark:text-slate-300 */
}

.fbp-text-error {
    color: rgb(239, 68, 68) !important; /* Same as btn-destructive */
}

.dark .fbp-text-error {
    color: rgb(248, 113, 113) !important; /* Lighter shade for dark mode */
}

/* Muted Text - Subtle text, Helper text */
.fbp-text-muted {
    color: rgb(100, 116, 139); /* text-slate-500 */
}
.dark .fbp-text-muted {
    color: rgb(148, 163, 184); /* dark:text-slate-400 */
}

.fbp-text-brand {
    color: rgb(147, 51, 234); /* purple-600 */
}
.dark .fbp-text-brand {
    color: rgb(168, 85, 247); /* purple-500 */
}


/* ------ FORM INPUTS ------------- */

/* Form Controls Base Styles */
.fbp-input {
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid rgb(226, 232, 240);
    background-color: white;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Complete fbp-textarea styling - form styling + resize + scrollbar */
.fbp-textarea {
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid rgb(226, 232, 240);
    background-color: white;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    resize: vertical !important;
    min-height: 80px;
    /* Brand scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.3) transparent;
}

/* Brand scrollbar webkit styles */
.fbp-textarea::-webkit-scrollbar {
    width: 6px;
}

.fbp-textarea::-webkit-scrollbar-track {
    background: transparent;
}

.fbp-textarea::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.3);
    border-radius: 3px;
}

.fbp-textarea::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.5);
}

.fbp-input::placeholder,
.fbp-textarea::placeholder {
    color: #6b7280;  /* gray-500 */
}

.fbp-input:focus,
.fbp-textarea:focus {
    outline: none;
    border-color: transparent;
    box-shadow: 0 0 0 1px rgb(168, 85, 247);  /* purple-500 */
}

/* Dark mode styles */
.dark .fbp-input,
.dark .fbp-textarea {
    background-color: rgb(17, 17, 17) !important;  /* Same as main dark bg to create contrast */
    border-color: rgb(38, 38, 38) !important;
    color: rgb(229, 231, 235) !important;
}

.dark .fbp-input::placeholder,
.dark .fbp-textarea::placeholder {
    color: #6b7280 !important;  /* gray-500 */
}

.dark .fbp-input:focus,
.dark .fbp-textarea:focus {
    box-shadow: 0 0 0 1px #c084fc !important;  /* purple-400 slightly lighter */
}

/* Dark mode scrollbar for fbp-textarea */
.dark .fbp-textarea {
    scrollbar-color: rgba(156, 163, 175, 0.2) transparent;
}

.dark .fbp-textarea::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.2);
}

.dark .fbp-textarea::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.3);
}

/* Hide number input spinners */
.fbp-input[type="number"]::-webkit-inner-spin-button,
.fbp-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fbp-input[type="number"] {
    -moz-appearance: textfield;
}


/* ---------------------------- */
/* FORM SELECT */
/* ---------------------------- */

.form-select {
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid rgb(226, 232, 240);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background-color: white;
    color: rgb(15, 23, 42);
    
    /* Custom dropdown arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Dark mode select */
.dark .form-select {
    background-color: rgb(17, 17, 17) !important;
    border-color: rgb(38, 38, 38) !important;
    color: rgb(229, 231, 235) !important;
    
    /* Dark mode dropdown arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Select options styling */
.form-select option {
    background-color: white;
    color: rgb(15, 23, 42);
}

.dark .form-select option {
    background-color: rgb(17, 17, 17) !important;
    color: rgb(229, 231, 235);
}

/* Focus state */
.form-select:focus {
    outline: none;
    border-color: transparent;
    box-shadow: 0 0 0 1px rgb(168, 85, 247) !important;  /* purple-500 */
}



/* --------- FILE UPLOAD ZONE ------------- */
.file-upload-zone {
    padding: 1.25rem 1.5rem !important;
    border: 2px dashed rgb(226, 232, 240) !important;
    border-radius: 0.5rem !important;
    cursor: pointer !important;
    transition: border-color 0.2s !important;
    background-color: white;
}

.file-upload-zone:hover {
    border-color: rgb(168, 85, 247) !important;  /* purple-500 */
}

.dark .file-upload-zone {
    background-color: rgb(17, 17, 17) !important;
    border-color: rgb(38, 38, 38) !important;
}

.dark .file-upload-zone:hover {
    border-color: rgb(168, 85, 247) !important; /* purple-500 */
}

/* Form Label */
.form-label {
    display: block !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: rgb(15, 23, 42) !important;
    margin-bottom: 0.5rem !important;
}

.dark .form-label {
    color: rgb(241, 245, 249) !important;
}

/* Help Text */
.form-help-text {
    margin-top: 0.5rem !important;
    font-size: 0.875rem !important;
    color: rgb(100, 116, 139) !important;
}

.dark .form-help-text {
    color: rgb(148, 163, 184) !important;
}

/* Password Input specific */
.fbp-input[type="password"] {
    font-family: monospace !important;
    letter-spacing: 0.25em !important;
}




/* ----------------- */
/* BUTTONS */
/* ----------------- */

/* Base button styles */
.btn {
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
}

/* Primary button */
.btn-primary {
    background-color: rgb(168, 85, 247) !important; /* purple-500 */
    color: white !important;
}

.btn-primary:hover {
    background-color: rgb(147, 51, 234) !important; /* purple-600 */
}

/* Secondary button */
.btn-secondary {
    background-color: rgb(241, 245, 249) !important;
    color: rgb(15, 23, 42) !important;
    border: 1px solid rgb(226, 232, 240) !important;
}

.btn-secondary:hover {
    background-color: rgb(226, 232, 240) !important;
}

/* Success button */
.btn-success {
    background-color: rgb(16, 185, 129) !important;
    color: white !important;
}

.btn-success:hover {
    background-color: rgb(4, 120, 87) !important;
}

/* Warning button */
.btn-warning {
    background-color: rgb(245, 158, 11) !important;
    color: white !important;
}

.btn-warning:hover {
    background-color: rgb(217, 119, 6) !important;
}

/* Destructive/Danger button */
.btn-destructive {
    background-color: rgb(239, 68, 68) !important;
    color: white !important;
}

.btn-destructive:hover {
    background-color: rgb(220, 38, 38) !important;
}

/* Info button */
.btn-info {
    background-color: rgb(14, 165, 233) !important; /* sky-500 */
    color: white !important;
}

.btn-info:hover {
    background-color: rgb(2, 132, 199) !important; /* sky-600 */
}

/* Outlined variants */
.btn-outlined {
    background-color: transparent !important;
    border: 1px solid currentColor !important;
}

.btn-outlined.btn-primary {
    color: rgb(99, 102, 241) !important;
    border-color: rgb(99, 102, 241) !important;
    background-image: none !important;
}

.btn-outlined.btn-primary:hover {
    background-color: rgb(99, 102, 241, 0.1) !important;
}

.btn-outlined.btn-success {
    color: rgb(16, 185, 129) !important;
    border-color: rgb(16, 185, 129) !important;
}

.btn-outlined.btn-success:hover {
    background-color: rgb(16, 185, 129, 0.1) !important;
}

.btn-outlined.btn-warning {
    color: rgb(245, 158, 11) !important;
    border-color: rgb(245, 158, 11) !important;
}

.btn-outlined.btn-warning:hover {
    background-color: rgb(245, 158, 11, 0.1) !important;
}

.btn-outlined.btn-destructive {
    color: rgb(239, 68, 68) !important;
    border-color: rgb(239, 68, 68) !important;
}

.btn-outlined.btn-destructive:hover {
    background-color: rgb(239, 68, 68, 0.1) !important;
}

/* Small variant */
.btn-sm {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.75rem !important;
}

/* Icon button */
.btn-icon {
    display: inline-block !important;
    width: 1rem !important;
    height: 1rem !important;
    flex-shrink: 0 !important;
    color: currentColor !important;
    transition: transform 0.2s !important;
}

/* Dark mode icon adjustments */
.dark .btn-icon {
    color: currentColor !important;
}

/* Button with icon spacing */
.btn svg {
    margin-right: 0.25rem !important; /* Consistent spacing between icon and text */
}

/* Icon size variations */
.btn-sm .btn-icon {
    width: 0.875rem !important;
    height: 0.875rem !important;
}

/* Optional: Add subtle animation on button hover */
.btn:hover .btn-icon {
    transform: translateY(-1px) !important;
}

/* Dark mode variants */
.dark .btn-secondary {
    background-color: rgb(30, 41, 59) !important;
    color: rgb(241, 245, 249) !important;
    border-color: rgb(51, 65, 85) !important;
}

.dark .btn-secondary:hover {
    background-color: rgb(51, 65, 85) !important;
}

.dark .btn-ghost {
    color: rgb(241, 245, 249) !important;
}

.dark .btn-ghost:hover {
    background-color: rgb(30, 41, 59) !important;
}

/* Dark mode outlined variants */
.dark .btn-outlined.btn-primary {
    color: rgb(139, 92, 246) !important;
    border-color: rgb(139, 92, 246) !important;
}

.dark .btn-outlined.btn-success {
    color: rgb(52, 211, 153) !important;
    border-color: rgb(52, 211, 153) !important;
}

.dark .btn-outlined.btn-warning {
    color: rgb(251, 191, 36) !important;
    border-color: rgb(251, 191, 36) !important;
}

.dark .btn-outlined.btn-destructive {
    color: rgb(248, 113, 113) !important;
    border-color: rgb(248, 113, 113) !important;
}

/* Disabled state */
.btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Focus states */
.btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 1px rgb(168, 85, 247), 0 0 0 4px white !important;  /* purple-500 for ring */
}

.dark .btn:focus {
    box-shadow: 0 0 0 1px rgb(168, 85, 247), 0 0 0 4px rgb(17, 17, 17) !important;  /* purple-500 ring, #111111 outer */
}


/* ----------------- */
/* SCROLL BARS */
/* ----------------- */

.fbp-scrollbar::-webkit-scrollbar {
    width: 6px;
  }
  
  .fbp-scrollbar::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .fbp-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.3);
    border-radius: 3px;
  }

  .fbp-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.5);
  }

  .dark .fbp-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.2);
  }

  .dark .fbp-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.3);
  }


/* ----------------- */
/* CARDS */
/* ----------------- */
.fbp-card {
    background-color: rgb(250, 250, 250);  /* Matches fbp-bg-elevated */
    border: 1px solid rgb(226, 232, 240);  /* Subtle border for definition */
    border-radius: 0.5rem;  /* Rounded corners for a modern look */
    /* padding: 1rem;  Consistent padding for content spacing */
}

.dark .fbp-card {
    background-color: rgb(26, 26, 26);  /* Dark mode background */
    border-color: rgb(38, 38, 38);  /* Dark mode border */
}


/* ----------------- */
/* LINKS */
/* ----------------- */

.fbp-link {
    color: rgb(15, 23, 42); /* text-slate-900 */
}

.dark .fbp-link {
    color: rgb(241, 245, 249); /* dark:text-slate-100 */
}

.fbp-link:hover {
    color: rgb(168, 85, 247); /* hover:text-purple-500 */
    transition-property: color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.dark .fbp-link:hover {
    color: rgb(168, 85, 247); /* dark:hover:text-purple-500 */
}


/* ----------------- */
/* SPINNERS */
/* ----------------- */

/* Base spinner - exactly matching Tailwind's animate-spin + border-b-2 style */
.fbp-spinner {
    width: 3rem;  /* h-12 */
    height: 3rem; /* w-12 */
    border-radius: 9999px;  /* rounded-full */
    border: 0;  /* reset all borders */
    border-bottom: 2px solid rgb(168, 85, 247);  /* border-b-2 border-purple-500 */
    animation: fbp-spin 1s linear infinite;
}

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

/* Small variant */
.fbp-spinner-sm {
    width: 2rem;  /* h-8 */
    height: 2rem; /* w-8 */
}

/* Large variant */
.fbp-spinner-lg {
    width: 4rem;  /* h-16 */
    height: 4rem; /* w-16 */
}

/* Dark mode support */
.dark .fbp-spinner {
    border-bottom-color: rgb(168, 85, 247);  /* purple-500 */
}


/* ---------- CODE BLOCKS ------------- */
.fbp-code-block {
    background-color: rgb(17, 17, 17);  /* Same as our dark:bg-[#111111] */
}

.dark .fbp-code-block {
    background-color: rgb(0, 0, 0);     /* Slightly darker in dark mode */
}

.fbp-code-text {
    color: rgb(226, 232, 240);          /* Light gray for readability */
}

.dark .fbp-code-text {
    color: rgb(229, 231, 235);          /* Dark mode - gray-200 for better readability */
}



/* ----------------- */
/* RANGE INPUTS */
/* ----------------- */

.fbp-form-range {
    width: 100%;
    height: 8px;
    border-radius: 0.5rem;
    appearance: none;
    cursor: pointer;
    background-color: rgb(226, 232, 240);  /* Matches existing form input border color */
}

.dark .fbp-form-range {
    background-color: rgb(38, 38, 38);  /* Matches dark mode form input border color */
}

/* Range input track */
.fbp-form-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    border-radius: 0.5rem;
    background: linear-gradient(
        to right, 
        rgb(168, 85, 247) var(--range-progress),  /* purple-500 - matches primary color */
        rgb(226, 232, 240) var(--range-progress)
    );
}

.dark .fbp-form-range::-webkit-slider-runnable-track {
    background: linear-gradient(
        to right, 
        rgb(168, 85, 247) var(--range-progress),  /* purple-500 - matches dark mode accent */
        rgb(38, 38, 38) var(--range-progress)
    );
}

/* Range input thumb */
.fbp-form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgb(168, 85, 247);  /* purple-500 */
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: -4px;
}

.dark .fbp-form-range::-webkit-slider-thumb {
    background: rgb(168, 85, 247);  /* purple-500 */
    border-color: rgb(17, 17, 17);  /* Matches dark mode background */
}

/* Firefox styles */
.fbp-form-range::-moz-range-track {
    width: 100%;
    height: 8px;
    border-radius: 0.5rem;
    background: linear-gradient(
        to right, 
        rgb(168, 85, 247) var(--range-progress),
        rgb(226, 232, 240) var(--range-progress)
    );
}

.dark .fbp-form-range::-moz-range-track {
    background: linear-gradient(
        to right, 
        rgb(168, 85, 247) var(--range-progress),
        rgb(38, 38, 38) var(--range-progress)
    );
}

.fbp-form-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgb(168, 85, 247);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .fbp-form-range::-moz-range-thumb {
    background: rgb(168, 85, 247);
    border-color: rgb(17, 17, 17);
}


/* ----------------- */
/* TOGGLE SWITCHES */
/* ----------------- */

.fbp-toggle-bg {
    transition: background-color 0.3s ease-in-out;
}

.fbp-toggle-input:checked + .fbp-toggle-bg {
    background-color: rgb(168, 85, 247);  /* purple-500 */
}

.dark .fbp-toggle-input:checked + .fbp-toggle-bg {
    background-color: rgb(168, 85, 247);  /* purple-500 */
}

.fbp-toggle-input:checked + .fbp-toggle-bg + .fbp-toggle-dot {
    transform: translateX(100%);
}

.fbp-toggle-input:focus + .fbp-toggle-bg {
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);  /* purple-500 with opacity */
}

.dark .fbp-toggle-input:focus + .fbp-toggle-bg {
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);  /* purple-500 with opacity */
}


/* ----------------- */
/* TABLES */
/* <table class="fbp-table"> */
/* ----------------- */

.fbp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    /* Subtle rounded corners for the whole table */
    border-radius: 0.5rem;
    /* Matching your existing border style */
    border: 1px solid rgb(226, 232, 240);
}

/* Header styling */
.fbp-table thead tr {
    background-color: rgb(245, 245, 245);  /* Slightly darker than fbp-bg-elevated */
}

.fbp-table th {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    color: rgb(51, 65, 85);  /* Matches fbp-text-secondary */
    border-bottom: 1px solid rgb(226, 232, 240);
}

/* Body styling */
.fbp-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: rgb(15, 23, 42);  /* Matches fbp-text-primary */
    border-bottom: 1px solid rgb(226, 232, 240);
}

/* Row hover effect */
.fbp-table tbody tr:hover {
    background-color: rgb(245, 245, 245);  /* Matches fbp-bg-elevated-interactive hover */
}

/* Last row - no border */
.fbp-table tr:last-child td {
    border-bottom: none;
}

/* Dark mode variants */
.dark .fbp-table {
    border-color: rgb(38, 38, 38);  /* Matches your dark border color */
}

.dark .fbp-table thead tr {
    background-color: rgb(22, 22, 22);  /* Slightly darker than dark fbp-bg-elevated */
}

.dark .fbp-table th {
    color: rgb(203, 213, 225) !important;  /* Matches dark fbp-text-secondary */
    border-bottom-color: rgb(38, 38, 38);
}

.dark .fbp-table td {
    color: rgb(248, 250, 252) !important;  /* Matches dark fbp-text-primary */
    border-bottom-color: rgb(38, 38, 38);
}

.dark .fbp-table tbody tr:hover {
    background-color: rgb(31, 31, 31);  /* Matches dark fbp-bg-elevated-interactive hover */
}

/* Data block hover (Inputs/Outputs in execution timeline) */
.fbp-data-block {
    transition: background-color 0.15s ease;
}

.fbp-data-block:hover {
    background-color: rgb(245, 245, 245);
}

.dark .fbp-data-block:hover {
    background-color: rgb(31, 31, 31);
}

.node-item:hover {
    background-color: rgb(245, 245, 245);
}

.dark .node-item:hover {
    background-color: rgb(31, 31, 31);
}