/* CRITICAL: Inherits parent site styles from ../../css/styles.css */
/* Device Tree Architect - Enhanced GUI */

:root {
    --mio-color: #51cf66;
    --emio-color: #f5576c;
    --gtr-color: #3949ab;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --card-shadow-hover: 0 15px 50px rgba(0, 0, 0, 0.25);
}

html {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: #ffffff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
}

body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.app-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================================= */
/* HEADER */
/* ============================================================================= */

.app-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    padding: 3rem 3rem;
    text-align: center;
    border-bottom: none;
    animation: headerSlideDown 0.6s ease-out;
    color: #ffffff;
}

body.dark-mode .app-header {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
}

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

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.header-content h1 i {
    color: #ffffff;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.header-content p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 500;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    font-size: 0.9rem;
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.version-badge i {
    width: 16px;
    height: 16px;
}

/* ============================================================================= */
/* MAIN CONTENT CARD */
/* ============================================================================= */

.main-content-card {
    background: #1e3c72;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    margin: 2rem;
    padding: 2rem;
    animation: cardFadeIn 0.8s ease-out;
}

body.dark-mode .main-content-card {
    background: #1e293b;
    backdrop-filter: blur(20px);
}

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

/* ============================================================================= */
/* MAIN LAYOUT */
/* ============================================================================= */

.split-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

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

@media (min-width: 1024px) {
    .split-layout {
        grid-template-columns: 420px 1fr;
        gap: 2.5rem;
        padding: 2.5rem 3rem;
    }
    
    .split-layout > * {
        min-width: 0;
    }
}

/* ============================================================================= */
/* CONTROL PANEL */
/* ============================================================================= */

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 100%;
    overflow: hidden;
}

.config-section {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

body.dark-mode .config-section {
    background: #334155;
    border: 1px solid #475569;
}

.config-section:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.config-section h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

body.dark-mode .config-section h2 {
    color: #f1f5f9;
}

.config-section h2 i {
    color: var(--gradient-start);
}

body.dark-mode .config-section h2 i {
    color: #818cf8;
}

.legend-horizontal {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    white-space: nowrap;
}

body.dark-mode .legend-item {
    color: #94a3b8;
}

@media (max-width: 1200px) {
    .legend-horizontal {
        display: none;
    }
}

/* ============================================================================= */
/* GEM CARD STYLES */
/* ============================================================================= */

.gem-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

body.dark-mode .gem-card {
    background: #2d3748;
    border-color: #4a5568;
}

.gem-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}

.gem-card.locked {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 235, 59, 0.05) 100%);
    border-color: #ffc107;
}

body.dark-mode .gem-card.locked {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 235, 59, 0.08) 100%);
}

.gem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.gem-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    flex-wrap: wrap;
}

.gem-title h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a202c;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

body.dark-mode .gem-title h3 {
    color: #f7fafc;
}

.gem-title .gem-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a202c;
}

body.dark-mode .gem-title .gem-name {
    color: #f7fafc;
}

.lock-icon {
    font-size: 1rem;
}

.hardware-locked-badge {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #1a202c;
    padding: 0.5rem 1rem;
    border-radius: 8px 8px 0 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    margin: -1rem -1rem 1rem -1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.gem-card.locked {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
    border-color: #ffc107;
}

body.dark-mode .gem-card.locked {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 152, 0, 0.15) 100%);
    border-color: #ffc107;
}

.pathway-select-group {
    margin: 1rem 0;
}

.pathway-select {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 2px solid rgba(100, 116, 139, 0.2);
    background: white;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pathway-select:hover:not(:disabled) {
    border-color: #667eea;
}

.pathway-select option:disabled {
    color: #94a3b8;
    font-style: italic;
}

body.dark-mode .pathway-select option:disabled {
    color: #64748b;
}

.pathway-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.dark-mode .pathway-select {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.15);
}

.hardware-description {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 1rem 0;
}

body.dark-mode .hardware-description {
    color: #94a3b8;
}

.emio-description {
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0.75rem 0;
    font-style: italic;
}

body.dark-mode .emio-description {
    color: #94a3b8;
}

.pl-details {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.warning-box {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-left: 4px solid #ff9800;
    padding: 0.85rem 1rem;
    margin: 1rem 0 0 0;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #1a202c;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    line-height: 1.5;
}

body.dark-mode .warning-box {
    background: rgba(255, 152, 0, 0.15);
    color: #f7fafc;
    border-color: rgba(255, 152, 0, 0.4);
}

.warning-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
}

.gem-address {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: #1e293b;
    margin-bottom: 0.75rem;
    font-weight: 700;
    padding: 0.6rem 0.8rem;
    background: rgba(100, 116, 139, 0.12);
    border-radius: 6px;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.gem-address code {
    color: #1e293b;
}

body.dark-mode .gem-address {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .gem-address code {
    color: #f1f5f9;
}

.hardware-info {
    background: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #ff9800;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1a202c;
}

body.dark-mode .hardware-info {
    background: rgba(255, 152, 0, 0.15);
    color: #f7fafc;
}

.hardware-info .info-icon {
    margin-right: 0.5rem;
}

.gem-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .gem-controls {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.gem-notes {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(102, 126, 234, 0.08);
    border-left: 3px solid var(--gradient-start);
    border-radius: 4px;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
}

.gem-notes p {
    margin: 0;
}

body.dark-mode .gem-notes {
    background: rgba(102, 126, 234, 0.15);
    color: #e2e8f0;
}

/* ============================================================================= */
/* PL CAPABILITY CARD STYLES */
/* ============================================================================= */

.pl-capability-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(118, 75, 162, 0.2);
    transition: all 0.3s ease;
}

body.dark-mode .pl-capability-card {
    background: #2d3748;
    border-color: #4a5568;
}

.pl-capability-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}

.capability-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.capability-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
}

body.dark-mode .capability-header h3 {
    color: #f7fafc;
}

.capability-desc {
    font-size: 0.95rem;
    color: #475569;
    margin: 0.5rem 0 1rem 0;
    line-height: 1.7;
}

body.dark-mode .capability-desc {
    color: #cbd5e1;
}

.not-available {
    color: #ef4444;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 0.5rem;
}

body.dark-mode .not-available {
    color: #f87171;
}

.phy-mode-group {
    margin-top: 1rem;
}

.phy-mode-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #475569;
}

body.dark-mode .phy-mode-group label {
    color: #cbd5e1;
}

.phy-mode-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1a202c;
    background: white;
    transition: all 0.3s ease;
}

body.dark-mode .phy-mode-group select {
    background: #1a202c;
    border-color: #4a5568;
    color: #f7fafc;
}

.phy-mode-group select:focus {
    outline: none;
    border-color: var(--gradient-start);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pl-notes {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(118, 75, 162, 0.05);
    border-left: 3px solid var(--gradient-end);
    border-radius: 4px;
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.6;
}

body.dark-mode .pl-notes {
    background: rgba(118, 75, 162, 0.1);
    color: #cbd5e1;
}

/* ============================================================================= */
/* FORM CONTROLS */
/* ============================================================================= */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #334155;
    letter-spacing: 0.3px;
}

body.dark-mode .form-group label {
    color: #e2e8f0;
}

.form-group label i {
    color: var(--gradient-start);
    width: 18px;
    height: 18px;
}

.board-select,
.version-select,
.phy-mode-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: #1a202c;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 20px;
    padding-right: 3rem;
}

body.dark-mode .board-select,
body.dark-mode .version-select,
body.dark-mode .phy-mode-select {
    background: #475569 !important;
    border-color: #64748b !important;
    color: #f1f5f9 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 20px !important;
}

body.dark-mode .board-select option,
body.dark-mode .version-select option,
body.dark-mode .phy-mode-select option {
    background: #334155 !important;
    color: #f1f5f9 !important;
}

.board-select:hover,
.version-select:hover,
.phy-mode-select:hover {
    border-color: var(--gradient-start);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.board-select:focus,
.version-select:focus,
.phy-mode-select:focus {
    outline: none;
    border-color: var(--gradient-start);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.version-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8fafc;
}

body.dark-mode .version-select:disabled {
    background-color: #334155;
}

.phy-addr-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #1a202c;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

body.dark-mode .phy-addr-input {
    background: #475569;
    border-color: #64748b;
    color: #f1f5f9;
}

.phy-addr-input:focus {
    outline: none;
    border-color: var(--gradient-start);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

body.dark-mode .phy-addr-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.25);
}

/* ============================================================================= */
/* ETHERNET NODES (GEM LIST) */
/* ============================================================================= */

.gem-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state,
.gem-list .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #1e293b;
    font-style: italic;
}

body.dark-mode .empty-state,
body.dark-mode .gem-list .empty-state {
    color: #94a3b8;
}

.gem-item {
    padding: 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.4s ease-out;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
}

body.dark-mode .gem-item {
    background: #475569;
    border-color: #64748b;
}

body.dark-mode .gem-item {
    background: #475569;
    border-color: #64748b;
}

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

.gem-item:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.gem-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.gem-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.gem-name {
    font-weight: 600;
    font-size: 1rem;
    color: #1a202c;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

body.dark-mode .gem-name {
    color: #f1f5f9;
}

body.dark-mode .gem-name {
    color: #f1f5f9;
}

.gem-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #f1f5f9;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    animation: expandDown 0.3s ease-out;
}

body.dark-mode .gem-controls {
    border-top-color: #64748b;
}

body.dark-mode .gem-controls {
    border-top-color: #64748b;
}

@keyframes expandDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

/* ============================================================================= */
/* TOGGLE SWITCH */
/* ============================================================================= */

.toggle-switch {
    position: relative;
    width: 54px;
    height: 30px;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 12px rgba(102, 126, 234, 0.3);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-slider.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle-switch input:disabled + .toggle-slider:before {
    background-color: #e2e8f0;
}

/* ============================================================================= */
/* PATHWAY BADGES */
/* ============================================================================= */

.pathway-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.pathway-badge.pathway-mio,
.pathway-mio {
    background: rgba(81, 207, 102, 0.2);
    color: #1e5128;
    border: 2px solid var(--mio-color);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(81, 207, 102, 0.2);
}

body.dark-mode .pathway-badge.pathway-mio,
body.dark-mode .pathway-mio {
    background: rgba(81, 207, 102, 0.25);
    color: #7bed9f;
    border-color: #51cf66;
}

.pathway-badge.pathway-emio,
.pathway-emio {
    background: rgba(245, 87, 108, 0.2);
    color: #7f1d1d;
    border: 2px solid var(--emio-color);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.2);
}

body.dark-mode .pathway-badge.pathway-emio,
body.dark-mode .pathway-emio {
    background: rgba(245, 87, 108, 0.25);
    color: #ff6b81;
    border-color: #f5576c;
}

.pathway-badge.pathway-gtr,
.pathway-gtr {
    background: rgba(57, 73, 171, 0.2);
    color: #1e3a8a;
    border: 2px solid var(--gtr-color);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(57, 73, 171, 0.2);
}

body.dark-mode .pathway-badge.pathway-gtr,
body.dark-mode .pathway-gtr {
    background: rgba(57, 73, 171, 0.25);
    color: #a5b4fc;
    border-color: #6366f1;
}

/* ============================================================================= */
/* OUTPUT PANEL */
/* ============================================================================= */

.output-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 100%;
    overflow: hidden;
}

.output-section {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    min-width: 0;
}

body.dark-mode .output-section {
    background: #334155;
    border: 1px solid #475569;
}

.output-section:hover {
    box-shadow: var(--card-shadow-hover);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

body.dark-mode .section-header h2 {
    color: #f1f5f9;
}

.section-header h2 i {
    color: var(--gradient-start);
}

body.dark-mode .section-header h2 i {
    color: #818cf8;
}

/* Diagram Section */
.diagram-wrapper {
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-container {
    width: 100%;
    min-height: 500px;
    padding: 3rem 2rem 6rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    display: block;
    overflow: auto;
    position: relative;
}

body.dark-mode .diagram-container {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #475569;
}

.diagram-container .mermaid {
    width: 100%;
    max-width: 100%;
    min-height: 400px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Code Section */
.code-wrapper {
    position: relative;
}

.copy-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.copy-button:active {
    transform: translateY(0);
}

.copy-button.success {
    background: linear-gradient(135deg, var(--mio-color), #2d7a3e);
}

.copy-button.error {
    background: linear-gradient(135deg, var(--emio-color), #b91c3b);
}

pre {
    margin: 0;
    padding: 1.75rem;
    background: #1e293b;
    border-radius: 12px;
    overflow-x: auto;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid #334155;
}

pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #e2e8f0;
}

/* ============================================================================= */
/* PRISM.JS TOKEN OVERRIDES - WCAG AA CONTRAST FOR DARK BACKGROUND */
/* ============================================================================= */

/* Ensure all Prism tokens meet WCAG AA 4.5:1 contrast on dark background (#1e293b) */
code[class*="language-"] .token,
pre[class*="language-"] .token {
    color: #e2e8f0 !important; /* Default light color for any token */
}

code[class*="language-"] .token.comment,
code[class*="language-"] .token.prolog,
code[class*="language-"] .token.doctype,
code[class*="language-"] .token.cdata,
pre[class*="language-"] .token.comment,
pre[class*="language-"] .token.prolog,
pre[class*="language-"] .token.doctype,
pre[class*="language-"] .token.cdata {
    color: #94a3b8 !important;
}

code[class*="language-"] .token.punctuation,
pre[class*="language-"] .token.punctuation {
    color: #cbd5e1 !important;
}

code[class*="language-"] .token.property,
code[class*="language-"] .token.tag,
code[class*="language-"] .token.boolean,
code[class*="language-"] .token.number,
code[class*="language-"] .token.constant,
code[class*="language-"] .token.symbol,
code[class*="language-"] .token.deleted,
pre[class*="language-"] .token.property,
pre[class*="language-"] .token.tag,
pre[class*="language-"] .token.boolean,
pre[class*="language-"] .token.number,
pre[class*="language-"] .token.constant,
pre[class*="language-"] .token.symbol,
pre[class*="language-"] .token.deleted {
    color: #7dd3fc !important;
}

code[class*="language-"] .token.selector,
code[class*="language-"] .token.attr-name,
code[class*="language-"] .token.string,
code[class*="language-"] .token.char,
code[class*="language-"] .token.builtin,
code[class*="language-"] .token.inserted,
pre[class*="language-"] .token.selector,
pre[class*="language-"] .token.attr-name,
pre[class*="language-"] .token.string,
pre[class*="language-"] .token.char,
pre[class*="language-"] .token.builtin,
pre[class*="language-"] .token.inserted {
    color: #6ee7b7 !important;
}

code[class*="language-"] .token.operator,
code[class*="language-"] .token.entity,
code[class*="language-"] .token.url,
pre[class*="language-"] .token.operator,
pre[class*="language-"] .token.entity,
pre[class*="language-"] .token.url {
    color: #fde047 !important;
}

code[class*="language-"] .token.atrule,
code[class*="language-"] .token.attr-value,
code[class*="language-"] .token.keyword,
pre[class*="language-"] .token.atrule,
pre[class*="language-"] .token.attr-value,
pre[class*="language-"] .token.keyword {
    color: #c084fc !important;
}

code[class*="language-"] .token.function,
code[class*="language-"] .token.class-name,
pre[class*="language-"] .token.function,
pre[class*="language-"] .token.class-name {
    color: #fbbf24 !important;
}

code[class*="language-"] .token.regex,
code[class*="language-"] .token.important,
code[class*="language-"] .token.variable,
pre[class*="language-"] .token.regex,
pre[class*="language-"] .token.important,
pre[class*="language-"] .token.variable {
    color: #fb923c !important;
}

/* ============================================================================= */
/* FOOTER */
/* ============================================================================= */

.app-footer {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--gradient-start), var(--gradient-end)) 1;
    margin-top: 2rem;
}

body.dark-mode .app-footer {
    background: #1e293b;
}

.app-footer p {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

body.dark-mode .app-footer p {
    color: #cbd5e1;
}

.app-footer i {
    color: var(--gradient-start);
}

body.dark-mode .app-footer i {
    color: #818cf8;
}

/* ============================================================================= */
/* RESPONSIVE DESIGN */
/* ============================================================================= */

/* Smart Configurator Styles */
.config-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.config-option {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: start;
    padding: 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    transition: all 0.3s ease;
    gap: 1rem 1.5rem;
    min-height: 80px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

body.dark-mode .config-option {
    background: #475569;
    border-color: #64748b;
}

.config-option:hover:not(.disabled) {
    border-color: var(--gradient-start);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.config-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8fafc;
}

body.dark-mode .config-option.disabled {
    background: #334155;
}

/* Hardware-locked configuration item (cannot be changed) */
.config-option.hw-locked {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    position: relative;
    padding: 2.25rem 1.25rem 1.25rem 1.25rem;
    min-height: auto;
}

body.dark-mode .config-option.hw-locked {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border-color: #f59e0b;
}

.config-option.hw-locked::before {
    content: '🔒 HARDWARE LOCKED';
    position: absolute;
    top: 8px;
    left: 12px;
    background: #f59e0b;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 1;
}

.config-option.hw-locked .pathway-selector {
    background: rgba(254, 243, 199, 0.6);
    border-color: #f59e0b;
    cursor: not-allowed;
    color: #78350f;
    font-weight: 600;
}

.config-option.hw-locked .toggle-switch input:disabled + .toggle-slider {
    background: #f59e0b;
    cursor: not-allowed;
}

.config-option.hw-locked .toggle-switch input:disabled:checked + .toggle-slider {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.config-option-label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    overflow-wrap: break-word;
    max-width: 100%;
}

.config-option-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

body.dark-mode .config-option-title {
    color: #f1f5f9;
}

.gem-address-badge {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    background: #475569;
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

body.dark-mode .gem-address-badge {
    background: #64748b;
    color: #f1f5f9;
}

.config-option-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    overflow-wrap: break-word;
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    margin-top: 0;
    box-sizing: border-box;
    width: 100%;
}

body.dark-mode .config-option-desc {
    color: #cbd5e1;
}

.config-option-warning {
    font-size: 0.75rem;
    color: #92400e;
    font-style: normal;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 6px;
    border-left: 3px solid #f59e0b;
    line-height: 1.5;
    overflow-wrap: break-word;
    grid-column: 1 / 3;
    grid-row: 3 / 4;
    box-sizing: border-box;
    width: 100%;
}

body.dark-mode .config-option-warning {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.25);
    border-left-color: #fbbf24;
}
}

.config-option-control {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    align-self: start;
}

.pathway-selector {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 180px;
    flex-shrink: 0;
}

body.dark-mode .pathway-selector {
    background: #475569 !important;
    border-color: #64748b !important;
    color: #f1f5f9 !important;
}

body.dark-mode .pathway-selector option {
    background: #334155 !important;
    color: #f1f5f9 !important;
}

.pathway-selector:hover:not(:disabled) {
    border-color: var(--gradient-start);
}

body.dark-mode .pathway-selector:hover:not(:disabled) {
    border-color: #818cf8 !important;
}

.pathway-selector:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
}

body.dark-mode .pathway-selector:disabled {
    background: #334155 !important;
    border-color: #475569 !important;
}

@media (max-width: 768px) {
    .split-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1.5rem;
    }
    
    .main-content-card {
        margin: 1rem;
        padding: 1rem;
    }
    
    .app-header {
        padding: 1.5rem 1rem;
    }
    
    .config-option {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }
    
    .config-option-control {
        width: 100%;
        max-width: none;
        justify-content: space-between;
        margin-top: 1rem;
        flex-direction: row;
        align-items: center;
    }
    
    .pathway-selector {
        flex: 1;
        min-width: 0;
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
    
    .header-content h1 {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-content p {
        font-size: 0.95rem;
    }
    
    .version-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .config-section,
    .output-section {
        padding: 1.25rem;
    }
    
    .config-section h2,
    .section-header h2 {
        font-size: 1.15rem;
    }
    
    .gem-controls {
        grid-template-columns: 1fr;
    }
    
    .gem-item {
        padding: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .copy-button {
        width: 100%;
        justify-content: center;
        font-size: 0.9rem;
        padding: 0.7rem 1.25rem;
    }
    
    .diagram-container {
        padding: 1rem;
        min-height: 250px;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .board-select,
    .version-select,
    .phy-mode-select {
        font-size: 0.95rem;
        padding: 0.75rem 0.9rem;
    }
    
    .phy-addr-input {
        font-size: 0.9rem;
        padding: 0.65rem 0.9rem;
    }
    
    .legend-horizontal {
        display: none;
    }
}

@media (max-width: 480px) {
    .main-content-card {
        margin: 0.5rem;
        padding: 0.75rem;
        border-radius: 15px;
    }
    
    .header-content h1 {
        font-size: 1.4rem;
    }
    
    .header-content p {
        font-size: 0.85rem;
    }
    
    .version-badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.7rem;
    }
    
    .config-section h2,
    .section-header h2 {
        font-size: 1rem;
    }
    
    .config-section,
    .output-section {
        padding: 1rem;
    }
    
    .split-layout {
        padding: 0.75rem;
        gap: 1rem;
    }
    
    .gem-item {
        padding: 0.85rem;
    }
    
    .config-option {
        padding: 0.85rem;
    }
    
    .config-option-title {
        font-size: 0.9rem;
    }
    
    .config-option-desc {
        font-size: 0.8rem;
    }
    
    .board-select,
    .version-select,
    .phy-mode-select {
        font-size: 0.9rem;
        padding: 0.9rem 0.8rem;
        min-height: 46px;
        line-height: 1.5;
    }
    
    .copy-button {
        font-size: 0.85rem;
        padding: 0.85rem 1rem;
        min-height: 46px;
        line-height: 1.5;
    }
    
    .pathway-badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.7rem;
    }
    
    .diagram-container {
        padding: 0.75rem;
    }
    
    pre {
        padding: 1rem;
        font-size: 0.8rem;
    }
}

/* ============================================================================= */
/* LOADING & ANIMATIONS */
/* ============================================================================= */

.loading {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
    font-style: italic;
}

body.dark-mode .loading {
    color: #cbd5e1;
}

/* Mermaid Diagram Styling */
.mermaid {
    font-family: 'Poppins', sans-serif !important;
}

.mermaid svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    padding: 1rem;
}

/* Mermaid zoom controls */
.diagram-container:hover {
    cursor: grab;
}

.diagram-container:active {
    cursor: grabbing;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection styling */
::selection {
    background: var(--gradient-start);
    color: white;
}

::-moz-selection {
    background: var(--gradient-start);
    color: white;
}

/* ============================================================================= */
/* ACCESSIBILITY IMPROVEMENTS */
/* ============================================================================= */

/* Focus indicators for all interactive elements */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

body.dark-mode a:focus-visible,
body.dark-mode button:focus-visible,
body.dark-mode select:focus-visible,
body.dark-mode input:focus-visible {
    outline-color: #818cf8;
}

/* Ensure buttons have proper contrast */
.copy-button:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-to-content:focus {
    top: 0;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .config-section,
    .output-section,
    .gem-item {
        border-width: 3px;
        border-color: currentColor;
    }
    
    button,
    select,
    input {
        border-width: 2px;
    }
}

/* ============================================================================= */
/* TOUCH-FRIENDLY MOBILE IMPROVEMENTS */
/* ============================================================================= */

/* Increase tap targets for mobile */
@media (max-width: 768px) {
    button,
    a,
    select,
    input,
    .pathway-selector {
        min-height: 44px; /* Apple iOS recommended minimum */
        min-width: 44px;
    }
    
    /* Improve touch feedback */
    button:active,
    a:active,
    select:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
    
    /* Prevent double-tap zoom on buttons */
    button,
    a {
        touch-action: manipulation;
    }
    
    /* Improve text readability on mobile */
    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    /* Better scrolling on iOS */
    .diagram-container,
    pre {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improve form control spacing */
    .form-group {
        margin-bottom: 1.25rem;
    }
}

/* Very small screens - further optimization */
@media (max-width: 375px) {
    .app-header {
        padding: 1rem 0.75rem;
    }
    
    .main-content-card {
        margin: 0.25rem;
        padding: 0.5rem;
    }
    
    .config-section,
    .output-section {
        padding: 0.75rem;
    }
    
    .header-content h1 {
        font-size: 1.25rem;
    }
}

/* ============================================================================= */
/* PULSE ANIMATION FOR WARNING BANNER */
/* ============================================================================= */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.warning-pulse {
    will-change: transform;
    animation: pulse 2s ease-in-out infinite !important;
}
