/* BinkTest Custom Styles */

:root {
    --fidonet-blue: #0066cc;
    --fidonet-green: #009900;
    --fidonet-red: #cc0000;
    --fidonet-orange: #ff6600;
    --text-color: #000000;
    --text-color-muted: #6c757d;
    --message-bg: #ffffff;
    --message-quote-bg: #f8f9fa;
    --message-quote-border: #dee2e6;
    --border-color: #dee2e6;
}

/* Prevent horizontal overflow on mobile */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}


.navbar-brand {
    font-weight: bold;
}

.navbar-brand i {
    margin-right: 8px;
}

.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 2px solid var(--fidonet-blue);
    font-weight: 600;
}

/* Recent updates items */
.update-item {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.update-item:hover {

}

.message-item {
    border-bottom: 1px solid #eee;
    padding: 12px 0;
    transition: background-color 0.2s;
}

.message-item:hover {
    background-color: #f8f9fa;
}

.message-item:last-child {
    border-bottom: none;
}

.message-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 4px;
}

.message-from {
    font-weight: 600;
    color: var(--fidonet-blue);
}

.message-date {
    font-size: 0.875em;
    color: #6c757d;
}

.message-subject {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.message-origin {
    font-size: 0.8em;
    color: #6c757d;
    font-style: italic;
}

.fidonet-address {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Table-based message list styles */
.message-table {
    border: none;
}

.message-table thead th {
    background-color: var(--fidonet-blue);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    padding: 12px 8px;
    vertical-align: middle;
}

.message-table tbody td {
    border-top: 1px solid #eee;
    padding: 12px 8px;
    vertical-align: top;
}

.message-row {
    transition: background-color 0.2s ease;
}

.message-row:hover {
    background-color: #f8f9fa;
}

/* Override Bootstrap table-hover to preserve text colors */
.table-hover > tbody > tr:hover > * {
    color: inherit !important;
}

.table-hover > tbody > tr:hover {
    background-color: #f8f9fa !important;
}

.message-table .message-from {
    font-weight: 600;
    color: var(--fidonet-blue);
}

.message-table .message-address {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.message-table .message-subject {
    font-weight: 500;
    color: #333;
    line-height: 1.4;
}

.message-table .message-date {
    font-size: 0.875rem;
    color: #6c757d;
    white-space: nowrap;
}

.message-table .echoarea-tag {
    background-color: var(--fidonet-orange);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Responsive table adjustments */
@media (max-width: 768px) {
    .message-table thead th {
        font-size: 0.75rem;
        padding: 8px 4px;
    }
    
    .message-table tbody td {
        padding: 8px 4px;
        font-size: 0.875rem;
    }
    
    .message-table .message-subject {
        font-size: 0.875rem;
    }
}

.echoarea-tag {
    background-color: var(--fidonet-green);
    color: white;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
}

.netmail-indicator {
    background-color: var(--fidonet-red);
    color: white;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 10px;
}

.compose-form {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.compose-form .form-label {
    font-weight: 600;
    color: #495057;
}

.compose-form textarea {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
}

.btn-fidonet {
    background-color: var(--fidonet-blue);
    border-color: var(--fidonet-blue);
    color: white;
}

.btn-fidonet:hover {
    background-color: #0056b3;
    border-color: #004085;
    color: white;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-online {
    background-color: var(--fidonet-green);
}

.status-offline {
    background-color: #6c757d;
}

.status-error {
    background-color: var(--fidonet-red);
}

.node-list .card-body {
    padding: 0;
}

.node-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.node-item:hover {
    background-color: var(--message-bg);
}

.node-item:last-child {
    border-bottom: none;
}

.node-address {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--fidonet-blue);
}

.node-system {
    font-weight: 500;
    margin-bottom: 2px;
}

.node-sysop {
    color: #6c757d;
    font-size: 0.9em;
}

.footer {
    margin-top: auto;
    padding: 20px 0;
    background-color: #e9ecef;
    border-top: 1px solid #dee2e6;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #6c757d;
}

.error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

.success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Kludge lines styling */
.kludge-lines {
    font-family: 'Courier New', monospace;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--kludge-bg);
}

.kludge-lines pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--kludge-text);
    background-color: var(--kludge-bg);
    line-height: 1.3;
}

.message-headers {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
}

.message-headers h6 {
    color: #495057;
    font-weight: 600;
}

#toggleHeaders {
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

#toggleHeaders:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Animation for kludge line toggle */
#kludgeContainer {
    overflow: hidden;
    transition: height 0.3s ease;
}

/* Kludge line color coding legend (for reference in comments)
 * MSGID: #28a745 (Green) - Message ID
 * REPLY: #17a2b8 (Info/Blue) - Reply ID
 * INTL: #ffc107 (Warning/Yellow) - International routing
 * TOPT/FMPT: #fd7e14 (Orange) - To/From points
 * PID: #e83e8c (Pink) - Product ID
 * SEEN-BY: #6f42c1 (Purple) - Seen by nodes
 * PATH: #20c997 (Teal) - Message path
 * Origin: #6c757d (Gray, Italic) - Origin line
 * Tearline: #adb5bd (Light gray) - Tearline
 * Generic: #dc3545 (Red) - Other kludge lines
 * Text: #f8f9fa (Light) - Regular text
 */

/* Echo area management styles */
.echoarea-color-selector {
    border-radius: 4px;
    transition: border-left 0.2s ease;
}

.color-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .message-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-date {
        margin-top: 4px;
    }

    .compose-form {
        padding: 15px;
    }

    .message-headers {
        padding: 10px;
    }

    .kludge-lines pre {
        font-size: 0.8rem;
    }

    #toggleHeaders {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* Mobile filter controls - used on netmail/echomail pages */
@media (max-width: 575.98px) {
    .filter-controls {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }

    .filter-controls .btn-group {
        flex-shrink: 0;
    }

    .filter-controls .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Mobile-friendly message formatting */
.message-formatted {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-paragraph {
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.message-line {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    display: inline;
}

.message-link {
    color: var(--bs-link-color, #0d6efd);
    text-decoration: underline;
    word-break: break-all;
}

.message-link:hover {
    color: var(--bs-link-hover-color, #0a58ca);
    text-decoration: underline;
}

.message-quote {
    border-left: 3px solid var(--message-quote-border);
    padding-left: 1rem;
    margin: 0;
    background-color: var(--message-quote-bg);
    border-radius: 0 0.25rem 0.25rem 0;
}

.quote-line {
    margin-bottom: 0.25rem;
    color: var(--text-color-muted);
    font-style: italic;
}

/* Multi-level quote coloring */
.quote-level-1 {
    color: #2e7d32;  /* Green */
    font-style: normal;
}

.quote-level-2 {
    color: #1565c0;  /* Blue */
    font-style: normal;
}

.quote-level-3 {
    color: #7b1fa2;  /* Purple */
    font-style: normal;
}

.quote-level-4 {
    color: #c62828;  /* Red - deepest quotes */
    font-style: normal;
}

.message-signature {
    color: var(--text-color-muted);
    font-size: 0.9em;
    margin-bottom: 0.5rem;
}

.message-signature-separator {
    color: var(--text-color-muted);
    margin: 1rem 0 0.5rem 0;
    font-family: monospace;
}

.message-preformatted {
    background-color: var(--message-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'Courier New', Monaco, Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-x: auto;
    color: var(--text-color);
}

/* Legacy message text styles - enhanced for mobile */
.message-text pre {
    background-color: var(--message-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'Courier New', Monaco, Consolas, monospace;
    font-size: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-x: auto;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .message-formatted {
        font-size: 16px;
        line-height: 1.5;
    }
    
    .message-paragraph {
        margin-bottom: 1rem;
    }
    
    .message-quote {
        padding-left: 0.75rem;
    }
    
    .message-preformatted {
        font-size: 14px;
        padding: 0.75rem;
        border-radius: 0.25rem;
    }
    
    .message-text pre {
        font-size: 14px;
        padding: 0.75rem;
        border-radius: 0.25rem;
    }
    
    .quote-line {
        font-size: 15px;
    }
}

@media (max-width: 576px) {
    .message-formatted {
        font-size: 16px;
        line-height: 1.4;
    }
    
    .message-preformatted {
        font-size: 13px;
        padding: 0.5rem;
    }
    
    .message-text pre {
        font-size: 13px;
        padding: 0.5rem;
    }
    
    .message-quote {
        padding-left: 0.5rem;
        border-left-width: 2px;
    }
}



/* ===========================================
   ANSI Escape Code Styles
   For rendering BBS/terminal colored text
   =========================================== */

/* ANSI Text Attributes */
.ansi-bold { font-weight: bold; }
.ansi-dim { opacity: 0.7; }
.ansi-italic { font-style: italic; }
.ansi-underline { text-decoration: underline; }
.ansi-blink { animation: ansi-blink 1s step-end infinite; }
.ansi-reverse { filter: invert(1); }
.ansi-hidden { visibility: hidden; }
.ansi-strike { text-decoration: line-through; }

@keyframes ansi-blink {
    50% { opacity: 0; }
}

/* ANSI Standard Foreground Colors (30-37) */
.ansi-black { color: #000000; }
.ansi-red { color: #cc0000; }
.ansi-green { color: #00cc00; }
.ansi-yellow { color: #cccc00; }
.ansi-blue { color: #0000cc; }
.ansi-magenta { color: #cc00cc; }
.ansi-cyan { color: #00cccc; }
.ansi-white { color: #cccccc; }

/* ANSI Bright Foreground Colors (90-97) */
.ansi-bright-black { color: #666666; }
.ansi-bright-red { color: #ff0000; }
.ansi-bright-green { color: #00ff00; }
.ansi-bright-yellow { color: #ffff00; }
.ansi-bright-blue { color: #0000ff; }
.ansi-bright-magenta { color: #ff00ff; }
.ansi-bright-cyan { color: #00ffff; }
.ansi-bright-white { color: #ffffff; }

/* ANSI Standard Background Colors (40-47) */
.ansi-bg-black { background-color: #000000; }
.ansi-bg-red { background-color: #cc0000; }
.ansi-bg-green { background-color: #00cc00; }
.ansi-bg-yellow { background-color: #cccc00; }
.ansi-bg-blue { background-color: #0000cc; }
.ansi-bg-magenta { background-color: #cc00cc; }
.ansi-bg-cyan { background-color: #00cccc; }
.ansi-bg-white { background-color: #cccccc; }

/* ANSI Bright Background Colors (100-107) */
.ansi-bg-bright-black { background-color: #666666; }
.ansi-bg-bright-red { background-color: #ff0000; }
.ansi-bg-bright-green { background-color: #00ff00; }
.ansi-bg-bright-yellow { background-color: #ffff00; }
.ansi-bg-bright-blue { background-color: #0000ff; }
.ansi-bg-bright-magenta { background-color: #ff00ff; }
.ansi-bg-bright-cyan { background-color: #00ffff; }
.ansi-bg-bright-white { background-color: #ffffff; }

/* Container for ANSI-formatted content - use monospace for proper art display */
.ansi-content {
    font-family: 'Courier New', Consolas, monospace;
    white-space: pre;
    line-height: 1.2;
}

/* Expanded message modal on desktop */
@media (min-width: 992px) {
    .modal-dialog.modal-message-reader {
        --bs-modal-width: 1200px;
    }
}

/* Echolist page - Light theme overrides */
#echolist-page .forums-table {
    background: #ffffff;
    border-color: #dee2e6;
}

#echolist-page .forum-item {
    border-bottom-color: #e9ecef;
}

#echolist-page .forum-item:hover {
    background-color: #f8f9fa;
}

#echolist-page .forum-title {
    color: #2c3e50;
}

#echolist-page .forum-title-link {
    color: #0066cc;
}

#echolist-page .forum-title-link:hover {
    color: #004999;
}

#echolist-page .forum-desc {
    color: #6c757d;
}

#echolist-page .forum-mod {
    color: #868e96;
}

#echolist-page .stat-number {
    color: #0066cc;
}

#echolist-page .stat-label {
    color: #6c757d;
}

#echolist-page .lastpost-subject {
    color: #2c3e50;
}

#echolist-page .lastpost-by {
    color: #6c757d;
}

#echolist-page .lastpost-time {
    color: #868e96;
}

#echolist-page .stat-box h5 {
    color: #0066cc;
}

#echolist-page .stat-box small {
    color: #6c757d;
}

#echolist-page .empty-state,
#echolist-page .loading {
    color: #6c757d;
}

@media (max-width: 575.98px) {
    #echolist-page .forum-stats-cell {
        border-top-color: #e9ecef;
    }
}
