/* Modern font import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Use font-size based scaling instead of zoom to avoid positioning issues */
html {
    font-size: 13.6px; /* Down from default 16px (85% scale) */
    overflow-x: auto;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f4f6f8;
    color: #1a1d21;
    letter-spacing: -0.01em;
}

/* Consistent focus treatment (keyboard-friendly) */
button:focus-visible,
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 38, 53, 0.25);
}

svg {
  shape-rendering: geometricPrecision;
}

/* Scale components individually for better control */
.container-fluid {
    max-width: 98%;
    margin: 0 auto;
}

/* Compact spacing */
.row {
    margin-left: -8px;
    margin-right: -8px;
}

.col {
    padding-left: 8px;
    padding-right: 8px;
}

/* Scale dash components appropriately */
.dash-table-container {
    font-size: 0.9rem;
}

.dash-graph {
    margin: 0.5rem 0;
}

/* Keep sliders at normal proportions to maintain tooltip positioning */
.rc-slider {
    margin: 0.5rem 0;
}

.rc-slider-tooltip {
    font-size: 0.5rem;
}

/* Scale input fields */
input[type="number"],
.dash-input {
    font-size: 0.9rem;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="number"]:hover,
.dash-input:hover {
    border-color: #cbd5e1;
}

input[type="number"]:focus,
.dash-input:focus {
    border-color: #8B2635;
    box-shadow: 0 0 0 3px rgba(139, 38, 53, 0.15);
}

/* Scale buttons */
button,
.btn {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    transition: all 0.15s ease;
}

/* Landing page card hover animations */
.landing-card {
    transition: all 0.2s ease, transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.landing-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12) !important;
    border-color: #8B2635 !important;
}

.landing-card:active {
    transform: translateY(-4px) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1) !important;
}

.landing-card-disabled {
    transition: none !important;
    cursor: not-allowed !important;
    filter: grayscale(100%);
    opacity: 0.5;
}

.landing-card-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Conditional disabled (requires loaded cell) - visually distinct from permanent disabled */
/* No grayscale filter - these are "pending" not "unavailable" */
.landing-card-conditional-disabled {
    transition: none !important;
    cursor: not-allowed !important;
    /* Note: NO pointer-events:none here - we need hover for tooltips */
}

.landing-card-conditional-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Login wall styles */
.login-wall-button {
    transition: all 0.2s ease !important;
}

/* Ensure T&C modal and its backdrop render above the login wall (z-index: 9999).
   The backdrop class is scoped so it does NOT affect other modals. */
#terms_modal {
    z-index: 10001 !important;
}

#terms_modal .modal-dialog {
    z-index: 10002 !important;
}

.terms-modal-backdrop {
    z-index: 10000 !important;
}

.login-wall-button:hover {
    background-color: #6D1E29 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(139, 38, 53, 0.35) !important;
}

.login-wall-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(139, 38, 53, 0.25) !important;
}

.login-wall-card {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Scale dropdowns */
.dash-dropdown {
    font-size: 0.9rem;
}

/* dcc.Dropdown (react-select) modern styling */
.Select-control {
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    transition: border-color 0.15s ease !important;
}

.Select-control:hover {
    border-color: #cbd5e1 !important;
}

.is-focused .Select-control {
    border-color: #8B2635 !important;
    box-shadow: 0 0 0 3px rgba(139, 38, 53, 0.15) !important;
}

.Select-menu-outer {
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
    margin-top: 4px !important;
}

.Select-option.is-focused {
    background-color: #f1f5f9 !important;
}

.Select-option.is-selected {
    background-color: #8B2635 !important;
    color: white !important;
}

/* Compact margins */
.mb-3 {
    margin-bottom: 0.8rem !important;
}

.p-3 {
    padding: 0.8rem !important;
}

/* Modern slider styling with accent color */
.rc-slider-rail {
    background-color: #e2e8f0;
    height: 6px;
    border-radius: 3px;
}

.rc-slider-track {
    background: linear-gradient(90deg, #8B2635, #A53545);
    height: 6px;
    border-radius: 3px;
}

.rc-slider-handle {
    border: 2px solid #8B2635;
    background-color: #ffffff;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    box-shadow: 0 2px 4px rgba(139, 38, 53, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rc-slider-handle:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(139, 38, 53, 0.3);
}

.rc-slider-dot {
    border-color: #cbd5e1;
    background-color: #ffffff;
}

.rc-slider-dot-active {
    border-color: #8B2635;
    background-color: #8B2635;
}

.rc-slider-handle:focus,
.rc-slider-handle:active {
    border-color: #8B2635;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(139, 38, 53, 0.2);
    outline: none;
}


/* Warning indicator on the warnings results tab */
.warning-tab-active {
    color: #dc2626 !important;
    background-color: rgba(220, 38, 38, 0.08) !important;
    font-weight: 600 !important;
}

/* Modern pill tabs */
.tab-style {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 4px;
    font-weight: 500;
    position: relative;
}

/* Hover effect */
.tab-style:hover {
    color: #1e293b;
    background-color: #f1f5f9;
}

/* Selected tab */
.tab-selected-style {
    color: #8B2635;
    background-color: rgba(139, 38, 53, 0.1);
    font-weight: 600;
}

/* Modern results tabs */
.results-tab-style {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 4px;
    font-weight: 500;
    position: relative;
}

.results-tab-style:hover {
    color: #1e293b;
    background-color: #f1f5f9;
}

.results-tab-selected-style {
    color: #8B2635;
    background-color: rgba(139, 38, 53, 0.1);
    font-weight: 600;
}

/* Modern tabs container */
.dash-tabs {
    border-bottom: none;
    margin-bottom: 16px;
    background: #f8fafc;
    padding: 4px;
    border-radius: 8px;
    display: inline-flex;
}

/* Results tabs container */
#results-tabs-container {
    background: #f8fafc;
    border-bottom: none;
    margin-bottom: 16px;
    padding: 4px;
    border-radius: 8px;
    display: flex;
    width: 100%;
}


.cell-schematic-button:hover {
    transform: scale(1.05);
}

.cell-schematic-button:active {
    transform: scale(0.98);
}

/* Optimize slider rendering */
.slider-container {
    will-change: transform;
    contain: layout style;
}

/* Optimize input field updates */
input[type="number"] {
    will-change: contents;
}

/* Top-right action menu styling */
.top-right-action-menu .btn,
.top-right-action-menu.btn {
    min-width: 140px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #475569;
    transition: all 0.15s ease;
}

.top-right-action-menu .btn:hover,
.top-right-action-menu.btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.top-right-action-menu .btn:focus,
.top-right-action-menu.btn:focus {
    box-shadow: 0 0 0 3px rgba(139, 38, 53, 0.2);
    border-color: #8B2635;
}

.top-right-action-menu .dropdown-menu {
    min-width: 220px;
    padding: 6px;
    margin-top: 6px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.top-right-action-menu .dropdown-item {
    padding: 10px 14px;
    font-size: 14px;
    color: #1e293b;
    border-radius: 6px;
    transition: all 0.1s ease;
    margin: 2px 0;
}

.top-right-action-menu .dropdown-item:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.top-right-action-menu .dropdown-item:active {
    background-color: #e2e8f0;
    color: #0f172a;
}

.top-right-action-menu .dropdown-item.disabled {
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.5;
}

.top-right-action-menu .dropdown-item.disabled:hover {
    background-color: transparent;
    color: #adb5bd;
}

.top-right-action-menu .dropdown-divider {
    margin: 6px 0;
}

/* Cell card menu styling */
.cell-card-menu .btn {
    padding: 4px 8px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #64748b;
    transition: all 0.15s ease;
    line-height: 1;
}

.cell-card-menu .btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.cell-card-menu .btn:focus {
    box-shadow: 0 0 0 2px rgba(139, 38, 53, 0.2);
    border-color: #8B2635;
}

.cell-card-menu .dropdown-menu {
    min-width: 160px;
    padding: 6px;
    margin-top: 4px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.cell-card-menu .dropdown-item {
    padding: 8px 12px;
    font-size: 14px;
    color: #1e293b;
    border-radius: 5px;
    transition: all 0.1s ease;
}

.cell-card-menu .dropdown-item:hover:not(.disabled) {
    background-color: #f1f5f9;
    color: #0f172a;
}

.cell-card-menu .dropdown-item:active:not(.disabled) {
    background-color: #e2e8f0;
    color: #0f172a;
}

.cell-card-menu .dropdown-item.disabled {
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Cell card menu: Delete item styling */
.cell-card-menu .dropdown-item.text-danger {
    color: #dc2626;
}

.cell-card-menu .dropdown-item.text-danger:hover {
    background-color: #fef2f2;
    color: #b91c1c;
}

/* Reduce repaints during dragging */
.rc-slider {
    will-change: transform;
}

.rc-slider-handle {
    will-change: transform;
}

/* Status message animations */
@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
        visibility: hidden;
    }
}

/* Status message hover effect */
.status-message:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    transition: all 0.2s ease;
}

/* Cell list item hover effects */
.cell-list-item:hover {
    background-color: #f8fafc !important;
    cursor: pointer;
}

.cell-list-item button:hover {
    background: linear-gradient(135deg, #6D1E29, #8B2635) !important;
}

/* Modern cards */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: border-color 0.15s ease;
}

.card:hover {
    border-color: #cbd5e1;
}

/* Primary buttons everywhere - override Bootstrap theme */
.btn-primary {
    background: #8B2635 !important;
    border: none !important;
    font-weight: 600;
    border-color: #8B2635 !important;
    color: #f1f5f9 !important;
}

.btn-primary:hover {
    background: #6D1E29 !important;
    border-color: #6D1E29 !important;
    color: #f1f5f9 !important;
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px rgba(139, 38, 53, 0.3) !important;
    border-color: #8B2635 !important;
}

.btn-primary:active {
    background: #6D1E29 !important;
    border-color: #6D1E29 !important;
}

/* Outline primary buttons */
.btn-outline-primary {
    color: #8B2635 !important;
    border-color: #8B2635 !important;
}

.btn-outline-primary:hover {
    background-color: #8B2635 !important;
    border-color: #8B2635 !important;
    color: #f1f5f9 !important;
}

.btn-outline-primary:active,
.btn-outline-primary:focus {
    background-color: #6D1E29 !important;
    border-color: #6D1E29 !important;
    color: #f1f5f9 !important;
}

/* Form controls */
.form-control {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:hover {
    border-color: #cbd5e1;
}

.form-control:focus {
    border-color: #8B2635;
    box-shadow: 0 0 0 3px rgba(139, 38, 53, 0.15);
}

/* Landing page card link hover (wrapping anchor) */
a:has(.landing-card):hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #8B2635 !important;
}

a:has(.landing-card) {
    text-decoration: none !important;
}

/* ============================== */
/* Unified Modal Styles           */
/* ============================== */

/* Base modal styling - applies to all STEER modals */
.steer-modal .modal-content {
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
}

.steer-modal .modal-header {
    border-bottom: 1px solid #f1f5f9;
    background: transparent;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    padding: 18px 20px;
}

.steer-modal .modal-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
}

.steer-modal .modal-body {
    padding: 20px;
}

.steer-modal .modal-footer {
    border-top: 1px solid #f1f5f9;
    background: transparent;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    padding: 14px 20px;
}

.steer-modal .btn-close {
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.steer-modal .btn-close:hover {
    opacity: 1;
}

/* Modal buttons */
.steer-modal .btn {
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.steer-modal .btn-secondary {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.steer-modal .btn-secondary:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

.steer-modal .btn-primary {
    background: linear-gradient(135deg, #8B2635, #A53545) !important;
    border: none !important;
}

.steer-modal .btn-primary:hover {
    background: linear-gradient(135deg, #6D1E29, #8B2635) !important;
}

.steer-modal .btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border: none;
}

.steer-modal .btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.steer-modal .btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border: none;
}

.steer-modal .btn-success:hover {
    background: linear-gradient(135deg, #15803d, #16a34a);
}

/* Modal form inputs */
.steer-modal .form-control,
.steer-modal input[type="text"],
.steer-modal input[type="number"],
.steer-modal select {
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
}

.steer-modal .form-control:focus,
.steer-modal input[type="text"]:focus,
.steer-modal input[type="number"]:focus,
.steer-modal select:focus {
    border-color: #8B2635;
    box-shadow: 0 0 0 3px rgba(139, 38, 53, 0.15);
    outline: none;
}

.steer-modal .form-control:hover,
.steer-modal input[type="text"]:hover,
.steer-modal input[type="number"]:hover,
.steer-modal select:hover {
    border-color: #cbd5e1;
}

/* Modal error messages */
.steer-modal .modal-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 12px;
}

/* Modal labels */
.steer-modal label {
    font-weight: 700;
    color: #695C47;
    margin-bottom: 6px;
}

/* Modal help text */
.steer-modal .modal-help-text {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 8px;
}

/* Standard modal size (small to medium content) */
.steer-modal.steer-modal-sm .modal-dialog {
    max-width: 420px;
}

/* Large modal (for complex forms) */
.steer-modal.steer-modal-lg .modal-dialog {
    max-width: 800px;
}

/* Extra large modal (for material modals with graphs) */
.steer-modal.steer-modal-xl .modal-dialog {
    max-width: 1140px;
}

/* Modal section dividers */
.steer-modal hr {
    margin: 16px 0;
    border-color: #e2e8f0;
    opacity: 1;
}

/* Modal section headers */
.steer-modal h5 {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
}

/* Modal disabled button state */
.steer-modal .btn:disabled,
.steer-modal .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload area styling for modals */
.steer-modal .upload-area {
    width: 100%;
    height: 64px;
    line-height: 64px;
    border-width: 1px;
    border-style: dashed;
    border-color: #e2e8f0;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 10px;
    background-color: #f8fafc;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.steer-modal .upload-area:hover {
    border-color: #8B2635;
    background-color: #fef7f7;
}

/* Color picker styling for modals */
.steer-modal input[type="color"] {
    width: 72px;
    height: 40px;
    padding: 2px;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Preview container styling for modals */
.steer-modal .preview-container {
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #ffffff;
    padding: 10px;
}
