/* Page Replacement Algorithms Tool - Complete Styles with Light/Dark Theme Support */

/* ===== CSS Variables ===== */
.pra-container {
    --pra-primary: var(--primary-color, #3498db);
    --pra-secondary: var(--secondary-color, #2ecc71);
    --pra-bg: var(--card-bg-color, #fcfcfc);
    --pra-surface: var(--background-color, #ffffff);
    --pra-text: var(--text-color, #333333);
    --pra-text-muted: #6c757d;
    --pra-border: var(--border-color, rgba(52, 152, 219, 0.15));
    --pra-shadow: var(--box-shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
    --pra-radius: var(--border-radius-md, 8px);
    --pra-radius-lg: var(--border-radius-lg, 16px);
    --pra-transition: var(--transition-fast, 0.2s ease);
    --pra-gradient: linear-gradient(135deg, var(--pra-primary), var(--pra-secondary));
    --pra-success: #27ae60;
    --pra-warning: #f39c12;
    --pra-danger: #e74c3c;
    --pra-info: #3498db;
    --pra-hit-color: #27ae60;
    --pra-fault-color: #e74c3c;
    --pra-replace-color: #f39c12;
}

.dark-theme .pra-container {
    --pra-text-muted: #9ca3af;
    --pra-surface: #1a1d24;
    --pra-bg: #242830;
}

/* ===== Base Container ===== */
.pra-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    font-family: var(--font-family, 'Inter', sans-serif);
    color: var(--pra-text);
}

/* ===== Header ===== */
.pra-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(var(--secondary-rgb), 0.05));
    border-radius: var(--pra-radius-lg);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pra-header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.pra-header-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pra-gradient);
    border-radius: var(--pra-radius-lg);
    font-size: 1.75rem;
    color: white;
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.35);
}

.pra-header h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.pra-header p {
    margin: 0;
    opacity: 0.7;
    font-size: 0.9rem;
}

.pra-header-actions {
    display: flex;
    gap: 0.5rem;
}

.pra-btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--pra-border);
    border-radius: 12px;
    background: var(--pra-surface);
    color: var(--pra-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.pra-btn-icon:hover {
    border-color: var(--pra-primary);
    color: var(--pra-primary);
}

/* ===== Privacy Notice ===== */
.pra-privacy-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--pra-radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1), rgba(52, 152, 219, 0.1));
    border: 1px solid rgba(39, 174, 96, 0.2);
    color: var(--pra-success);
}

/* ===== Mode Tabs ===== */
.pra-mode-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pra-mode-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 2rem;
    border: 2px solid var(--pra-border);
    background: var(--pra-surface);
    border-radius: var(--pra-radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 140px;
}

.pra-mode-tab i {
    font-size: 1.5rem;
    color: var(--pra-primary);
}

.pra-mode-tab span {
    font-weight: 600;
    color: var(--pra-text);
}

.pra-mode-tab small {
    font-size: 0.75rem;
    color: var(--pra-text-muted);
}

.pra-mode-tab:hover {
    border-color: var(--pra-primary);
    transform: translateY(-2px);
}

.pra-mode-tab.active {
    background: var(--pra-gradient);
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.35);
}

.pra-mode-tab.active i,
.pra-mode-tab.active span,
.pra-mode-tab.active small {
    color: white;
}

.pra-tab-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

@media (max-width: 768px) {
    .pra-tab-text {
        align-items: flex-start;
    }
}


/* ===== Main Content Layout ===== */
.pra-main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.pra-visualization-panel {
    min-width: 0;
    /* Critical for grid containers to prevent content overflow */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


/* ===== Controls Panel ===== */
.pra-controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pra-control-section {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.25rem;
}

.pra-control-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--pra-text);
}

.pra-control-section h4 i {
    color: var(--pra-primary);
}

/* ===== Input Styles ===== */
.pra-input-group {
    margin-bottom: 1rem;
}

.pra-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--pra-border);
    border-radius: var(--pra-radius);
    background: var(--pra-surface);
    color: var(--pra-text);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.pra-input:focus {
    outline: none;
    border-color: var(--pra-primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.pra-input::placeholder {
    color: var(--pra-text-muted);
}

.pra-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
}

.pra-input-row {
    margin-bottom: 0.75rem;
}

.pra-input-row label {
    display: block;
    font-size: 0.85rem;
    color: var(--pra-text-muted);
    margin-bottom: 0.35rem;
}

/* ===== Preset Buttons ===== */
.pra-preset-inputs {
    margin-top: 0.5rem;
}

.pra-preset-btn {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    margin: 0.25rem 0.25rem 0.25rem 0;
    border: 1px solid var(--pra-border);
    background: var(--pra-surface);
    color: var(--pra-text);
    border-radius: var(--pra-radius);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pra-preset-btn:hover {
    border-color: var(--pra-primary);
    background: rgba(var(--primary-rgb), 0.1);
}

/* ===== Slider Styles ===== */
.pra-slider-group {
    margin-bottom: 1rem;
}

.pra-slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--pra-text-muted);
}

.pra-slider-group label span {
    font-weight: 600;
    color: var(--pra-primary);
}

.pra-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--pra-border);
    border-radius: 3px;
    outline: none;
}

.pra-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--pra-gradient);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.4);
    transition: transform 0.2s ease;
}

.pra-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.pra-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--pra-gradient);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ===== Algorithm Selection (Radio) ===== */
.pra-algorithm-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pra-algo-radio {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--pra-surface);
    border: 2px solid var(--pra-border);
    border-radius: var(--pra-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pra-algo-radio:hover {
    border-color: var(--pra-primary);
}

.pra-algo-radio input {
    display: none;
}

.pra-algo-radio .radiomark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--pra-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pra-algo-radio input:checked+.radiomark {
    background: var(--pra-primary);
    border-color: var(--pra-primary);
}

.pra-algo-radio input:checked+.radiomark::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.pra-algo-radio.selected {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--pra-primary);
}

.pra-algo-radio .algo-info {
    display: flex;
    flex-direction: column;
}

.pra-algo-radio .algo-name {
    font-weight: 600;
    color: var(--pra-text);
    font-size: 0.9rem;
}

.pra-algo-radio .algo-desc {
    font-size: 0.75rem;
    color: var(--pra-text-muted);
}

/* ===== Algorithm Selection (Checkbox Grid) ===== */
.pra-algorithm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.pra-algo-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--pra-surface);
    border: 1px solid var(--pra-border);
    border-radius: var(--pra-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.pra-algo-checkbox:hover {
    border-color: var(--pra-primary);
}

.pra-algo-checkbox input {
    display: none;
}

.pra-algo-checkbox .checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid var(--pra-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pra-algo-checkbox input:checked+.checkmark {
    background: var(--pra-primary);
    border-color: var(--pra-primary);
}

.pra-algo-checkbox input:checked+.checkmark::after {
    content: '✓';
    color: white;
    font-size: 0.65rem;
}

.pra-algo-checkbox.selected {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--pra-primary);
}

.pra-algo-checkbox .algo-name {
    font-weight: 500;
    color: var(--pra-text);
}

/* ===== Computed Info ===== */
.pra-computed-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(var(--primary-rgb), 0.05);
    border-radius: var(--pra-radius);
}

.pra-info-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.pra-info-item .label {
    color: var(--pra-text-muted);
}

.pra-info-item .value {
    font-weight: 600;
    color: var(--pra-primary);
}

/* ===== Speed Control ===== */
.pra-speed-control {
    margin-bottom: 1rem;
}

.pra-speed-buttons {
    display: flex;
    gap: 0.25rem;
}

.pra-speed-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--pra-border);
    background: var(--pra-surface);
    color: var(--pra-text);
    border-radius: var(--pra-radius);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.pra-speed-btn:hover {
    border-color: var(--pra-primary);
}

.pra-speed-btn.active {
    background: var(--pra-primary);
    color: white;
    border-color: var(--pra-primary);
}

/* ===== Button Styles ===== */
.pra-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--pra-radius);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.pra-btn-primary {
    background: var(--pra-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.pra-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
}

.pra-btn-secondary {
    background: var(--pra-bg);
    color: var(--pra-text);
    border: 2px solid var(--pra-border);
}

.pra-btn-secondary:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--pra-primary);
}

.pra-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== Playback Controls ===== */
.pra-playback-controls {
    display: flex;
    gap: 0.5rem;
}

.pra-playback-controls .pra-btn {
    flex: 1;
}

/* ===== Visualization Panel ===== */
.pra-visualization-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


/* ===== Status Bar ===== */
.pra-status-bar {
    padding: 0.75rem 1rem;
    background: var(--pra-bg);
    border-radius: var(--pra-radius);
    border: 1px solid var(--pra-border);
}

.pra-status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.pra-status-item i {
    color: var(--pra-primary);
}

.pra-status-item.hit {
    color: var(--pra-hit-color);
}

.pra-status-item.hit i {
    color: var(--pra-hit-color);
}

.pra-status-item.fault {
    color: var(--pra-fault-color);
}

.pra-status-item.fault i {
    color: var(--pra-fault-color);
}

/* ===== Memory Frames Section ===== */
.pra-frames-section {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.5rem;
}

.pra-frames-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.pra-frames-section h4 i {
    color: var(--pra-primary);
}

.pra-frames-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pra-frame {
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--pra-surface);
    border: 3px solid var(--pra-border);
    border-radius: var(--pra-radius);
    font-size: 1.5rem;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
}

.pra-frame::before {
    content: attr(data-label);
    position: absolute;
    top: -20px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--pra-text-muted);
}

.pra-frame.empty {
    color: var(--pra-text-muted);
    font-size: 1rem;
}

.pra-frame.active {
    border-color: var(--pra-primary);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3);
    animation: frameGlow 0.5s ease;
}

.pra-frame.hit {
    border-color: var(--pra-hit-color);
    background: rgba(39, 174, 96, 0.1);
}

.pra-frame.fault {
    border-color: var(--pra-fault-color);
    background: rgba(231, 76, 60, 0.1);
    animation: frameFault 0.5s ease;
}

.pra-frame.replace {
    border-color: var(--pra-replace-color);
    background: rgba(243, 156, 18, 0.1);
}

@keyframes frameGlow {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes frameFault {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* ===== Page Table Section ===== */
.pra-table-section {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.5rem;
}

.pra-table-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.pra-table-section h4 i {
    color: var(--pra-primary);
}

.pra-table-wrapper {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--pra-radius);
}


.pra-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.pra-table th,
.pra-table td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border: 1px solid var(--pra-border);
}

.pra-table th {
    background: rgba(var(--primary-rgb), 0.1);
    font-weight: 600;
    color: var(--pra-text);
}

.pra-table td {
    background: var(--pra-surface);
}

.pra-table td.hit {
    background: rgba(39, 174, 96, 0.15);
    color: var(--pra-hit-color);
    font-weight: 600;
}

.pra-table td.fault {
    background: rgba(231, 76, 60, 0.15);
    color: var(--pra-fault-color);
    font-weight: 600;
}

.pra-table td.current {
    background: rgba(var(--primary-rgb), 0.2);
    font-weight: 700;
    border: 2px solid var(--pra-primary);
}

.pra-table .page-header {
    min-width: 40px;
}

.pra-table .frame-row {
    font-weight: 500;
}

.pra-table .result-row td {
    font-weight: 600;
    font-size: 0.8rem;
}

/* ===== Explanation Panel ===== */
.pra-explanation-panel {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.5rem;
}

.pra-explanation-panel h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.pra-explanation-panel h4 i {
    color: var(--pra-warning);
}

.pra-explanation-content {
    line-height: 1.7;
    font-size: 0.9rem;
}

.pra-explanation-content strong {
    color: var(--pra-primary);
}

.pra-explanation-content .highlight-page {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--pra-gradient);
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

.pra-explanation-content .highlight-hit {
    color: var(--pra-hit-color);
    font-weight: 600;
}

.pra-explanation-content .highlight-fault {
    color: var(--pra-fault-color);
    font-weight: 600;
}

/* ===== Stats Panel ===== */
.pra-stats-panel {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.5rem;
}

.pra-stats-panel h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.pra-stats-panel h4 i {
    color: var(--pra-primary);
}

.pra-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.pra-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--pra-surface);
    border-radius: var(--pra-radius);
    border: 1px solid var(--pra-border);
}

.pra-stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(231, 76, 60, 0.1);
    color: var(--pra-fault-color);
    border-radius: var(--pra-radius);
    font-size: 1.25rem;
}

.pra-stat-icon.hit {
    background: rgba(39, 174, 96, 0.1);
    color: var(--pra-hit-color);
}

.pra-stat-icon.rate {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--pra-primary);
}

.pra-stat-info {
    display: flex;
    flex-direction: column;
}

.pra-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pra-text);
}

.pra-stat-label {
    font-size: 0.8rem;
    color: var(--pra-text-muted);
}

/* ===== Comparison Results ===== */
.pra-comparison-results {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.5rem;
}

.pra-comparison-results h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.pra-comparison-results h4 i {
    color: var(--pra-warning);
}

.pra-comparison-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.pra-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.pra-comparison-table th,
.pra-comparison-table td {
    padding: 1rem 0.75rem;
    text-align: center;
    border: 1px solid var(--pra-border);
}

.pra-comparison-table th {
    background: rgba(var(--primary-rgb), 0.1);
    font-weight: 600;
}

.pra-comparison-table td {
    background: var(--pra-surface);
}

.pra-comparison-table tr.best td {
    background: rgba(39, 174, 96, 0.1);
}

.pra-comparison-table tr.best td:first-child {
    position: relative;
}

.pra-comparison-table tr.best td:first-child::after {
    content: '🏆';
    margin-left: 0.5rem;
}

.pra-comparison-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 1rem;
    gap: 1rem;
}

.pra-chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 80px;
}

.pra-chart-bar-inner {
    width: 100%;
    background: var(--pra-gradient);
    border-radius: var(--pra-radius) var(--pra-radius) 0 0;
    transition: height 0.5s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.pra-chart-bar-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pra-text);
    text-align: center;
}

/* ===== Address Mapping Results ===== */
.pra-address-results {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.5rem;
}

.pra-address-results h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.pra-address-results h4 i {
    color: var(--pra-primary);
}

.pra-address-table-wrapper {
    overflow-x: auto;
}

.pra-address-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.pra-address-table th,
.pra-address-table td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border: 1px solid var(--pra-border);
}

.pra-address-table th {
    background: rgba(var(--primary-rgb), 0.1);
    font-weight: 600;
}

.pra-address-table td {
    background: var(--pra-surface);
}

.pra-address-table td.hit {
    background: rgba(39, 174, 96, 0.15);
    color: var(--pra-hit-color);
}

.pra-address-table td.fault {
    background: rgba(231, 76, 60, 0.15);
    color: var(--pra-fault-color);
}

/* ===== Educational Notes Section ===== */
.pra-notes-section {
    background: var(--pra-bg);
    border-radius: var(--pra-radius-lg);
    border: 1px solid var(--pra-border);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.pra-notes-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.pra-notes-section h4 i {
    color: var(--pra-secondary);
}

.pra-notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.pra-note-card {
    padding: 1.25rem;
    background: var(--pra-surface);
    border-radius: var(--pra-radius);
    border: 1px solid var(--pra-border);
}

.pra-note-card h5 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--pra-primary);
}

.pra-note-card p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--pra-text);
}

.pra-note-card strong {
    color: var(--pra-warning);
}

/* ===== Toast Container ===== */
.pra-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pra-toast {
    padding: 1rem 1.5rem;
    background: var(--pra-surface);
    border-radius: var(--pra-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-left: 4px solid var(--pra-primary);
    animation: toastSlideIn 0.3s ease;
}

.pra-toast.success {
    border-left-color: var(--pra-success);
}

.pra-toast.error {
    border-left-color: var(--pra-danger);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Modal Styles ===== */
.pra-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pra-modal-overlay.active {
    display: flex;
}

.pra-modal {
    background: var(--pra-surface);
    border-radius: var(--pra-radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pra-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--pra-border);
}

.pra-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.pra-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--pra-text-muted);
    cursor: pointer;
    border-radius: var(--pra-radius);
    transition: all 0.2s ease;
}

.pra-modal-close:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--pra-danger);
}

.pra-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    line-height: 1.7;
}

.pra-modal-body h4 {
    margin: 1.5rem 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--pra-primary);
}

.pra-modal-body kbd {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--pra-bg);
    border: 1px solid var(--pra-border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .pra-main-content {
        grid-template-columns: 1fr;
    }

    .pra-controls-panel {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .pra-container {
        padding: 8px 5px;
        margin-left: -5px;
        margin-right: -5px;
        width: auto;
    }

    .pra-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        gap: 0.75rem;
    }

    .pra-header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .pra-header-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .pra-header h2 {
        font-size: 1.25rem;
    }

    .pra-header p {
        font-size: 0.8rem;
    }

    .pra-privacy-notice {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        flex-wrap: wrap;
    }

    /* Mode Tabs - Full width stacked */
    .pra-mode-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pra-mode-tab {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
        padding: 0.875rem 1rem;
        min-width: unset;
    }

    .pra-mode-tab i {
        font-size: 1.25rem;
        min-width: 24px;
    }

    .pra-mode-tab span {
        font-size: 0.95rem;
    }

    .pra-mode-tab small {
        font-size: 0.7rem;
    }

    /* Controls Panel */
    .pra-controls-panel {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .pra-control-section {
        padding: 1rem;
    }

    .pra-control-section h4 {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }

    /* Textarea fix for mobile */
    .pra-textarea {
        min-height: 100px;
        font-size: 0.85rem;
        word-wrap: break-word;
        white-space: pre-wrap;
        overflow-wrap: break-word;
    }

    /* Preset buttons - scrollable on mobile */
    .pra-preset-inputs {
        margin-top: 0.75rem;
    }

    .pra-preset-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }

    /* Slider */
    .pra-slider-group label {
        font-size: 0.8rem;
    }

    /* Speed buttons */
    .pra-speed-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .pra-speed-btn {
        width: 100%;
        margin: 0;
    }

    /* Algorithm list */
    .pra-algorithm-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .pra-algo-radio {
        padding: 0.6rem 0.75rem;
    }

    .pra-algo-radio .algo-name {
        font-size: 0.85rem;
    }

    .pra-algo-radio .algo-desc {
        font-size: 0.7rem;
    }

    .pra-algorithm-grid {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .pra-algo-checkbox {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
    }

    /* Speed buttons */
    .pra-speed-buttons {
        flex-wrap: wrap;
    }

    .pra-speed-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
    }

    /* Playback controls */
    .pra-playback-controls {
        gap: 0.4rem;
    }

    .pra-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* Frames */
    .pra-frames-section {
        padding: 1rem;
    }

    .pra-frames-container {
        gap: 0.5rem;
    }

    .pra-frame {
        width: 55px;
        height: 55px;
        font-size: 1.1rem;
    }

    .pra-frame::before {
        font-size: 0.6rem;
        top: -16px;
    }

    /* Stats */
    .pra-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .pra-stat-card {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .pra-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .pra-stat-value {
        font-size: 1.25rem;
    }

    .pra-stat-label {
        font-size: 0.7rem;
    }

    /* Notes */
    .pra-notes-section {
        padding: 1rem;
        margin-top: 1rem;
    }

    .pra-notes-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .pra-note-card {
        padding: 1rem;
    }

    .pra-note-card h5 {
        font-size: 0.9rem;
    }

    .pra-note-card p {
        font-size: 0.8rem;
    }

    /* Explanation panel */
    .pra-explanation-panel {
        padding: 1rem;
    }

    .pra-explanation-content {
        font-size: 0.85rem;
    }

    /* Status bar */
    .pra-status-bar {
        padding: 0.6rem 0.75rem;
    }

    .pra-status-item {
        font-size: 0.8rem;
        flex-wrap: wrap;
    }

    /* Tables */
    .pra-table-section {
        padding: 1rem;
    }

    .pra-table-wrapper {
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .pra-table {
        font-size: 0.7rem;
        table-layout: auto;
        min-width: 100%;
    }

    .pra-table th,
    .pra-table td {
        padding: 0.4rem 0.25rem;
        min-width: 32px;
        word-break: break-all;
    }

    /* Ensure visualization sections don't push width */
    .pra-frames-section,
    .pra-table-section,
    .pra-explanation-panel,
    .pra-stats-panel {
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .pra-table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0.5rem;
    }

    /* Address config */
    .pra-computed-info {
        padding: 0.5rem;
    }

    .pra-info-item {
        font-size: 0.8rem;
    }

    /* Modal */
    .pra-modal {
        max-width: 95%;
        max-height: 85vh;
    }

    .pra-modal-header {
        padding: 1rem;
    }

    .pra-modal-header h3 {
        font-size: 1rem;
    }

    .pra-modal-body {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .pra-container {
        padding: 5px 0;
        margin-left: -1rem;
        margin-right: -1rem;
        width: auto;
    }

    .pra-header {
        padding: 0.6rem;
    }

    .pra-header h2 {
        font-size: 1.1rem;
    }

    .pra-header-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .pra-header-actions {
        gap: 0.25rem;
    }

    .pra-btn-icon {
        width: 38px;
        height: 38px;
    }

    /* Mode tabs even smaller */
    .pra-mode-tab {
        padding: 0.75rem 0.875rem;
    }

    .pra-mode-tab i {
        font-size: 1.1rem;
    }

    .pra-mode-tab span {
        font-size: 0.85rem;
    }

    .pra-mode-tab small {
        font-size: 0.65rem;
    }

    /* Control section */
    .pra-control-section {
        padding: 0.75rem;
    }

    .pra-control-section h4 {
        font-size: 0.85rem;
    }

    /* Input */
    .pra-input {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }

    .pra-textarea {
        min-height: 90px;
        font-size: 0.8rem;
    }

    /* Stats grid single column */
    .pra-stats-grid {
        grid-template-columns: 1fr;
    }

    .pra-stat-card {
        flex-direction: row;
    }

    /* Playback */
    .pra-playback-controls {
        flex-direction: column;
    }

    .pra-btn {
        width: 100%;
    }

    /* Frames smaller */
    .pra-frame {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }

    .pra-frame::before {
        font-size: 0.55rem;
        top: -14px;
    }

    /* Table even smaller */
    .pra-table {
        font-size: 0.65rem;
    }

    .pra-table th,
    .pra-table td {
        padding: 0.35rem 0.2rem;
        min-width: 24px;
    }

    /* Preset buttons wrap */
    .pra-preset-inputs {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .pra-preset-btn {
        flex: 1 1 auto;
        min-width: fit-content;
    }

    /* Speed buttons */
    .pra-speed-buttons {
        grid-template-columns: repeat(4, 1fr);
    }

    .pra-speed-btn {
        font-size: 0.65rem;
        padding: 0.4rem 0.2rem;
        text-align: center;
    }

    /* Algorithm radio smaller */
    .pra-algo-radio {
        padding: 0.5rem 0.6rem;
    }

    .pra-algo-radio .radiomark {
        width: 18px;
        height: 18px;
    }

    /* Toast */
    .pra-toast-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .pra-toast {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .pra-frames-section,
    .pra-table-section,
    .pra-explanation-panel,
    .pra-stats-panel,
    .pra-comparison-results,
    .pra-address-results,
    .pra-notes-section {
        padding: 0.75rem;
    }
}

/* ===== Fullscreen Mode ===== */
.pra-container.fullscreen,
.pra-container:fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    background: var(--pra-surface) !important;
    overflow-y: auto !important;
    padding: 2rem !important;
    max-width: none !important;
    margin: 0 !important;
}

@media (max-width: 768px) {

    .pra-container.fullscreen,
    .pra-container:fullscreen {
        padding: 0.75rem !important;
    }
}


/* ===== Extra Small Screens ===== */
@media (max-width: 360px) {
    .pra-header h2 {
        font-size: 1rem;
    }

    .pra-mode-tab {
        padding: 0.6rem 0.75rem;
    }

    .pra-frame {
        width: 42px;
        height: 42px;
        font-size: 0.9rem;
    }

    .pra-preset-btn {
        font-size: 0.65rem;
        padding: 0.35rem 0.5rem;
    }
}