/* =====================================================================
   Commodities Control System — unified visual language for all controls
   ===================================================================== */

/* Base control */
.ctl {
    height: 2.25rem;
    padding: 0 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap;
}

/* Button variants */
.ctl--btn {
    background: transparent;
    border: 1px solid #374151;
    color: #e5e7eb;
}
.ctl--btn:hover {
    border-color: #2563eb;
    color: #fff;
}

.ctl--btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: 1px solid #3b82f6;
    color: #fff;
}
.ctl--btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-color: #60a5fa;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}
.ctl--btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.ctl--btn-secondary {
    background: transparent;
    border: 1px solid #374151;
    color: #cbd5e1;
}
.ctl--btn-secondary:hover {
    background-color: #374151;
    color: #fff;
    border-color: #6b7280;
    box-shadow: 0 0 8px rgba(107, 114, 128, 0.3);
    transform: translateY(-1px);
}
.ctl--btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 0 4px rgba(107, 114, 128, 0.2);
}

/* Toggle button (indicator/mode buttons) */
.ctl--toggle {
    background: transparent;
    border: 1px solid #374151;
    color: #94a3b8;
}
.ctl--toggle:hover {
    border-color: #4b5563;
    color: #e5e7eb;
}
.ctl--toggle.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* Segmented control group */
.ctl--segmented {
    display: inline-flex;
}
.ctl--segmented .ctl {
    border-radius: 0;
    border-right: none;
}
.ctl--segmented .ctl:first-child {
    border-radius: 8px 0 0 8px;
}
.ctl--segmented .ctl:last-child {
    border-radius: 0 8px 8px 0;
    border-right: 1px solid #374151;
}
.ctl--segmented .ctl.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    /* Restore right border visibility for adjacent active segments */
    border-right: 1px solid #1d4ed8;
}
.ctl--segmented .ctl.active + .ctl {
    border-left: none;
}

/* Select / Input */
.ctl--select,
.ctl--input {
    height: 2.25rem;
    padding: 0 2rem 0 0.75rem;
    background: #1f2937;
    border: 2px solid #374151;
    color: #f9fafb;
    border-radius: 8px;
    font-size: 0.875rem;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
}
.ctl--select:focus,
.ctl--input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

/* Row container */
.ctl-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Commodities form row — top-aligned vertical rhythm.
   Replaces align-items-end on multi-leg form rows where label/input
   baseline drift occurs due to mixed helper-text heights. */
.cform {
    align-items: flex-start;
}

/* Align segmented pill buttons to Bootstrap .form-control height inside input-groups.
   Covers both futures hedge-ratio and multi-leg ratio controls.
   align-self:stretch opts into Bootstrap's stretch context;
   height:100% on buttons fills the stretched container (reliable for type=number inputs). */
.input-group > .ctl--segmented {
    align-self: stretch;
    display: flex;
    align-items: stretch;
}
.input-group > .ctl--segmented .ctl {
    height: 100%;
    min-height: 0;
}

/* Plugin fallback warning badge — overrides Bootstrap badge defaults */
.badge--warning {
    background-color: #fbbf24;
    color: #0b1120;
}
