/* SmartWheels Mini - IO Selector Tool Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0ea5e9;
    --light-bg: #f8fafc;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    padding-bottom: 20px;
}

.container-fluid {
    padding: 10px;
}

/* Header Styling */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%) !important;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

/* Stamp Columns Container */
.stamp-columns-container {
    margin-top: 10px;
    flex-wrap: nowrap !important;
}

/* Individual Stamp Column */
.stamp-column {
    background: white;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
    min-height: 500px;
    transition: all 0.3s ease;
}

.stamp-column:hover {
    box-shadow: var(--hover-shadow);
}

.stamp-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #475569 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stamp-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.btn-expand {
    position: absolute;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-expand:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    color: white;
    transform: scale(1.1);
}

.btn-expand i {
    font-size: 1.1rem;
}

/* Expanded column state */
.stamp-col.expanded {
    flex: 0 0 60%;
    max-width: 60%;
    transition: all 0.8s ease;
}

.stamp-col.collapsed {
    flex: 0 0 20%;
    max-width: 20%;
    transition: all 0.8s ease;
}

.stamp-col {
    transition: all 0.8s ease;
}

.stamp-body {
    padding: 15px;
}

/* IoType Selector - Two Column Layout */
.iotype-selector,
.variant-selector {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.iotype-selector .form-label,
.variant-selector .form-label {
    flex: 0 0 100px;
    margin-bottom: 0;
    text-align: right;
    padding-right: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.iotype-selector select,
.variant-selector select {
    flex: 1;
}

.iotype-dropdown {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 2px solid var(--info-color);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.iotype-dropdown:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
    background: white;
}

.iotype-dropdown option {
    background: white;
    padding: 10px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Variant Dropdown */
.variant-dropdown {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 2px solid #16a34a;
    color: #15803d;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.variant-dropdown:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.25);
    background: #f0fdf4;
}

.variant-dropdown option {
    background: white;
    padding: 10px;
}

/* Stamp Info Container (Features and Remarks) */
.stamp-info-container {
    animation: fadeIn 0.5s ease-in;
    margin-top: 10px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid var(--info-color);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Two-column layout for stamp features and remarks */
.stamp-features,
.stamp-remarks {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.stamp-features:last-child,
.stamp-remarks:last-child {
    margin-bottom: 0;
}

.stamp-features .form-label,
.stamp-remarks .form-label {
    flex: 0 0 100px;
    margin-bottom: 0;
    text-align: right;
    padding-right: 0.5rem;
    padding-top: 0.4rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.stamp-features-text,
.stamp-remarks-text {
    flex: 1;
    background: white;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.stamp-features-text {
    font-weight: 500;
    min-height: 35px;
    max-height: 70px;
    overflow-y: auto;
    overflow-x: auto;
}

.stamp-remarks-text {
    font-style: italic;
    min-height: 35px;
    max-height: 90px;
    overflow-y: auto;
    overflow-x: auto;
}

/* Custom scrollbar for stamp info */
.stamp-features-text::-webkit-scrollbar,
.stamp-remarks-text::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.stamp-features-text::-webkit-scrollbar-track,
.stamp-remarks-text::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.stamp-features-text::-webkit-scrollbar-thumb,
.stamp-remarks-text::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.stamp-features-text::-webkit-scrollbar-thumb:hover,
.stamp-remarks-text::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Pin Labels Container */
.pin-labels-container {
    animation: fadeIn 0.5s ease-in;
    margin-top: 10px;
}

.pin-labels-container .form-label {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.pin-labels-list {
    margin-top: 8px;
    overflow-x: auto;
    max-width: 100%;
    position: relative;
}

/* Horizontal scrollbar for pin labels table */
.pin-labels-list::-webkit-scrollbar {
    height: 8px;
}

.pin-labels-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.pin-labels-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.pin-labels-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Pins Table */
.pins-table {
    font-size: 0.85rem;
    margin-bottom: 2px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.pins-table thead {
    background: linear-gradient(135deg, var(--info-color) 0%, #6eb9df 100%);
    color: white;
}

.pins-table thead th {
    background: linear-gradient(135deg, var(--info-color) 0%, #6eb9df 100%);
    font-weight: 600;
    padding: 4px 6px;
    border: 1px solid #5ba3c9;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.2;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 10;
}

.pins-table tbody td {
    padding: 2px 6px;
    font-size: 0.8rem;
    line-height: 1.2;
    vertical-align: middle;
    border: 1px solid #e2e8f0;
}

/* Freeze first two columns in header (Conn Pin and Pin Label) */
.pins-table thead th:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 20;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    min-width: 50px;
    width: 50px;
}

.pins-table thead th:nth-child(2) {
    position: sticky;
    left: 50px;
    z-index: 20;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    min-width: 55px;
    width: 55px;
}

.pins-table tbody tr {
    transition: all 0.2s ease;
}

.pins-table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Highlighted rows for selected variant */
.pins-table tbody tr.selected-variant-row {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid var(--info-color);
}

.pins-table tbody tr.selected-variant-row:hover {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
}

.pins-table tbody tr.selected-variant-row .connpin-cell,
.pins-table tbody tr.selected-variant-row .pin-label-cell,
.pins-table tbody tr.selected-variant-row .iotype-cell {
    color: #1e40af;
    font-weight: 700;
    background-color: white !important;
    background-image: none !important;
}

.pins-table tbody tr.selected-variant-row:hover .connpin-cell,
.pins-table tbody tr.selected-variant-row:hover .pin-label-cell,
.pins-table tbody tr.selected-variant-row:hover .iotype-cell {
    background-color: white !important;
    background-image: none !important;
}

.pins-table tbody tr.selected-variant-row .feature-cell {
    color: #1e40af;
    font-weight: 600;
}

.pins-table tbody tr.selected-variant-row .channel-identifier-cell {
    color: #1e40af;
    font-weight: 700;
}

/* Pins Table Column Widths using nth-child */
.pins-table thead th:nth-child(1),
.pins-table tbody td:nth-child(1) { width: 4%; } /* Conn Pin */

.pins-table thead th:nth-child(2),
.pins-table tbody td:nth-child(2) { width: 4%; } /* Pin Label */

.pins-table thead th:nth-child(3),
.pins-table tbody td:nth-child(3) { width: 4%; } /* IO Type */

.pins-table thead th:nth-child(4),
.pins-table tbody td:nth-child(4) { width: 12%; } /* Feature Description */

.pins-table thead th:nth-child(5),
.pins-table tbody td:nth-child(5) { width: 5%; } /* Wire Color */

.pins-table thead th:nth-child(6),
.pins-table tbody td:nth-child(6) { width: 5%; } /* MCU Pin */

.pins-table thead th:nth-child(7),
.pins-table tbody td:nth-child(7) { width: 8%; } /* Channel Identifier */

.pins-table thead th:nth-child(8),
.pins-table tbody td:nth-child(8) { width: 14%; } /* User Label */

.pins-table thead th:nth-child(9),
.pins-table tbody td:nth-child(9) { width: 30%; } /* User Remarks */

.connpin-cell {
    font-weight: 600;
    color: #1e40af;
    padding: 6px 8px;
    position: sticky;
    left: 0;
    background: white !important;
    z-index: 10;
    text-align: center;
}

.pin-label-cell {
    font-weight: 600;
    color: #1e40af;
    padding: 6px 8px;
    position: sticky;
    left: 50px;
    background: white !important;
    z-index: 10;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.iotype-cell {
    font-weight: 500;
    color: #0ea5e9;
    padding: 6px 8px;
    font-size: 0.8rem;
    text-align: center;
}

.feature-cell {
    color: #475569;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.channel-identifier-cell {
    font-weight: 600;
    color: #475569;
    padding: 6px 8px;
    font-size: 0.8rem;
    text-align: center;
}

.wirecolor-cell {
    font-weight: 600;
    color: #1e40af;
    padding: 6px 8px;
    font-size: 0.8rem;
    text-align: center;
}

.mcupin-cell {
    font-weight: 600;
    color: #1e40af;
    padding: 6px 8px;
    font-size: 0.8rem;
    text-align: center;
}

/* Highlighted rows for selected variant - wire color and MCU pin */
.pins-table tbody tr.selected-variant-row .wirecolor-cell {
    color: #1e40af;
    font-weight: 700;
}

.pins-table tbody tr.selected-variant-row .mcupin-cell {
    color: #1e40af;
    font-weight: 700;
}

/* Button Styling */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Alert Styling */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* Scrollbar Styling */
.stamp-body::-webkit-scrollbar {
    width: 8px;
}

.stamp-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.stamp-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.stamp-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stamp-column {
        margin-bottom: 15px;
    }

    .stamp-header h4 {
        font-size: 1.2rem;
    }

    .stamp-body {
        padding: 15px;
    }

    .pin-items {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .variants-table {
        font-size: 0.8rem;
    }
}

/* Loading Spinner */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 15px;
}

/* User input cells in pins table */
.user-label-cell {
    padding: 4px 6px;
}

.user-remarks-cell {
    padding: 4px 6px;
}

.user-label-input {
    width: 100%;
    min-width: 100px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #16a34a;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.user-remarks-input {
    width: 100%;
    min-width: 150px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #16a34a;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.user-label-input:focus,
.user-remarks-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 0.15rem rgba(14, 165, 233, 0.15);
    outline: none;
    background-color: #f0f9ff;
}

/* Very light placeholder text color */
input::placeholder,
textarea::placeholder {
    color: #f1f5f9;
    opacity: 0.6;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: #f1f5f9;
    opacity: 0.6;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
    color: #f1f5f9;
    opacity: 0.6;
}

/* Wire color background styling - only for wire color column */
tr[data-wire-color="orange"] td.wirecolor-cell {
    background-color: orange !important;
    color: black !important;
    font-weight: 600;
}

tr[data-wire-color="grey"] td.wirecolor-cell,
tr[data-wire-color="gray"] td.wirecolor-cell {
    background-color: grey !important;
    color: white !important;
    font-weight: 600;
}

tr[data-wire-color="pink"] td.wirecolor-cell {
    background-color: pink !important;
    color: black !important;
    font-weight: 600;
}

tr[data-wire-color="yellow"] td.wirecolor-cell {
    background-color: yellow !important;
    color: black !important;
    font-weight: 600;
}

tr[data-wire-color="white"] td.wirecolor-cell {
    background-color: white !important;
    color: black !important;
    font-weight: 600;
    border: 1px solid #ccc !important;
}

tr[data-wire-color="purple"] td.wirecolor-cell {
    background-color: purple !important;
    color: white !important;
    font-weight: 600;
}

tr[data-wire-color="green"] td.wirecolor-cell {
    background-color: green !important;
    color: white !important;
    font-weight: 600;
}

tr[data-wire-color="blue"] td.wirecolor-cell {
    background-color: blue !important;
    color: white !important;
    font-weight: 600;
}

tr[data-wire-color="red"] td.wirecolor-cell {
    background-color: red !important;
    color: white !important;
    font-weight: 600;
}

tr[data-wire-color="brown"] td.wirecolor-cell {
    background-color: brown !important;
    color: white !important;
    font-weight: 600;
}

tr[data-wire-color="black"] td.wirecolor-cell {
    background-color: black !important;
    color: white !important;
    font-weight: 600;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
    color: #f1f5f9;
    opacity: 0.6;
}

/* AutoConnector Card Styles */
.autoconnector-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.autoconnector-header {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.autoconnector-header h5 {
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.autoconnector-body {
    padding: 15px;
}

/* AutoConnector Table Container */
.autoconnector-table-container {
    overflow-x: auto;
}

/* AutoConnector Table - styled similar to pins-table */
.autoconnector-table {
    font-size: 0.85rem;
    margin-bottom: 2px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.autoconnector-table thead {
    background: linear-gradient(135deg, var(--info-color) 0%, #6eb9df 100%);
    color: white;
}

.autoconnector-table thead th {
    background: linear-gradient(135deg, var(--info-color) 0%, #6eb9df 100%);
    font-weight: 600;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.3;
    vertical-align: middle;
}

.autoconnector-table tbody tr {
    transition: all 0.2s ease;
}

.autoconnector-table tbody tr:hover {
    background-color: #f1f5f9;
}

.autoconnector-table tbody td {
    padding: 6px 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.autoconnector-table .ac-pin-cell {
    font-weight: 600;
    color: #1e40af;
}

.autoconnector-table .ac-label-cell {
    font-weight: 500;
    color: #7c3aed;
}

.autoconnector-table .ac-mcu-cell {
    font-weight: 600;
    color: #1e40af;
}

.autoconnector-table .ac-user-label-cell,
.autoconnector-table .ac-user-remarks-cell {
    padding: 4px 6px;
}

.ac-user-label-input {
    width: 100%;
    min-width: 70px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #16a34a;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ac-user-remarks-input {
    width: 100%;
    min-width: 150px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #16a34a;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ac-user-label-input:focus,
.ac-user-remarks-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 0.15rem rgba(14, 165, 233, 0.15);
    outline: none;
    background-color: #f0f9ff;
}

/* Wire color styling for autoconnector table */
.autoconnector-table tr[data-wire-color="orange"] td.ac-color-cell {
    background-color: orange !important;
    color: black !important;
}

.autoconnector-table tr[data-wire-color="grey"] td.ac-color-cell,
.autoconnector-table tr[data-wire-color="gray"] td.ac-color-cell {
    background-color: grey !important;
    color: white !important;
}

.autoconnector-table tr[data-wire-color="pink"] td.ac-color-cell {
    background-color: pink !important;
    color: black !important;
}

.autoconnector-table tr[data-wire-color="yellow"] td.ac-color-cell {
    background-color: yellow !important;
    color: black !important;
}

.autoconnector-table tr[data-wire-color="white"] td.ac-color-cell {
    background-color: white !important;
    color: black !important;
    border: 1px solid #ccc !important;
}

.autoconnector-table tr[data-wire-color="purple"] td.ac-color-cell {
    background-color: purple !important;
    color: white !important;
}

.autoconnector-table tr[data-wire-color="green"] td.ac-color-cell {
    background-color: green !important;
    color: white !important;
}

.autoconnector-table tr[data-wire-color="blue"] td.ac-color-cell {
    background-color: blue !important;
    color: white !important;
}

.autoconnector-table tr[data-wire-color="red"] td.ac-color-cell {
    background-color: red !important;
    color: white !important;
}

.autoconnector-table tr[data-wire-color="brown"] td.ac-color-cell {
    background-color: brown !important;
    color: white !important;
}

.autoconnector-table tr[data-wire-color="black"] td.ac-color-cell {
    background-color: black !important;
    color: white !important;
}

/* COM Interfaces Section Styles */
.com-interfaces-section {
    margin-bottom: 1rem;
}

.com-interfaces-section h6,
.other-fixed-pins-section h6 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.com-table .com-protocol-cell {
    font-weight: 500;
    width: 80px;
}

.com-table .com-instance-cell {
    font-weight: 600;
    color: #6a1b9a;
    width: 80px;
}

.com-table .com-pins-cell {
    font-size: 0.85rem;
    color: #666;
}

/* Communication Pins Table (from PinMaster) */
.com-pins-table .form-control-sm {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
}

.badge.bg-purple {
    background-color: #7b1fa2 !important;
}

.com-instance-row:hover {
    background-color: #f3e5f5 !important;
}

.com-user-label-input,
.com-user-remarks-input,
.com-pin-user-label-input,
.com-pin-user-remarks-input {
    border: 1px solid #e0e0e0;
    padding: 0.25rem 0.5rem;
    transition: all 0.15s ease;
    font-weight: 600;
    color: #16a34a;
}

.com-user-label-input:focus,
.com-user-remarks-input:focus,
.com-pin-user-label-input:focus,
.com-pin-user-remarks-input:focus {
    border-color: #7b1fa2;
    box-shadow: 0 0 0 0.2rem rgba(123, 31, 162, 0.15);
}

/* Project Notes Card Styles */
.project-notes-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.project-notes-header {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-notes-header h5 {
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.project-notes-header .btn-light {
    padding: 4px 10px;
    font-size: 0.9rem;
}

.project-notes-body {
    padding: 15px;
}

/* Project Details Section (within project notes card) */
.project-details-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e2e8f0;
}

.project-details-section .form-label {
    color: #475569;
    font-size: 0.8rem;
}

.project-details-section .form-control {
    font-size: 0.85rem;
    font-weight: 600;
    color: #16a34a;
}

.project-details-section .form-control:focus {
    border-color: #059669;
    box-shadow: 0 0 0 0.15rem rgba(5, 150, 105, 0.15);
}

/* Project Notes Table */
.project-notes-table {
    font-size: 0.85rem;
    margin-bottom: 2px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.project-notes-table thead {
    background: linear-gradient(135deg, var(--info-color) 0%, #6eb9df 100%);
    color: white;
}

.project-notes-table thead th {
    background: linear-gradient(135deg, var(--info-color) 0%, #6eb9df 100%);
    font-weight: 600;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.3;
    vertical-align: middle;
}

.project-notes-table thead th:first-child {
    width: 50px;
}

.project-notes-table thead th:last-child {
    width: 40px;
}

.project-notes-table tbody tr {
    transition: all 0.2s ease;
}

.project-notes-table tbody tr:hover {
    background-color: #f1f5f9;
}

.project-notes-table tbody td {
    padding: 6px 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.project-notes-table .note-slno-cell {
    font-weight: 600;
    color: #1e40af;
    width: 50px;
}

.project-notes-table .note-text-cell {
    text-align: left;
    padding: 4px 6px;
}

.project-notes-table .note-action-cell {
    width: 40px;
    padding: 4px;
}

.note-input {
    width: 100%;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #16a34a;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.note-input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 0.15rem rgba(5, 150, 105, 0.15);
    outline: none;
    background-color: #f0fdf4;
}

.btn-delete-note {
    padding: 2px 6px;
    font-size: 0.75rem;
    color: #dc2626;
    background: transparent;
    border: 1px solid #fecaca;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete-note:hover {
    background-color: #fee2e2;
    border-color: #dc2626;
}

.project-notes-empty {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-style: italic;
}

/* Stamp Hardware Card Styles */
.stamp-hardware-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.stamp-hardware-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stamp-hardware-header h5 {
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.stamp-hardware-body {
    padding: 15px;
    text-align: center;
}

.stamp-hardware-img-container {
    position: relative;
    display: inline-block;
}

.stamp-hardware-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hardware-stamp-designators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: 700;
    color: #92400e;
    padding: 2px 6px;
    background: rgba(254, 243, 199, 0.95);
    border-radius: 3px;
    border: 1px solid #fbbf24;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

/* Configuration List Modal - Scrollable container for many configurations */
#configListContainer {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px; /* Space for scrollbar */
}

/* Custom scrollbar styling for configuration list */
#configListContainer::-webkit-scrollbar {
    width: 8px;
}

#configListContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#configListContainer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#configListContainer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Highlight animation for updated configuration */
.config-highlight {
    animation: configPulse 3s ease-in-out;
    border: 3px solid #0d6efd !important;
}

@keyframes configPulse {
    0%, 100% {
        background-color: rgba(13, 110, 253, 0);
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        background-color: rgba(13, 110, 253, 0.25);
        box-shadow: 0 0 25px rgba(13, 110, 253, 0.7);
    }
    20%, 40%, 60%, 80% {
        background-color: rgba(13, 110, 253, 0.15);
        box-shadow: 0 0 15px rgba(13, 110, 253, 0.5);
    }
}

/* Configuration card hover effect */
#configListContainer .card:hover {
    background-color: #f0f7ff;
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
    transition: all 0.2s ease;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablet and below (max-width: 991px) */
@media (max-width: 991px) {
    .container-fluid {
        padding: 5px;
    }

    /* Header adjustments */
    header {
        border-radius: 8px;
    }

    header .col {
        flex: 1;
    }

    header h1 {
        font-size: 1rem !important;
    }

    header h1 #currentConfigName,
    header h1 #stampDesignators {
        display: block !important;
        margin-left: 0 !important;
        margin-top: 4px;
        font-size: 0.75rem !important;
    }

    header .col-auto {
        flex-wrap: wrap;
        gap: 5px;
        justify-content: flex-end;
    }

    header .btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    header .btn .me-1 {
        margin-right: 0 !important;
    }

    header .btn span,
    header #dbEditorBtn span {
        display: none;
    }

    header .user-info {
        display: none !important;
    }

    /* Stamp columns - stack vertically */
    .stamp-columns-container {
        flex-wrap: wrap !important;
    }

    .stamp-col {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .stamp-col.expanded,
    .stamp-col.collapsed {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .stamp-column {
        min-height: auto;
        margin-bottom: 15px;
    }

    .stamp-header h4 {
        font-size: 1.2rem;
    }

    .btn-expand {
        display: none;
    }

    /* Form controls */
    .iotype-selector,
    .variant-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .iotype-selector .form-label,
    .variant-selector .form-label {
        flex: none;
        text-align: left;
        padding-right: 0;
    }

    .stamp-features,
    .stamp-remarks {
        flex-direction: column;
        gap: 0.25rem;
    }

    .stamp-features .form-label,
    .stamp-remarks .form-label {
        flex: none;
        text-align: left;
        padding-right: 0;
        padding-top: 0;
    }

    /* Pin table adjustments */
    .pin-table {
        font-size: 0.75rem;
    }

    .pin-table th,
    .pin-table td {
        padding: 4px 6px;
    }

    .pin-table .user-input {
        font-size: 0.75rem;
        padding: 2px 4px;
    }

    /* AutoConnector and Project Notes - stack */
    .row.mt-3 > .col-lg-5,
    .row.mt-3 > .col-lg-7 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
}

/* Mobile phones (max-width: 576px) */
@media (max-width: 576px) {
    body {
        padding-bottom: 10px;
    }

    .container-fluid {
        padding: 3px;
    }

    /* Header - more compact */
    header {
        padding: 8px !important;
        border-radius: 6px;
        flex-direction: column;
    }

    header .row {
        flex-direction: column;
    }

    header .col {
        text-align: center;
        margin-bottom: 8px;
    }

    header h1 {
        font-size: 0.9rem !important;
    }

    header h1 i.bi-gear-fill {
        display: none;
    }

    header .col-auto {
        width: 100%;
        justify-content: center !important;
    }

    header .btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    /* Hide some buttons on very small screens */
    header #dbEditorBtn {
        display: none !important;
    }

    /* Stamp columns */
    .stamp-column {
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .stamp-header {
        padding: 10px 15px;
        border-radius: 10px 10px 0 0;
    }

    .stamp-header h4 {
        font-size: 1rem;
    }

    .stamp-body {
        padding: 10px;
    }

    /* Form controls */
    .iotype-dropdown,
    .variant-dropdown {
        font-size: 0.85rem;
        padding: 6px 8px;
    }

    .stamp-info-container {
        padding: 8px;
    }

    .stamp-features-text,
    .stamp-remarks-text {
        font-size: 0.8rem;
        padding: 6px 8px;
    }

    /* Pin table - horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pin-table {
        font-size: 0.7rem;
        min-width: 600px;
    }

    .pin-table th,
    .pin-table td {
        padding: 3px 4px;
        white-space: nowrap;
    }

    .pin-table .user-input {
        font-size: 0.7rem;
        min-width: 60px;
    }

    /* Wire color badges */
    .wire-color-badge {
        padding: 1px 4px;
        font-size: 0.65rem;
    }

    /* AutoConnector card */
    .autoconnector-card {
        margin-bottom: 10px;
    }

    .autoconnector-header {
        padding: 10px;
    }

    .autoconnector-header h5 {
        font-size: 0.9rem;
    }

    .autoconnector-body {
        padding: 8px;
    }

    .autoconnector-table {
        font-size: 0.7rem;
    }

    .autoconnector-table th,
    .autoconnector-table td {
        padding: 3px 4px;
    }

    /* Project notes card */
    .project-notes-card {
        margin-bottom: 10px;
    }

    .project-notes-header {
        padding: 10px;
    }

    .project-notes-header h5 {
        font-size: 0.9rem;
    }

    /* Modals */
    .modal-dialog {
        margin: 10px;
    }

    .modal-content {
        border-radius: 10px;
    }

    .modal-header {
        padding: 10px 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 10px 15px;
    }

    /* Config list items */
    .config-list-item {
        padding: 8px;
    }

    .config-list-item h6 {
        font-size: 0.85rem;
    }

    .config-list-item small {
        font-size: 0.7rem;
    }

    .config-list-item .btn-group .btn {
        padding: 2px 6px;
        font-size: 0.7rem;
    }
}

/* Very small phones (max-width: 375px) */
@media (max-width: 375px) {
    header h1 {
        font-size: 0.8rem !important;
    }

    header .btn {
        padding: 4px 6px;
        font-size: 0.65rem;
    }

    .stamp-header h4 {
        font-size: 0.9rem;
    }

    .pin-table {
        font-size: 0.65rem;
    }
}

/* Signal Conditioner Guide Table */
#sc-table-container table td,
#sc-table-container table th {
    border: 2px solid #6c757d;
}
