/*
 * Copyright (c) 2025 sndnss aps
 *
 * sndnss® charprism is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/
 */

:root {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    --accent-color: #3b82f6;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    width: 90%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.branding {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header img {
    height: 40px;
    width: auto;
}

.header h2 {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 18px;
    letter-spacing: -0.025em;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--accent-color);
}

.container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--accent-color);
}

#output {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 100px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    overflow: hidden;
}

#legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.color-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Base style for highlighted characters */
.char {
    border-radius: 2px;
    display: inline-block;
    color: #000; /* Keep text dark on pastel backgrounds */
}

.char-invisible {
    min-width: 5px;
    border: 1px dashed #666;
}

/* Line-by-line layout */
.line-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}
.line-row:last-child {
    border-bottom: none;
}
.line-num {
    width: 40px;
    padding: 8px;
    color: #6b7280;
    font-size: 11px;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    background: #1a2233;
}
.line-text {
    flex: 1;
    padding: 8px 12px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
}
.line-meta {
    width: 280px;
    padding: 8px;
    background: #1a2233;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}
.mini-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background-color: rgba(255,255,255,0.1);
    color: var(--text-secondary);
    height: fit-content;
    display: flex;
    align-items: center;
    gap: 4px;
}
.mini-tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.footer a {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: hidden; 
    background-color: rgba(0,0,0,0.7); 
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--bg-secondary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.close-modal {
    color: var(--text-secondary);
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    z-index: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--text-primary);
    text-decoration: none;
}

.legal-section {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.legal-section:last-child {
    border-bottom: none;
}

.legal-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legal-section p, .legal-section li {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 5px 0;
}

.legal-section ul {
    padding-left: 20px;
    margin: 5px 0;
}

.legal-section a {
    color: var(--accent-color);
    text-decoration: none;
}

.legal-section a:hover {
    text-decoration: underline;
}

/* Scrollable content area for modals */
.modal-scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.modal-scrollable-content::-webkit-scrollbar {
    width: 6px;
}

.modal-scrollable-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-scrollable-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}
