/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    color: #e0e6ff;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #1a1f3a;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid #2d3561;
}

/* Header */
.header {
    background: linear-gradient(rgba(10, 14, 39, 0.3), rgba(10, 14, 39, 0.6)), url('images/hero-banner.png');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 100px 20px 20px 20px;
    text-align: center;
    border-bottom: 3px solid #5568d3;
    position: relative;
    overflow: hidden;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
}

.logo-top-left {
    position: absolute;
    top: 30px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.logo-top-left img {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-top-left span {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.header h1 {
    /* Visually hide the text since it's in the image, but keep for SEO/Structure if needed, 
       OR just style it to blend or be minimized. 
       Given the image has big text, let's hide the HTML text significantly or make it screen-reader only */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.header p {
    background: rgba(10, 14, 39, 0.8);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(5px);
    opacity: 0.95;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    z-index: 1;
    margin-top: auto;
    max-width: 600px;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: #141829;
    border-bottom: 2px solid #2d3561;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 18px 20px;
    background: transparent;
    border: none;
    color: #a0aaf7;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    position: relative;
}

.tab-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #e0e6ff;
}

.tab-btn.active {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Controls (MCU Tab) */
.controls {
    padding: 30px;
    background: #141829;
    border-bottom: 2px solid #2d3561;
}

.control-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-group {
    flex: 1;
    min-width: 250px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #a0aaf7;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select,
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    background: #0a0e27;
    border: 2px solid #2d3561;
    border-radius: 8px;
    color: #e0e6ff;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

select:focus,
input:focus {
    outline: none;
    border-color: #667eea;
    background: #0f1229;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select:hover,
input:hover {
    border-color: #4c5fd5;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    background: #0a0e27;
    border: 2px solid #2d3561;
    color: #a0aaf7;
    border-radius: 24px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-btn:hover {
    border-color: #667eea;
    background: #1a1f3a;
    color: #e0e6ff;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Content */
.content {
    padding: 30px;
    background: #1a1f3a;
}

.section-title {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 30px;
    font-weight: 700;
}

/* Pinout Display (from original) */
.pinout-display {
    background: #0a0e27;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    border: 1px solid #2d3561;
}

.board-diagram {
    background: #141829;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 30px;
    align-items: flex-start;
    border: 1px solid #2d3561;
}

.pin-details {
    background: #141829;
    border-radius: 12px;
    padding: 25px;
    margin-top: 25px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid #2d3561;
}

.no-selection {
    text-align: center;
    color: #6c7293;
    padding: 40px;
    font-style: italic;
    font-size: 15px;
}

.legend {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
    padding: 18px;
    background: #141829;
    border-radius: 8px;
    border: 1px solid #2d3561;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #a0aaf7;
    font-weight: 500;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #2d3561;
}

.color-power {
    background: #e74c3c;
}

.color-ground {
    background: #34495e;
}

.color-gpio {
    background: #3498db;
}

.color-analog {
    background: #2ecc71;
}

.color-communication {
    background: #9b59b6;
}

.color-special {
    background: #f39c12;
}

/* MCU Pinout Diagram Specific Styles */
.board-image-section {
    flex: 1;
    max-width: 400px;
}

.board-image-section img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    border: 2px solid #2d3561;
}

.board-image-section h4 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 18px;
    font-weight: 700;
}

/* SVG Overlay Styles for Interactivity */
.pin-overlay-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.interactive-pin {
    pointer-events: all;
    cursor: pointer;
    fill: rgba(102, 126, 234, 0);
    stroke: transparent;
    transition: all 0.2s ease;
}

.esp32-board {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.board-body {
    background: #0a0e27;
    border-radius: 12px;
    padding: 20px 40px;
    position: relative;
    border: 2px solid #2d3561;
}

.board-label {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pins-container {
    display: flex;
    justify-content: space-between;
    gap: 40px;
}

.pin-column {
    flex: 1;
}

.pin {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    padding: 6px 10px;
    background: #1a1f3a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #2d3561;
}

.pin:hover {
    background: #252b4d;
    transform: translateX(4px);
    border-color: #667eea;
}

.pin.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scale(1.02);
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    position: relative;
}

/* Option 1: Selection Arrow */
.pin.highlight::after {
    content: '➔';
    position: absolute;
    font-size: 20px;
    color: #ffd700;
    /* Gold color for high visibility */
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    pointer-events: none;
    z-index: 10;
}

/* Left column pins: Arrow on the outer left pointing right at the hole */
.pin.highlight.left::after {
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    animation: arrowBounceRight 0.6s infinite alternate ease-in-out;
}

/* Right column pins: Arrow on the outer right pointing left at the hole */
.pin.highlight.right::after {
    right: -30px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    animation: arrowBounceLeft 0.6s infinite alternate ease-in-out;
}

@keyframes arrowBounceRight {
    from {
        transform: translateY(-50%) translateX(0);
    }

    to {
        transform: translateY(-50%) translateX(8px);
    }
}

@keyframes arrowBounceLeft {
    from {
        transform: translateY(-50%) rotate(180deg) translateX(0);
    }

    to {
        transform: translateY(-50%) rotate(180deg) translateX(8px);
    }
}

.pin.left {
    flex-direction: row;
}

.pin.right {
    flex-direction: row-reverse;
}

.pin-hole {
    width: 10px;
    height: 10px;
    border: 2px solid #667eea;
    border-radius: 50%;
    margin: 0 8px;
    flex-shrink: 0;
}

/* Color coding for different pin types */
.pin[data-type="power"] .pin-hole {
    background: #e74c3c;
    border-color: #e74c3c;
}

.pin[data-type="ground"] .pin-hole {
    background: #34495e;
    border-color: #7f8c8d;
}

.pin[data-type="gpio"] .pin-hole {
    background: #3498db;
    border-color: #3498db;
}

.pin[data-type="analog"] .pin-hole {
    background: #2ecc71;
    border-color: #2ecc71;
}

.pin[data-type="communication"] .pin-hole {
    background: #9b59b6;
    border-color: #9b59b6;
}

.pin[data-type="special"] .pin-hole {
    background: #f39c12;
    border-color: #f39c12;
}

.pin-info {
    flex: 1;
}

.pin.left .pin-info {
    text-align: left;
}

.pin.right .pin-info {
    text-align: right;
}

/* Block Layout Styles */
.blocks-board {
    flex: 2;
    max-width: 900px;
}

.blocks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 10px;
}

.pin-block {
    background: #141829;
    border-radius: 8px;
    border: 1px solid #2d3561;
    overflow: hidden;
    height: fit-content;
}

.block-header {
    background: linear-gradient(90deg, #2d3561 0%, #1a1f3a 100%);
    padding: 10px 12px;
    font-size: 11px;
    font-weight: bold;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2d3561;
}

.block-pins {
    padding: 8px;
}

.pin-block .pin {
    flex-direction: row !important;
    margin-bottom: 4px;
}

.pin-block .pin .pin-info {
    text-align: left !important;
    min-width: 0;
    flex: 1;
}

.pin-label {
    color: #e0e6ff;
    font-weight: bold;
    font-size: 12px;
}

.pin-function {
    color: #a0aaf7;
    font-size: 10px;
    margin-top: 2px;
}

.pin-details h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.detail-item {
    padding: 14px;
    background: #1a1f3a;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    border: 1px solid #2d3561;
}

.detail-label {
    font-weight: 600;
    color: #a0aaf7;
    font-size: 12px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: #e0e6ff;
    font-size: 15px;
    font-weight: 500;
}

/* Components Section */
.search-bar {
    margin-bottom: 25px;
}

.search-bar input {
    width: 100%;
    max-width: 500px;
    padding: 14px 20px;
    font-size: 16px;
}

.component-categories {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 12px 24px;
    background: #0a0e27;
    border: 2px solid #2d3561;
    color: #a0aaf7;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.category-btn:hover {
    border-color: #667eea;
    background: #141829;
    transform: translateY(-2px);
}

.category-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.calc-category-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.calc-category-content.active {
    display: block;
}

/* Image Utilities Tab Layout */
.image-utils-tab-container {
    display: grid;
    grid-template-columns: 1fr 900px 1fr;
    gap: 30px;
    align-items: flex-start;
    padding: 20px 0;
}

@media (max-width: 1400px) {
    .image-utils-tab-container {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .image-utils-ad-gutter {
        display: none;
    }
}

.image-utils-ad-gutter {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.04) 50%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-height: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #4b5482;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    padding: 20px;
    position: sticky;
    top: 20px;
}

.image-utils-ad-gutter::after {
    content: 'Premium Ad Placement';
    margin-top: 15px;
    font-size: 9px;
    opacity: 0.5;
}

/* Horizontal Ad Banner */
.ad-banner {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.04) 50%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    height: 120px;
    margin: 25px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #4b5482;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    width: 100%;
}

.ad-banner::after {
    content: 'Premium Ad Placement';
    margin-top: 8px;
    font-size: 9px;
    opacity: 0.5;
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.image-utils-content {
    background: #0d1127;
    border-radius: 16px;
    border: 1px solid #2d3561;
    overflow: hidden;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.converter-grid {
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.grid-2-col-resp {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-4-col-resp {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

@media (max-width: 768px) {

    .grid-2-col-resp,
    .grid-4-col-resp {
        grid-template-columns: 1fr !important;
    }
}

.image-utils-nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    background: #1a1f3a;
    padding: 20px;
    border-bottom: 1px solid #2d3561;
}

.image-utils-nav-item {
    color: #e0e6ff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.image-utils-nav-item:hover {
    color: #667eea;
}

.image-utils-nav-item.active {
    color: #667eea;
    font-weight: 700;
}

.image-utils-nav-item::after {
    content: '⌵';
    font-size: 14px;
    opacity: 0.7;
}

.image-utils-feature-pane {
    padding: 30px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.image-utils-feature-pane.active {
    display: block;
}



.components-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.component-card {
    background: #0a0e27;
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #2d3561;
    transition: all 0.3s;
    cursor: pointer;
}

.component-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.component-card h3 {
    color: #667eea;
    font-size: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.component-card .icon {
    font-size: 28px;
}

.component-card p {
    color: #a0aaf7;
    margin-bottom: 15px;
    font-size: 14px;
}

.component-specs {
    display: grid;
    gap: 8px;
    margin-top: 15px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #141829;
    border-radius: 6px;
    font-size: 13px;
}

.spec-label {
    color: #8891b8;
    font-weight: 600;
}

.spec-value {
    color: #e0e6ff;
}

.component-types {
    font-size: 12px;
    color: #6c7293;
    margin-top: 10px;
}

/* Circuit Grid */
.circuit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

.circuit-card {
    background: #0a0e27;
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #2d3561;
    transition: all 0.3s;
}

.circuit-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

.circuit-card h3 {
    color: #667eea;
    font-size: 18px;
    margin-bottom: 10px;
}

.circuit-description {
    color: #a0aaf7;
    margin-bottom: 15px;
    font-size: 14px;
}

.circuit-components {
    background: #141829;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.circuit-components strong {
    color: #8891b8;
    font-size: 12px;
    display: block;
    margin-bottom: 6px;
}

.circuit-components ul {
    list-style: none;
    padding-left: 0;
}

.circuit-components li {
    color: #e0e6ff;
    font-size: 13px;
    padding: 4px 0;
}

.circuit-components li::before {
    content: 'â€¢ ';
    color: #667eea;
    font-weight: bold;
}

.circuit-schematic {
    background: #0f1229;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    font-family: monospace;
    font-size: 12px;
    color: #e0e6ff;
    overflow-x: auto;
}

/* Calculators */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.calculator-card {
    background: #0a0e27;
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #2d3561;
}

.calculator-card h3 {
    color: #667eea;
    font-size: 20px;
    margin-bottom: 10px;
}

.calc-description {
    color: #8891b8;
    font-size: 14px;
    margin-bottom: 20px;
}

.calc-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    color: #a0aaf7;
    text-transform: none;
}

.input-group small {
    color: #6c7293;
    font-size: 11px;
}

.calc-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.calc-result {
    margin-top: 20px;
    padding: 15px;
    background: #141829;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    display: none;
}

.calc-result.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.calc-result h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 16px;
}

.calc-result p {
    color: #e0e6ff;
    margin: 5px 0;
    font-size: 14px;
}

.calc-result strong {
    color: #a0aaf7;
}

/* Vendor Section */
.vendor-section {
    margin-bottom: 40px;
}

.vendor-section h3 {
    color: #667eea;
    font-size: 22px;
    margin-bottom: 20px;
}

.vendor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.vendor-card {
    background: #0a0e27;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #2d3561;
    transition: all 0.3s;
}

.vendor-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.vendor-card h4 {
    color: #e0e6ff;
    font-size: 18px;
    margin-bottom: 8px;
}

.vendor-card p {
    color: #a0aaf7;
    font-size: 13px;
    margin: 4px 0;
}

.vendor-card a {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.vendor-card a:hover {
    background: #5568d3;
    transform: scale(1.05);
}

/* Buying Tips */
.buying-tips {
    margin-top: 40px;
}

.buying-tips h3 {
    color: #667eea;
    font-size: 22px;
    margin-bottom: 20px;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.tip-card {
    background: #0a0e27;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #667eea;
}

.tip-card h4 {
    color: #667eea;
    font-size: 16px;
    margin-bottom: 12px;
}

.tip-card ul {
    list-style: none;
    padding: 0;
}

.tip-card li {
    color: #a0aaf7;
    font-size: 14px;
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
}

.tip-card li::before {
    content: 'âœ“';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 14, 39, 0.95);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
    background: #1a1f3a;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 2px solid #667eea;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #e0e6ff;
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #2d3561;
    transform: rotate(90deg);
}

/* Image Modal Zoom Styles */
.modal-image-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.modal-image-container::-webkit-scrollbar-track {
    background: #0a0e27;
}

.modal-image-container::-webkit-scrollbar-thumb {
    background: #2d3561;
    border-radius: 5px;
}

.modal-image-container::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

.modal-image-container img {
    user-select: none;
    -webkit-user-drag: none;
}

.modal-zoom-controls button {
    padding: 8px 16px;
    font-size: 12px;
}

/* Sample Code Styles */
.code-block {
    margin-top: 20px;
    background: #05071a;
    border-radius: 8px;
    border: 1px solid #2d3561;
    overflow: hidden;
}

.code-header {
    background: #141829;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2d3561;
}

.code-header span {
    font-size: 12px;
    color: #a0aaf7;
    font-weight: 600;
}

.copy-code-btn {
    background: #667eea22;
    border: 1px solid #667eea44;
    color: #a0aaf7;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    background: #667eea44;
    color: white;
}

.code-content {
    padding: 15px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: #e0e6ff;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Code Modal Styles */
.code-modal-content {
    background: #0d1117;
    border: 2px solid #30363d;
    max-width: 900px !important;
}

.code-view-container {
    background: #010409;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #30363d;
    margin-top: 15px;
    position: relative;
}

.code-view {
    margin: 0;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #e6edf3;
    overflow-x: auto;
    white-space: pre;
}

/* Footer */
.footer {
    background: #141829;
    padding: 25px;
    border-top: 2px solid #2d3561;
    text-align: center;
}

.donation-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.donation-section p {
    color: #a0aaf7;
    font-size: 14px;
}

.donation-icons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.donation-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.kofi-icon {
    background: #fff;
    border: 2px solid #1a1f3a;
}

.kofi-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}

.crypto-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: 2px solid #667eea;
}

.crypto-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, .5);
}

/* Crypto Modal */
.crypto-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1f3a;
    border-radius: 12px;
    padding: 25px;
    width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .7);
    border: 2px solid #667eea;
    z-index: 1000;
}

.crypto-modal.active {
    display: block;
}

.crypto-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .7);
    z-index: 999;
}

.crypto-modal-overlay.active {
    display: block;
}

.crypto-modal h3 {
    color: #667eea;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.crypto-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #e0e6ff;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all .3s;
}

.crypto-close:hover {
    background: #2d3561;
    transform: rotate(90deg);
}

.crypto-list {
    max-height: 400px;
    overflow-y: auto;
}

.crypto-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #2d3561;
}

.crypto-item:last-child {
    border: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.crypto-label {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
    font-size: 13px;
}

.crypto-address {
    background: #0a0e27;
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 11px;
    color: #e0e6ff;
    word-break: break-all;
    border: 1px solid #2d3561;
}

.copy-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    margin-top: 8px;
    transition: all .3s;
    width: 100%;
}

.copy-btn:hover {
    background: #5568d3;
}

.copy-btn.copied {
    background: #2ecc71;
}

/* Responsive Design */
/* Resistor Visualizer */
#resistor-visual {
    transition: all 0.3s ease;
}

.suggestion-card:hover {
    background: rgba(102, 126, 234, 0.15) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.suggestion-card:active {
    transform: translateY(0);
}

.band {
    transition: background-color 0.3s ease;
    box-shadow: inset 1px 0 2px rgba(0, 0, 0, 0.2), 1px 0 1px rgba(255, 255, 255, 0.1);
}

/* Base colors - handled by JS directly but good to have defaults or transitions */
.band[style*="background-color: black"] {
    background-color: #000 !important;
}

.band[style*="background-color: brown"] {
    background-color: #8b4513 !important;
}

.band[style*="background-color: red"] {
    background-color: #ff0000 !important;
}

.band[style*="background-color: orange"] {
    background-color: #ffa500 !important;
}

.band[style*="background-color: yellow"] {
    background-color: #ffff00 !important;
}

.band[style*="background-color: green"] {
    background-color: #008000 !important;
}

.band[style*="background-color: blue"] {
    background-color: #0000ff !important;
}

.band[style*="background-color: violet"] {
    background-color: #ee82ee !important;
}

.band[style*="background-color: grey"] {
    background-color: #808080 !important;
}

.band[style*="background-color: white"] {
    background-color: #ffffff !important;
}

.band[style*="background-color: gold"] {
    background-color: #ffd700 !important;
}

.band[style*="background-color: silver"] {
    background-color: #c0c0c0 !important;
}

/* Enhanced Circuit Cards */
.circuit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.circuit-tag {
    font-size: 10px;
    background: rgba(102, 126, 234, 0.15);
    color: #a0aaf7;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.circuit-image-container {
    position: relative;
    width: 100%;
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.circuit-preview-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
    filter: invert(0.9) hue-rotate(180deg) brightness(0.8);
    /* Dark mode schematic style */
}

.circuit-image-container:hover .circuit-preview-img {
    transform: scale(1.05);
}

.zoom-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.circuit-image-container:hover .zoom-overlay {
    opacity: 1;
}

.circuit-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.circuit-schematic-box {
    background: #0d112b;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.schematic-text {
    margin-top: 8px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.4;
    color: #e0e0e0;
}

.circuit-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.info-pill {
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 6px;
}

.info-pill.calculation {
    background: rgba(102, 126, 234, 0.1);
    color: #a0aaf7;
}

.info-pill.note {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.info-pill.library {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

@media (max-width: 600px) {
    .circuit-details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 12px;
    }

    .header {
        padding: 60px 15px 20px 15px;
        min-height: 180px;
    }

    .logo-top-left {
        top: 15px;
        left: 15px;
        gap: 10px;
    }

    .logo-top-left img {
        width: 30px;
        height: 30px;
    }

    .logo-top-left span {
        font-size: 16px;
    }

    .header h1 {
        font-size: 24px;
        display: none;
        /* Already hidden visually but just in case */
    }

    .header p {
        font-size: 13px;
        padding: 8px 15px;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        flex: 0 0 auto;
        min-width: 120px;
        padding: 15px 10px;
        font-size: 13px;
    }

    .controls,
    .content {
        padding: 15px;
    }

    .board-diagram {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }

    .board-image-section {
        max-width: 100%;
    }

    .pins-container {
        flex-direction: column;
        gap: 10px;
    }

    .pin {
        padding: 10px;
    }

    .pin.right {
        flex-direction: row;
        /* Don't reverse on mobile so text is legible and aligned */
    }

    .pin.right .pin-info {
        text-align: left;
    }

    .pinout-display {
        padding: 15px;
    }

    .components-display,
    .circuit-grid,
    .calculator-grid,
    .vendor-grid,
    .control-row,
    .converter-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .image-utils-nav {
        gap: 10px;
        padding: 15px;
        flex-wrap: wrap;
    }

    .image-utils-nav-item {
        font-size: 14px;
        padding: 5px 10px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
    }

    .calculator-sidebar {
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }

    .calculator-main-content {
        padding: 0;
    }

    .calculator-list-layout {
        flex-direction: column;
    }

    .modal-content {
        width: 95% !important;
        padding: 20px !important;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Board Image Header Buttons */
.board-image-section button {
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.board-image-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.board-image-section button:active {
    transform: translateY(0);
}

#searchResultCount {
    transition: color 0.3s ease;
}

/* Waveform Trimmer Styles */
.waveform-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    background: #667eea;
    cursor: ew-resize;
    z-index: 10;
    transition: background 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waveform-handle::after {
    content: '';
    width: 14px;
    height: 14px;
    background: #667eea;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.waveform-handle:hover {
    background: #a0aaf7;
    box-shadow: 0 0 15px rgba(160, 170, 247, 0.6);
}

.waveform-handle:hover::after {
    background: #a0aaf7;
}

#handle-start {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

#handle-end {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

/* Multi-Calculator List-based Layout */
.calculator-list-layout {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    margin-top: 20px;
}

.calculator-sidebar {
    width: 260px;
    background: rgba(10, 14, 39, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    padding: 20px 15px;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.calculator-sidebar h4 {
    color: #a0aaf7;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    padding-left: 10px;
    opacity: 0.8;
}

.calc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.calc-list-item {
    padding: 14px 18px;
    border-radius: 10px;
    cursor: pointer;
    color: #a0aaf7;
    font-size: 13.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
}

.calc-list-item:hover {
    background: rgba(102, 126, 234, 0.08);
    transform: translateX(5px);
    color: #fff;
    border-color: rgba(102, 126, 234, 0.2);
}

.calc-list-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: #fff;
    font-weight: 600;
    border-left: 4px solid #667eea;
}

.calculator-main-content {
    flex-grow: 1;
    min-width: 0;
}

.calculator-ad-gutter {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}

.calc-ad-box {
    width: 100%;
    height: 600px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 1px dashed rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #4b5482;
    text-align: center;
    padding: 20px;
}

.calc-ad-box::after {
    content: 'ADVERTISING SPACE';
    font-size: 10px;
    letter-spacing: 2px;
    opacity: 0.5;
    margin-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .calculator-ad-gutter {
        display: none;
    }
}

@media (max-width: 768px) {
    .calculator-list-layout {
        flex-direction: column;
    }

    .calculator-sidebar {
        width: 100%;
        margin-bottom: 20px;
    }
}

/* Image/Audio Main Sub-Tabs */
.main-subtab-btn {
    transition: all 0.3s ease;
}

.main-subtab-btn:hover {
    background: rgba(102, 126, 234, 0.1) !important;
}

.main-subtab-content {
    animation: fadeIn 0.3s ease;
}

/* Responsive for audio cards in Image/Audio tab */
@media (max-width: 900px) {
    #subtab-audio>div {
        grid-template-columns: 1fr !important;
    }
}

/* Component Image Flip Effect */
.image-flip-container {
    perspective: 1000px;
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.image-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.image-flip-container.flipped .image-flip-inner {
    transform: rotateY(180deg);
}

.image-flip-front,
.image-flip-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-flip-back {
    transform: rotateY(180deg);
}

.image-flip-container:hover .flip-hint {
    background: rgba(102, 126, 234, 0.8);
    transform: scale(1.1);
}

.flip-hint {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 11px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.flip-hint span {
    font-size: 14px;
}