:root {
    --primary: #1e293b;       /* Deep Slate */
    --accent: #3b82f6;        /* Vibrant Royal Blue */
    --accent-hover: #2563eb;  /* Darker Blue */
    --bg: #f8fafc;            /* Clean off-white background */
    --surface: #ffffff;       /* Pure white for cards */
    --text: #334155;          /* Charcoal text */
    --text-muted: #64748b;    /* Cool gray for subtitles */
    --border: #e2e8f0;        /* Subtle divider lines */
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 0; 
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container { 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 0 20px 40px 20px; 
}

/* --- HEADER SYSTEM (Matches Admin Layout) --- */

/* Top Isolated Logo Bar */
.top-logo-bar {
    background: var(--surface);
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

/* Main Navigation/Header Title Bar Below */
.public-header { 
    background: var(--surface); 
    border-bottom: 1px solid var(--border);
    padding: 20px 0; 
    margin-bottom: 40px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* Standardized flex container for alignment consistency */
.header-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
}

/* Align and Center Title Elements */
.public-header .header-container {
    justify-content: center; 
}

.portal-logo {
    height: 45px;
    width: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.portal-logo:hover {
    transform: scale(1.03);
}

/* Centered & Prominent Header Title */
.public-header h1 { 
    margin: 0; 
    font-size: 2.2rem; 
    font-weight: 800;  
    color: var(--primary); 
    letter-spacing: -1px;
    cursor: pointer;
    width: 100%;       
    text-align: center; 
}


/* --- PAGE LAYOUT & NAVIGATION ELEMENTS --- */

.title-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px; 
}

.title-row h2 { 
    margin: 0; 
    font-size: 1.6rem; 
    font-weight: 700;
    color: var(--primary); 
    letter-spacing: -0.5px;
}

.title-row small {
    display: block;
    margin-top: 4px;
    font-size: 0.9rem;
    color: var(--text-muted);
}


/* --- PREMIUM SELECTION CARDS --- */

.selection-grid { 
    display: flex;
    flex-direction: column;
    gap: 16px; 
}

.select-card {
    background: var(--surface);
    padding: 22px 28px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-card:hover { 
    border-color: #cbd5e1;
    transform: translateY(-2px); 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

.select-card:active { 
    transform: translateY(0); 
}

.select-card span {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
}

.arrow { 
    color: var(--text-muted);
    font-weight: bold;
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.select-card:hover .arrow {
    color: var(--accent);
    transform: translateX(4px);
}

/* Message Items Selection Layout Modifications */
.message-item { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 20px; 
}

.msg-info strong {
    font-size: 1.25rem;
    color: var(--primary);
    display: block;
    margin-bottom: 4px;
}

.msg-actions { 
    display: flex; 
    gap: 12px; 
    width: 100%; 
}


/* --- SPLIT SCREEN TEXT VIEW SYSTEM --- */

.split-view {
    display: flex;
    gap: 25px;
    margin-top: 20px;
    align-items: stretch;
}

.view-column {
    flex: 1;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

/* Subtle accent highlight on target translation block */
.translation-box {
    border-left: 3px solid var(--accent);
}

.translation-box[dir="rtl"] {
    border-left: 1px solid var(--border);
    border-right: 3px solid var(--accent);
}

.column-header {
    background: #f8fafc;
    padding: 12px 24px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.message-content {
    padding: 30px;
}

.text-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #1e293b;
    white-space: pre-wrap;
}


/* --- BUTTON TOOLKIT --- */

.btn { 
    padding: 12px 24px; 
    border-radius: 8px; 
    text-decoration: none; 
    display: inline-flex; 
    align-items: center;
    justify-content: center; 
    font-weight: 600; 
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer; 
}

.btn-primary { 
    background: var(--accent); 
    color: white; 
    flex: 1; 
    border: none;
}

.btn-primary:hover { 
    background: var(--accent-hover); 
}

.btn-outline { 
    border: 2px solid var(--border); 
    color: var(--text); 
    background: transparent;
    flex: 1; 
}

.btn-outline:hover { 
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-secondary { 
    background: #f1f5f9; 
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    padding: 8px 16px;
}

.btn-secondary:hover {
    background: #e2e8f0;
}


/* --- MICRO TRANSITIONS --- */

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* --- MEDIA QUERIES FOR RESPONSIVE MOBILE VIEWPORTS --- */

@media (max-width: 850px) {
    .split-view {
        flex-direction: column; /* Stack English above translation on tablet/phone */
    }
}

@media (max-width: 600px) {
    .top-logo-bar {
        text-align: center;
    }
    .top-logo-bar .header-container {
        justify-content: center;
    }
    .public-header {
        margin-bottom: 25px;
    }
    .public-header h1 {
        font-size: 1.8rem; /* Keeps layout title balanced on small mobile devices */
        letter-spacing: -0.5px;
    }
    .msg-actions { 
        flex-direction: column; 
        gap: 10px; 
    }
    .title-row { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 15px; 
    }
    .btn-secondary { 
        width: 100%; 
        text-align: center; 
    }
    .select-card { 
        padding: 18px 20px; 
    }
}