/* ===========================================
   CIRCUITNOTES PROJECT-SPECIFIC STYLES
   ============================================ */

.page-header {
    background: var(--dark-muted);
    color: white;
    padding: 0;
    margin-top: 18px !important;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
}

.page-header .container {
    padding-top: 0;
    padding-bottom: 0;
}

.page-header h1 {
    margin: 0;
    margin-top: 10px;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: white;
}

@media (max-width: 768px) {
    .page-header h1 {
        padding: 40px 0;
        font-size: 1.8rem;
    }
}

/* ============================================
   STATS BAR — Index page statistics row
   Unique to CircuitNotes index. Not in shared base.
   ============================================ */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
    padding: 25px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    min-width: 100px;
}

.stat-item strong {
    display: block;
    font-size: 2.5rem;
    color: var(--primary);
    font-weight: 700;
    line-height: 1;
}

.stat-item span {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   SUBTITLE
   ============================================ */
.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 40px;
}

/* ============================================
   SECTION TITLE — Left-border accent heading
   ============================================ */
.section-title {
    margin: 60px 0 30px;
    font-size: 1.8rem;
    color: var(--dark);
    border-left: 4px solid var(--primary);
    padding-left: 15px;
    font-weight: 700;
}

/* ============================================
   PROJECT & DEMO GRIDS
   CircuitNotes uses 320px minmax columns.
   ============================================ */
.project-grid,
.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 80px;
}

@media (max-width: 768px) {
    .project-grid,
    .demo-grid {
        grid-template-columns: 1fr;
    }
}

.project-card,
.category-card {
    background: white;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.project-card:hover,
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0,0,0,0.15);
    border-color: var(--primary);
}

.category-card h3 {
    margin-top: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

.category-card h3 i {
    color: var(--primary);
}

/* ============================================
   LINK GROUP — Stacked nav links inside cards
   ============================================ */
.link-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

/* ============================================
   TAGS — Green pill badges
   ============================================ */
.tag {
    background: #ecfdf5;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

/* ============================================
   DEMO SECTION — White card container
   ============================================ */
.demo-section {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ============================================
   CIRCUIT THEORY CONTENT BOXES
   CircuitNotes palette: theory = light blue,
   math = light orange, materials/tips = green,
   warning = light red.
   ============================================ */
.theory-box {
    background: #e8f4f8;
    padding: 20px;
    border-left: 4px solid var(--info);
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.math-box,
.formula {
    background: #fef5e7;
    padding: 20px;
    border-left: 4px solid var(--accent);
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    border-radius: 0 8px 8px 0;
    overflow-x: auto;
}

.materials-box,
.tips-box,
.info-box {
    background: #d5f4e6;
    padding: 20px;
    border-left: 4px solid var(--primary);
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.warning-box,
.warning {
    background: #ffe6e6;
    padding: 20px;
    border-left: 4px solid var(--warning);
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.highlight {
    background: #fff9e6;
    padding: 15px;
    border-left: 4px solid var(--accent);
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

/* ============================================
   CODE & CIRCUIT DIAGRAMS
   Dark monospace blocks for ASCII circuit art and code.
   ============================================ */
.circuit-diagram,
.code-section {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    white-space: pre;
    font-size: 14px;
    margin: 20px 0;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ============================================
   COMPONENT GRID & CARDS
   ============================================ */
.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.component-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-left: 4px solid #e74c3c;
}

.component-card h4 {
    margin-top: 0;
    color: #e74c3c;
}

/* ============================================
   MATRIX KEYPAD GRID
   Visual representation of a 4-column keypad.
   ============================================ */
.key-grid {
    display: grid;
    grid-template-columns: repeat(4, 60px);
    gap: 8px;
    margin: 20px 0;
    justify-content: center;
}

.key {
    background: #34495e;
    color: white;
    padding: 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ============================================
   COLOR BOX — Inline RGB swatches
   ============================================ */
.color-box {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 2px solid #333;
    margin: 0 5px;
    vertical-align: middle;
    border-radius: 4px;
}

/* ============================================
   WAVEFORM — Monospace signal display
   ============================================ */
.waveform {
    background: #fff;
    border: 2px solid #334155;
    padding: 15px;
    font-family: monospace;
    margin: 15px 0;
    border-radius: 4px;
    overflow-x: auto;
}

/* ============================================
   7-SEGMENT DISPLAY
   Red digits on black, centered.
   ============================================ */
.segment-display {
    font-family: 'Courier New', monospace;
    background: #000;
    color: #ff0000;
    padding: 20px;
    text-align: center;
    font-size: 48px;
    font-weight: bold;
    border-radius: 8px;
    margin: 20px 0;
    letter-spacing: 10px;
}

/* ============================================
   BTN-LINK — Navigation link cards with arrow
   ============================================ */
.btn-link {
    text-decoration: none;
    padding: 12px 16px;
    background: var(--light);
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: white;
    transform: translateX(5px);
}

.btn-link::after {
    content: '→';
    font-size: 1.2rem;
}

/* ============================================
   DOWNLOAD BUTTON — Green pill style
   ============================================ */
.download-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    background: var(--primary) !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: bold !important;
    margin: 20px 0 !important;
    transition: all 0.3s;
    border: none;
}

.download-btn:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ============================================
   PAGE SELECT DROPDOWN
   Dark-themed <select> for page navigation.
   ============================================ */
#page-select {
    width: 100%;
    padding: 12px;
    background: var(--dark-muted);
    color: white;
    border-radius: 5px;
    border: 1px solid #475569;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#page-select:hover,
#page-select:focus {
    border-color: var(--primary);
    outline: none;
}

/* ============================================
   CONTENT AREA HEADINGS
   CircuitNotes overrides h1/h2/h3 inside .content-area
   with specific colors, backgrounds, and borders.
   ============================================ */
.content-area {
    margin-bottom: 60px;
}

.content-area h1 {
    color: #2c3e50;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 10px;
    text-align: center;
    margin-top: 40px;
}

.content-area h2 {
    color: #34495e;
    margin-top: 40px;
    background: #ecf0f1;
    padding: 15px;
    border-left: 5px solid var(--primary);
    border-radius: 0 8px 8px 0;
}

.content-area h3 {
    color: #16a085;
    margin-top: 30px;
}

/* ============================================
   MOBILE SIDEBAR — CircuitNotes variant
   CircuitNotes used .sidebar (not .sidebar-mobile)
   with a backdrop overlay and slide-from-right behavior.
   ============================================ */
.sidebar {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 10002;
    top: 0;
    right: 0;
    background-color: var(--dark-muted);
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 80px;
    border-left: 2px solid var(--primary);
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}

.sidebar a {
    padding: 15px 32px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: #94a3b8;
    display: block;
    transition: all 0.3s;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar a:hover {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    padding-left: 40px;
}

.sidebar .close-btn {
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 30px;
    color: var(--primary);
    border-bottom: none;
    cursor: pointer;
    transition: color 0.2s;
}

.sidebar .close-btn:hover {
    color: var(--primary-hover);
}

/* Backdrop overlay for mobile sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* ============================================
   TABLE ENHANCEMENTS
   CircuitNotes adds hover row highlight and
   rounded corners with overflow hidden.
   ============================================ */
table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th {
    font-weight: 600;
}

tr:hover {
    background: #f1f5f9;
}

/* ============================================
   FOOTER — .footer class variant
   ============================================ */
.footer {
    text-align: center;
    padding: 60px 20px;
    background: var(--dark-muted);
    color: #94a3b8;
    margin-top: 60px;
    border-top: 3px solid var(--primary);
}

.footer p {
    margin-bottom: 4px;
    color: inherit;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
    color: white;
}

/* ============================================
   RESPONSIVE — CIRCUITNOTES SPECIFIC
   ============================================ */
@media (max-width: 1024px) {
    .nav-links {
        gap: 15px;
    }

    .nav-links a {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        gap: 20px;
        padding: 20px;
    }

    .stat-item strong {
        font-size: 2rem;
    }

    .key-grid {
        grid-template-columns: repeat(4, 50px);
        gap: 6px;
    }

    .key {
        font-size: 1rem;
        padding: 12px;
    }
}

