:root {
    /* الوضع الليلي الافتراضي (Dark Mode - War Room) */
    --bg-main: #071220;         
    --bg-sidebar: #040A12;      
    --bg-card: #0D1E32;         
    --bg-input: #071220;        
    --text-white: #FFFFFF;      
    --text-muted: #8AA4C0;      
    --border-color: rgba(255, 255, 255, 0.08);
    --gold-primary: #D4AF37;    
    --gold-hover: #E5C354;
    --gold-dim: rgba(212, 175, 55, 0.1);
    --danger-red: #E74C3C;
    --danger-bg: rgba(231, 76, 60, 0.1);
    --success-green: #2ecc71;
    --success-bg: rgba(46, 204, 113, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.4);
    --logo-blend: screen;       
    
    --radius-lg: 16px; 
    --radius-md: 10px; 
    --radius-sm: 6px;
    --font-main: 'Cairo', sans-serif;
}

body.light-theme {
    /* الوضع النهاري (Light Mode - Executive Reports) */
    --bg-main: #F5F7FA;         
    --bg-sidebar: #FFFFFF;      
    --bg-card: #FFFFFF;         
    --bg-input: #F0F3F7;        
    --text-white: #1A2B3C;      
    --text-muted: #5A6A7E;      
    --border-color: rgba(0, 0, 0, 0.08);
    --gold-primary: #B58B00;    
    --gold-hover: #D4AF37;
    --gold-dim: rgba(181, 139, 0, 0.08);
    --danger-red: #D32F2F;
    --danger-bg: rgba(211, 47, 47, 0.08);
    --success-green: #27ae60;
    --success-bg: rgba(39, 174, 96, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.04);
    --logo-blend: multiply;     
}

/* ================== Reset & Base ================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: var(--font-main); 
    background-color: var(--bg-main); 
    color: var(--text-white); 
    display: flex; 
    height: 100vh; 
    overflow: hidden; 
    transition: background-color 0.4s ease, color 0.4s ease;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--gold-primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #B58B00; }

/* ================== Sidebar ================== */
.sidebar { 
    width: 280px; 
    min-width: 280px; 
    flex-shrink: 0; 
    background: var(--bg-sidebar); 
    display: flex; 
    flex-direction: column; 
    padding: 30px 15px; 
    border-left: 1px solid var(--border-color); 
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.logo-container { text-align: center; margin-bottom: 40px; }

.logo-img {
    width: 85%; 
    max-width: 180px; 
    height: auto; 
    margin: 0 auto 10px auto; 
    display: block; 
    background-color: transparent !important;
    mix-blend-mode: var(--logo-blend); 
    transition: mix-blend-mode 0.4s ease;
}

.brand-subtitle {
    color: #ffffff !important;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    transition: all 0.4s ease-in-out;
    cursor: default;
    margin-top: 10px;
}
.brand-subtitle:hover { letter-spacing: 4px; text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); transform: scale(1.02); }

.nav-menu { flex-grow: 1; min-height: min-content; }
.nav-btn { 
    background: transparent; 
    color: var(--text-muted); 
    border: none; 
    width: 100%; 
    text-align: right; 
    padding: 14px 20px; 
    margin-bottom: 8px; 
    border-radius: var(--radius-md); 
    cursor: pointer; 
    font-size: 0.95rem; 
    font-weight: 700; 
    transition: all 0.3s ease; 
    font-family: inherit; 
    display: flex; 
    align-items: center; 
    gap: 15px; 
}
.nav-btn i { font-size: 1.1rem; width: 24px; text-align: center; }
.nav-btn:hover { color: var(--gold-primary); background: var(--gold-dim); transform: translateX(-5px); }
.nav-btn.active { background: var(--gold-primary); color: #FFFFFF; font-weight: 800; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2); }

.sidebar-footer { padding-top: 20px; border-top: 1px solid var(--border-color); }
.logout-btn { color: var(--danger-red); }
.logout-btn:hover { background: var(--danger-bg); color: var(--danger-red); }

/* ================== Main Content Area ================== */
.main-wrapper { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-bar { height: 100px; display: flex; justify-content: space-between; align-items: center; padding: 0 40px; border-bottom: 1px solid transparent; }
.page-header-info { text-align: right; }
.top-title { font-size: 1.7rem; font-weight: 800; margin-bottom: 5px; color: var(--text-white); }
.sub-title { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; font-weight: 600; }

.btn-outline-gold { 
    background: transparent; 
    color: var(--gold-primary); 
    border: 2px solid var(--gold-primary); 
    padding: 10px 22px; 
    border-radius: var(--radius-md); 
    font-family: inherit; 
    font-weight: 800; 
    cursor: pointer; 
    transition: 0.3s; 
    display: flex; 
    gap: 8px; 
    align-items: center; 
}
.btn-outline-gold:hover { background: var(--gold-primary); color: #fff; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3); }

.main-content { 
    flex-grow: 1; 
    padding: 0 40px 40px 40px; 
    overflow-y: auto; 
    overflow-x: hidden;
    max-height: calc(100vh - 90px);
    padding-bottom: 30px;
}
.page-section { display: none; animation: fadeUp 0.4s ease forwards; }
.active-section { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* ================== Dashboard Stats ================== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 25px; }
.stat-card { 
    background: var(--bg-card); 
    padding: 25px; 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-color); 
    box-shadow: 0 8px 25px var(--shadow-color);
    transition: transform 0.3s ease, background-color 0.4s ease;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--gold-primary); }
.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.stat-header h3 { font-size: 0.95rem; color: var(--text-muted); font-weight: 700; }
.stat-icon { color: var(--gold-primary); font-size: 1.4rem; opacity: 0.8; }

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-white);
    margin-top: 10px;
    word-break: break-word;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
    direction: ltr;
}
.text-gold { color: var(--gold-primary) !important; font-size: 1.3rem; line-height: 2.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}

/* ================== Ticker Tape (News Flash) ================== */
.news-ticker-container {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 25px;
    height: 48px;
    box-shadow: 0 4px 15px var(--shadow-color);
    position: relative;
}
.ticker-label {
    background: var(--danger-red);
    color: white;
    padding: 0 25px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    z-index: 5;
    box-shadow: -4px 0 15px rgba(0,0,0,0.3);
    white-space: nowrap;
    position: relative;
}
.ticker-wrap {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    direction: ltr; /* To make marquee logic standard */
}
.ticker-move {
    display: flex;
    white-space: nowrap;
    animation: ticker 35s linear infinite;
    direction: rtl; /* Content remains Arabic RTL */
}
.ticker-move:hover { animation-play-state: paused; cursor: default; }
.ticker-item {
    padding: 0 35px;
    color: var(--text-white);
    font-weight: 600;
    position: relative;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ticker-item::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--gold-primary);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}
@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ================== Word Cloud ================== */
.word-cloud-container {
    min-height: 220px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px inset var(--border-color);
}
.cloud-word {
    cursor: default;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s ease, text-shadow 0.3s ease;
    font-weight: 800;
    display: inline-block;
    padding: 5px;
}
.cloud-word:hover {
    transform: scale(1.3) !important;
    color: var(--gold-primary) !important;
    text-shadow: 0 0 15px var(--gold-primary);
    z-index: 10;
    position: relative;
}

/* ================== Charts ================== */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.chart-card { 
    background: var(--bg-card); 
    padding: 25px; 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-color); 
    box-shadow: 0 8px 25px var(--shadow-color);
    transition: background-color 0.4s ease;
}
.chart-card h3 { font-size: 1.05rem; color: var(--text-white); margin-bottom: 20px; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.chart-card h3 i { color: var(--gold-primary); }

/* ================== Forms (Monitors & Radars) ================== */
.form-container { max-width: 950px; margin: 0 auto; }
.form-card { 
    background: var(--bg-card); 
    padding: 35px; 
    border-radius: var(--radius-lg); 
    margin-bottom: 25px; 
    border: 1px solid var(--border-color); 
    box-shadow: 0 8px 25px var(--shadow-color);
    transition: background-color 0.4s ease;
}
.radar-config-card { border-top: 4px solid var(--gold-primary); }
.card-title { font-size: 1.2rem; margin-bottom: 30px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; color: var(--gold-primary); font-weight: 800; }
.input-row { display: flex; gap: 25px; }
.input-group { flex: 1; margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 12px; color: var(--text-muted); font-size: 0.95rem; font-weight: 700; }

select.custom-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23D4AF37" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: left 15px center; 
    padding-left: 40px;
    cursor: pointer;
}
select.custom-input option {
    background-color: var(--bg-card);
    color: var(--text-white);
    padding: 10px;
    font-family: var(--font-main);
}
body.light-theme select.custom-input {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23B58B00" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
}

.custom-input { 
    width: 100%; 
    padding: 16px; 
    background: var(--bg-input); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md); 
    color: var(--text-white); 
    font-family: inherit; 
    font-size: 1rem; 
    transition: all 0.3s ease; 
}
.custom-input:focus { outline: none; border-color: var(--gold-primary); box-shadow: 0 0 0 3px var(--gold-dim); }
.textarea-large { min-height: 130px; resize: vertical; }
.textarea-small { min-height: 90px; resize: vertical; }

/* ================== Platforms Grid ================== */
.platforms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; direction: rtl; }
.platform-checkbox { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: var(--bg-input); 
    padding: 16px 20px; 
    border-radius: var(--radius-md); 
    cursor: pointer; 
    border: 1px solid var(--border-color); 
    font-weight: 700; 
    color: var(--text-white); 
    transition: all 0.3s ease;
}
.platform-checkbox:hover { border-color: var(--gold-primary); }
.platform-checkbox span { display: flex; align-items: center; gap: 10px; }
.platform-checkbox span i { color: var(--gold-primary); font-size: 1.2rem; width: 20px; text-align: center; }

.platform-checkbox input[type="checkbox"] { 
    appearance: none; 
    width: 22px; 
    height: 22px; 
    border: 2px solid var(--text-muted); 
    border-radius: 5px; 
    background: transparent; 
    cursor: pointer; 
    position: relative; 
    transition: all 0.2s ease;
}
.platform-checkbox input[type="checkbox"]:checked { background: var(--gold-primary); border-color: var(--gold-primary); }
.platform-checkbox input[type="checkbox"]:checked::after { 
    content: '\f00c'; 
    font-family: 'Font Awesome 6 Free'; 
    font-weight: 900; 
    position: absolute; 
    color: #fff; 
    font-size: 14px; 
    top: 50%; left: 50%; 
    transform: translate(-50%, -50%); 
}

/* ================== Actions ================== */
.form-actions { display: flex; justify-content: center; gap: 20px; margin-top: 30px; }
.btn-primary { 
    background: var(--gold-primary); 
    color: #ffffff; 
    border: none; 
    padding: 16px 40px; 
    border-radius: var(--radius-md); 
    font-size: 1.1rem; 
    font-weight: 800; 
    cursor: pointer; 
    font-family: inherit; 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
}
.btn-primary:hover { background: var(--gold-hover); transform: translateY(-2px); box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4); }

/* ================== Results Explorer & Filters ================== */
.results-layout { display: flex; gap: 30px; height: calc(100vh - 140px); }

.filters-sidebar { 
    flex: 0 0 250px !important; 
    width: 250px !important; 
    max-width: 250px !important; 
    background: var(--bg-card); 
    border-radius: var(--radius-lg); 
    padding: 30px 20px; 
    border: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    gap: 30px; 
    box-shadow: 0 8px 25px var(--shadow-color);
    overflow-x: hidden;
}
.filter-header h3 { font-size: 1.1rem; color: var(--gold-primary); font-weight: 800; text-align: center; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; }
.filter-group h4 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 15px; font-weight: 700; }
.filter-options { display: flex; flex-direction: column; gap: 12px; }
.filter-option { display: flex; justify-content: space-between; align-items: center; cursor: pointer; color: var(--text-white); font-size: 0.95rem; font-weight: 600; direction: ltr;}
.filter-option span { direction: rtl; display: flex; align-items: center; gap: 10px; }
.filter-option span i { color: var(--text-muted); width: 20px; text-align: center; transition: color 0.3s; }
.filter-option:hover span i { color: var(--gold-primary); }

.filter-option input[type="radio"] { 
    appearance: none; 
    width: 18px; 
    height: 18px; 
    border-radius: 50%; 
    border: 2px solid var(--text-muted); 
    background: transparent; 
    cursor: pointer; 
    transition: 0.2s;
}
.filter-option input[type="radio"]:checked { border-color: var(--gold-primary); border-width: 5px; }

.btn-reset-filters { background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-white); padding: 12px; border-radius: var(--radius-md); font-family: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; margin-top: auto; text-align: center; transition: 0.3s; display: flex; justify-content: center; align-items: center; gap: 8px;}
.btn-reset-filters:hover { background: var(--danger-bg); color: var(--danger-red); border-color: var(--danger-red); }

/* ================== Data Tables (Professional View) ================== */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}
.marsad-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}
.marsad-table th {
    background-color: var(--bg-input);
    color: var(--gold-primary);
    font-weight: 800;
    text-align: right;
    padding: 16px;
    border-bottom: 2px solid var(--gold-primary);
    white-space: nowrap;
}
.marsad-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-white);
    vertical-align: middle;
    font-size: 0.95rem;
    line-height: 1.6;
}
.marsad-table tbody tr {
    transition: background-color 0.2s ease;
}
.marsad-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}
body.light-theme .marsad-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}
.table-snippet {
    max-width: 450px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-table-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
    padding: 5px;
}
.btn-table-action:hover { color: var(--gold-primary); }
.btn-table-action.delete:hover { color: var(--danger-red); }

/* ================== Results Grid ================== */
.results-main-area { 
    flex: 1; 
    min-width: 0; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; 
    align-items: stretch; 
    padding-bottom: 20px;
}

.results-grid { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    width: 100%; 
    max-height: 75vh; 
    overflow-y: auto; 
    padding-right: 15px; 
    align-items: stretch; 
}

.result-card { 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md); 
    padding: 30px; 
    width: 100%; 
    transition: all 0.3s; 
    box-shadow: 0 4px 15px var(--shadow-color);
}
.result-card:hover { border-color: var(--gold-primary); box-shadow: 0 8px 30px var(--shadow-color); transform: translateY(-2px); }

.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.result-platform { font-weight: 800; color: var(--gold-primary); display: flex; gap: 10px; align-items: center; font-size: 1.15rem; }
.result-sentiment { padding: 6px 18px; border-radius: 30px; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.5px;}

.sentiment-positive { background-color: rgba(46, 204, 113, 0.2) !important; color: #2ecc71 !important; border: 1px solid #2ecc71 !important; }
.sentiment-negative { background-color: rgba(231, 76, 60, 0.2) !important; color: #E74C3C !important; border: 1px solid #E74C3C !important; }
.sentiment-neutral { background-color: rgba(138, 164, 192, 0.2) !important; color: #8AA4C0 !important; border: 1px solid #8AA4C0 !important; }

.result-content { font-size: 1.05rem; line-height: 1.8; color: var(--text-white); margin-bottom: 25px; }

.result-meta { 
    background: var(--bg-input); 
    padding: 15px 20px; 
    border-radius: var(--radius-sm); 
    font-size: 0.9rem; 
    color: var(--text-muted); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 10px; 
    border: 1px solid var(--border-color); 
}
.result-meta > div { display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.result-meta strong { color: var(--text-white); }
.result-link { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-primary); text-decoration: none; font-weight: 800; font-size: 0.95rem; }
.result-link:hover { text-decoration: underline; color: var(--gold-hover); }

.result-content, .result-header, .result-meta {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: normal !important;
}

/* ================== UI Toggle & Micro Delete Buttons ================== */
.ui-toggle-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.ui-toggle-switch button { transition: all 0.3s ease; }

.btn-delete-card {
    background-color: transparent;
    color: var(--danger-red);
    border: 1px solid var(--danger-red);
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-delete-card:hover { background-color: var(--danger-red); color: #fff; }

/* ================== Reports Grid ================== */
.reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 25px; width: 100%; align-items: start;}
.report-card { 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-lg); 
    padding: 30px; 
    display: flex; 
    flex-direction: column; 
    gap: 18px; 
    transition: 0.3s;
    box-shadow: 0 5px 20px var(--shadow-color);
}
.report-card:hover { border-color: var(--gold-primary); transform: translateY(-4px); box-shadow: 0 12px 30px var(--shadow-color);}
.report-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--border-color); padding-bottom: 15px;}
.report-title { font-size: 1.25rem; font-weight: 800; color: var(--gold-primary); margin-bottom: 8px; line-height: 1.4;}
.report-date { font-size: 0.85rem; color: var(--text-muted); display: flex; gap: 8px; align-items: center;}
.report-meta-item { font-size: 0.95rem; color: var(--text-white); line-height: 1.6; display: flex; gap: 10px; align-items: center;}
.report-meta-item i { color: var(--gold-primary); width: 16px; text-align: center;}
.report-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.r-tag { padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 800; background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-white);}
.r-pos { color: var(--success-green); border-color: var(--success-green); background: var(--success-bg);}
.r-neg { color: var(--danger-red); border-color: var(--danger-red); background: var(--danger-bg);}
.btn-open-report { background: var(--gold-dim); color: var(--gold-primary); border: 1px solid var(--gold-primary); padding: 14px; border-radius: var(--radius-md); font-weight: 800; cursor: pointer; text-align: center; margin-top: 15px; font-family: inherit; transition: 0.3s; width: 100%; font-size: 1rem; display: flex; justify-content: center; align-items: center; gap: 10px;}
.btn-open-report:hover { background: var(--gold-primary); color: #fff; }

/* ================== Trend Radar Dashboard ================== */
.radar-dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin-top: 35px; }
.radar-main-card { 
    background: var(--bg-card); 
    padding: 30px; 
    border-radius: var(--radius-lg); 
    border-right: 5px solid var(--gold-primary); 
    box-shadow: 0 10px 30px var(--shadow-color); 
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}
.radar-main-card h4 { font-size: 1.15rem; margin-bottom: 25px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 15px;}
.full-width { grid-column: 1 / -1; }
.radar-list { display: flex; flex-direction: column; gap: 12px; }
.radar-item { 
    background: var(--bg-input); 
    padding: 18px; 
    border-radius: var(--radius-md); 
    border: 1px solid var(--border-color); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    transition: 0.3s;
}
.radar-item:hover { border-color: var(--gold-primary); }
.radar-item strong { color: var(--text-white); font-size: 1.05rem;}
.tag-pos { color: var(--success-green); font-weight: 800; background: var(--success-bg); padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; border: 1px solid var(--success-green);}
.tag-neg { color: var(--danger-red); font-weight: 800; background: var(--danger-bg); padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; border: 1px solid var(--danger-red);}

.radar-prediction-box { text-align: center; padding: 25px; background: var(--bg-input); border-radius: var(--radius-md); border: 1px solid var(--border-color);}
.prediction-header { font-size: 1.5rem; font-weight: 800; color: var(--gold-primary); margin-bottom: 15px; }
.radar-prediction-box p { font-size: 1.1rem; line-height: 1.8; color: var(--text-white);}
.timing-tag { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; background: var(--gold-dim); color: var(--gold-primary); padding: 8px 20px; border-radius: 30px; font-weight: 800; border: 1px solid var(--gold-primary); font-size: 1rem;}

.radar-actions-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 15px;}
.radar-actions-list li { 
    background: var(--bg-input); 
    padding: 20px 25px 20px 50px; 
    border-radius: var(--radius-md); 
    border-right: 5px solid #3498db; 
    position: relative; 
    color: var(--text-white);
    font-size: 1.05rem;
    line-height: 1.6;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}
.radar-actions-list li::before { 
    content: '\f058'; 
    font-family: 'Font Awesome 6 Free'; 
    font-weight: 900; 
    position: absolute; 
    right: -30px; 
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-primary); 
    font-size: 1.5rem;
    background: var(--bg-card);
    border-radius: 50%;
}

/* ================== Quill.js Overrides (Dark/Light Mode Sync) ================== */
.ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--bg-input) !important;
    font-family: var(--font-main);
}
.ql-container.ql-snow {
    border: none !important;
    font-family: var(--font-main) !important;
    font-size: 1.1rem;
}
.ql-editor {
    color: var(--text-white);
    min-height: 250px;
    line-height: 1.8;
}
.ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: italic;
    right: 15px; /* RTL fix */
    left: auto;
}
/* Toolbar Icons Color Sync */
.ql-snow .ql-stroke { stroke: var(--text-muted) !important; }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: var(--text-muted) !important; }
.ql-snow .ql-picker { color: var(--text-muted) !important; }
/* Active/Hover states */
.ql-snow .ql-picker-label:hover, .ql-snow .ql-picker-label.ql-active,
.ql-snow .ql-picker-item:hover, .ql-snow .ql-picker-item.ql-selected,
.ql-snow button:hover, .ql-snow button.ql-active {
    color: var(--gold-primary) !important;
}
.ql-snow .ql-picker-label:hover .ql-stroke, .ql-snow .ql-picker-label.ql-active .ql-stroke,
.ql-snow .ql-picker-item:hover .ql-stroke, .ql-snow .ql-picker-item.ql-selected .ql-stroke,
.ql-snow button:hover .ql-stroke, .ql-snow button.ql-active .ql-stroke {
    stroke: var(--gold-primary) !important;
}
.ql-snow .ql-picker-label:hover .ql-fill, .ql-snow .ql-picker-label.ql-active .ql-fill,
.ql-snow .ql-picker-item:hover .ql-fill, .ql-snow .ql-picker-item.ql-selected .ql-fill,
.ql-snow button:hover .ql-fill, .ql-snow button.ql-active .ql-fill {
    fill: var(--gold-primary) !important;
}
.ql-snow .ql-picker-options {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* ================== Settings ================== */
.llm-selector-grid { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 25px;}
.llm-pill { 
    background: var(--bg-input); 
    border: 1px solid var(--border-color); 
    padding: 12px 25px; 
    border-radius: 30px; 
    color: var(--text-muted); 
    cursor: pointer; 
    font-family: inherit; 
    font-weight: 700; 
    transition: 0.3s; 
    font-size: 0.95rem;
}
.llm-pill:hover { border-color: var(--gold-primary); color: var(--text-white); }
.llm-pill.active { background: var(--gold-primary); color: #fff; border-color: var(--gold-primary); box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);}

.input-with-icon { position: relative; width: 100%; }
.input-icon { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--gold-primary); font-size: 1.2rem;}
.pl-icon { padding-right: 50px; font-weight: bold; letter-spacing: 2px;}
.btn-save { margin: 30px auto 0; width: fit-content; }

/* ================== PDF & General Buttons ================== */
#export-pdf-btn { background: rgba(212, 175, 55, 0.1); }
#export-pdf-btn:hover { background: var(--gold-primary); color: #fff; }
body.light-theme #export-pdf-btn { background: rgba(181, 139, 0, 0.08); }

.danger-card { border: 1px solid var(--danger-red); margin-top: 40px; background: rgba(231, 76, 60, 0.02);}
.text-red { color: var(--danger-red) !important; }
.danger-content { text-align: center; }
.danger-content p { color: var(--text-white); font-size: 1rem; margin-bottom: 25px; line-height: 1.6;}
.btn-danger { 
    background: var(--danger-bg); 
    color: var(--danger-red); 
    border: 2px solid var(--danger-red); 
    padding: 15px 35px; 
    border-radius: var(--radius-md); 
    font-family: inherit; 
    font-weight: 800; 
    font-size: 1.05rem;
    cursor: pointer; 
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.btn-danger:hover { background: var(--danger-red); color: #fff; box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);}

/* ================== Chatbot Widget & Voice Assistant ================== */
.chat-widget-btn { 
    position: fixed; 
    bottom: 35px; 
    left: 35px; 
    width: 60px; 
    height: 60px; 
    background: var(--gold-primary); 
    color: #fff; 
    border-radius: 50%; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    font-size: 1.6rem; 
    cursor: pointer; 
    z-index: 999; 
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4); 
    transition: 0.3s;
}
.chat-widget-btn:hover { transform: scale(1.1); }

.chat-popup { 
    display: none; 
    position: fixed; 
    bottom: 110px; 
    left: 35px; 
    width: 400px; 
    height: 550px; 
    background: var(--bg-card); 
    border-radius: var(--radius-lg); 
    box-shadow: 0 15px 40px var(--shadow-color); 
    flex-direction: column; 
    z-index: 1000; 
    border: 1px solid var(--border-color); 
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 🟢 كلاس التكبير الجديد (Workspace Mode) */
.chat-popup.chat-maximized {
    width: 70vw;
    height: 80vh;
    left: 50%;
    bottom: 50%;
    transform: translate(-50%, 50%);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.chat-header { 
    background: var(--bg-input); 
    padding: 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-color); 
    font-weight: 800; 
    color: var(--gold-primary); 
    font-size: 1.1rem;
}
.chat-header span { display: flex; align-items: center; gap: 10px; }
.chat-header button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; transition: 0.3s;}
.chat-header button:hover { color: var(--gold-primary); }

.chat-messages { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.message { padding: 14px 18px; border-radius: var(--radius-md); font-size: 0.95rem; line-height: 1.7; max-width: 85%; white-space: pre-wrap; word-break: break-word;}
.ai-msg { background: var(--bg-input); color: var(--text-white); border: 1px solid var(--border-color); align-self: flex-start; border-bottom-right-radius: 0; }
.user-msg { background: var(--gold-primary); color: #fff; align-self: flex-end; border-bottom-left-radius: 0; font-weight: 700; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);}

.chat-input-area { display: flex; padding: 15px; background: var(--bg-input); border-top: 1px solid var(--border-color); gap: 12px; align-items: center;}
.chat-input-area input { 
    flex-grow: 1; 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    color: var(--text-white); 
    padding: 14px; 
    border-radius: var(--radius-md); 
    outline: none; 
    font-family: inherit; 
    transition: 0.3s;
}
.chat-input-area input:focus { border-color: var(--gold-primary); }

/* 🟢 أزرار المايك والإرسال */
.chat-input-area button { background: transparent; border: none; cursor: pointer; font-size: 1.3rem; transition: 0.3s; padding: 5px;}
.chat-input-area .send-btn { color: var(--gold-primary); transform: rotate(180deg); }
.chat-input-area .send-btn:hover { transform: rotate(180deg) scale(1.15); }

#mic-btn { color: var(--text-muted); }
#mic-btn:hover { color: var(--gold-primary); transform: scale(1.15); }
#mic-btn.recording { 
    color: var(--danger-red); 
    animation: micPulse 1.5s infinite; 
}

@keyframes micPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

/* ================== Toast Notifications (Intelligence Alerts) ================== */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none; /* Allows clicking through empty space */
}

.marsad-toast {
    min-width: 320px;
    max-width: 450px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: auto; /* Re-enable click on toast itself */
    position: relative;
    overflow: hidden;
}

.marsad-toast.hiding {
    animation: slideOutRight 0.4s ease forwards;
}

.marsad-toast i { font-size: 1.4rem; }

.toast-success {
    background: #27ae60;
    border-right: 5px solid #1e8449;
}
.toast-error {
    background: #c0392b;
    border-right: 5px solid #922b21;
}
.toast-warning {
    background: #D4AF37;
    border-right: 5px solid #b58b00;
    color: #000;
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}


/* ================== Loaders & Empty States ================== */
.empty-state { text-align: center; color: var(--text-muted); padding: 40px; }
.text-muted-icon { font-size: 5rem; opacity: 0.2; margin-bottom: 25px; display: block;}
.coming-soon-state { height: calc(100vh - 200px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 15px; }
.coming-soon-state h2 { font-size: 2rem; color: var(--text-white); }
.coming-soon-state p { color: var(--text-muted); font-size: 1.1rem; }

#loading-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); display: flex; justify-content: center; align-items: center; z-index: 9999; backdrop-filter: blur(10px); }
.loader-container { text-align: center; }
.golden-spinner { 
    width: 100px; height: 100px; 
    border: 6px solid rgba(212, 175, 55, 0.1); 
    border-top: 6px solid var(--gold-primary); 
    border-radius: 50%; 
    animation: spin 1s linear infinite; 
    margin: 0 auto 30px; 
}
.loading-percentage { font-size: 3rem; font-weight: 800; color: var(--gold-primary); margin-bottom: 15px; font-family: var(--font-main); }
.loading-text { color: var(--text-white); font-size: 1.2rem; font-weight: 700; letter-spacing: 1px;}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ================== Micro Delete Button for Archives ================== */
.btn-delete-report { 
    background: rgba(231, 76, 60, 0.05); 
    color: var(--danger-red); 
    border: 1px solid var(--danger-red); 
    border-radius: var(--radius-md); 
    cursor: pointer; 
    transition: 0.3s; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    width: 55px; 
    font-size: 1.2rem; 
}
.btn-delete-report:hover { 
    background: var(--danger-red); 
    color: #fff; 
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3); 
}

/* 🟢 تنسيقات المشاهد الذكي التفاعلي 🟢 */
.sv-actions-grid button {
    font-size: 0.95rem;
    padding: 12px 20px;
    border-radius: 8px;
    flex: 1 1 30%;
    min-width: 150px;
    justify-content: center;
}

/* ================================================================
   رؤى غرفة العمليات المركزية (Dashboard Insights)
   ================================================================ */
.stat-delta {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: 0.2px;
}
.stat-delta.up { color: #2ecc71; }
.stat-delta.down { color: #e74c3c; }
.stat-delta.flat { color: #8AA4C0; }
.delta-caption { font-size: 0.68rem; font-weight: 600; opacity: 0.75; }

.insight-list {
    max-height: 250px;
    overflow-y: auto;
    padding-inline-end: 4px;
}
.insight-count {
    background: rgba(212, 175, 55, 0.15);
    color: #D4AF37;
    padding: 2px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
}
.insight-empty { color: #8AA4C0; padding: 20px 0; text-align: center; }

.brief-box {
    line-height: 2;
    color: #C9D6E3;
    background: rgba(212, 175, 55, 0.04);
    border: 1px dashed rgba(212, 175, 55, 0.25);
    border-radius: 10px;
    padding: 16px 18px;
    min-height: 70px;
}
.brief-line { margin-bottom: 8px; }
.brief-line:last-child { margin-bottom: 0; }

.insight-gen-btn {
    margin-top: 14px;
    background: linear-gradient(135deg, #D4AF37, #b8942a);
    color: #10141b;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.insight-gen-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.35);
}


/* ================================================================
   نافذة تدريب بصمة الأسلوب (Style Trainer Modal)
   ================================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(6, 10, 16, 0.82);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; padding: 20px;
}
.modal-box {
    background: #121821;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 14px;
    width: 100%; max-width: 640px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px; border-bottom: 1px solid rgba(212,175,55,0.2);
}
.modal-head h3 { margin: 0; color: #D4AF37; font-size: 1.15rem; }
.modal-close {
    background: none; border: none; color: #8AA4C0;
    font-size: 1.8rem; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: #fff; }
.modal-body { padding: 22px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 12px;
    padding: 16px 22px; border-top: 1px solid rgba(212,175,55,0.2);
}
.trainer-hint {
    color: #8AA4C0; line-height: 1.8; margin-bottom: 18px;
    background: rgba(212,175,55,0.05); padding: 12px 15px;
    border-radius: 8px; border-inline-start: 3px solid #D4AF37;
}
.trainer-status { margin-top: 14px; line-height: 1.8; min-height: 24px; }


/* ================================================================
   التزام النبرة وتبرير تحليل التأثير الاستراتيجي
   ================================================================ */
.tone-adherence-box {
    margin-top: 18px;
    padding: 14px 16px;
    background: rgba(212, 175, 55, 0.04);
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.9;
}
.tone-verdict { font-weight: 800; margin-bottom: 6px; }
.tone-score { font-weight: 600; opacity: 0.85; font-size: 0.85rem; }
.tone-devs { margin: 6px 22px 10px; color: #e6b800; font-size: 0.85rem; }
.tone-devs li { margin-bottom: 3px; }
.rationale-title { font-weight: 800; color: var(--text-muted, #8AA4C0); margin: 8px 0 4px; }
.rationale-list { margin: 0 22px; color: #C9D6E3; }
.rationale-list li { margin-bottom: 5px; }

/* ضبط اتجاه محرر الردود ديناميكياً */
#quill-editor .ql-editor[dir="ltr"] { text-align: left; }
#quill-editor .ql-editor[dir="rtl"] { text-align: right; }


/* ================================================================
   تباعد الفقرات داخل محرر الردود (Quill يصفّر الهوامش افتراضياً)
   ================================================================ */
/* لا هوامش مفروضة على الفقرات: التباعد يأتي حصراً من الأسطر الفارغة
   التي يتحكم فيها المستخدم — يحذفها فيلتصق النص، يضيفها فيتباعد */
#quill-editor .ql-editor p { margin-bottom: 0; }
#nl-quill-editor .ql-editor p { margin-bottom: 0; }
#quill-editor .ql-editor { line-height: 1.7; }


/* ================================================================
   وحدة الإنذار المبكر
   ================================================================ */
.alerts-stat-row { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin:18px 0; }
.alert-stat-card { background:rgba(212,175,55,0.05); border:1px solid rgba(212,175,55,0.15);
    border-radius:12px; padding:16px; text-align:center; }
.alert-stat-value { font-size:2rem; font-weight:800; }
.alert-stat-label { font-size:0.85rem; color:var(--text-muted,#8AA4C0); margin-top:4px; }

.alerts-filter-bar { display:flex; gap:8px; margin-bottom:18px; flex-wrap:wrap; }
.alert-filter-btn { background:transparent; border:1px solid rgba(212,175,55,0.25);
    color:var(--text-muted,#8AA4C0); padding:8px 20px; border-radius:20px; cursor:pointer;
    font-family:'Cairo',sans-serif; font-weight:700; transition:all 0.15s; }
.alert-filter-btn.active { background:var(--gold-primary,#D4AF37); color:#10141b; border-color:var(--gold-primary,#D4AF37); }

.alerts-container { display:flex; flex-direction:column; gap:14px; }
.alert-card { background:rgba(255,255,255,0.02); border:1px solid rgba(255,255,255,0.06);
    border-inline-start-width:4px; border-radius:10px; padding:16px 18px; transition:all 0.15s; }
.alert-card:hover { background:rgba(255,255,255,0.04); }
.alert-card.handled { opacity:0.55; }
.alert-card-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:8px; }
.alert-sev-badge { color:#10141b; font-weight:800; font-size:0.78rem; padding:3px 12px; border-radius:14px; }
.alert-type-tag { background:rgba(138,164,192,0.15); color:#C9D6E3; font-size:0.78rem;
    padding:3px 12px; border-radius:14px; font-weight:600; }
.alert-time { margin-inline-start:auto; color:var(--text-muted,#8AA4C0); font-size:0.8rem; }
.alert-title { font-weight:800; font-size:1.05rem; margin-bottom:6px; color:#fff; }
.alert-desc { color:#C9D6E3; line-height:1.8; font-size:0.92rem; }
.alert-evidence { margin-top:10px; padding:10px 14px; background:rgba(0,0,0,0.2); border-radius:8px; }
.alert-sample { color:#8AA4C0; font-size:0.85rem; margin-bottom:4px; }
.alert-actions { display:flex; gap:8px; margin-top:14px; flex-wrap:wrap; }
.alert-btn { border:none; padding:7px 16px; border-radius:7px; cursor:pointer;
    font-family:'Cairo',sans-serif; font-weight:700; font-size:0.85rem; transition:transform 0.1s; }
.alert-btn:hover { transform:translateY(-1px); }
.alert-btn.ack { background:rgba(230,126,34,0.2); color:#e67e22; }
.alert-btn.resolve { background:rgba(46,204,113,0.2); color:#2ecc71; }
.alert-btn.dismiss { background:rgba(138,164,192,0.15); color:#8AA4C0; }

@media (max-width:700px){ .alerts-stat-row{ grid-template-columns:repeat(2,1fr); } }


/* ================================================================
   البحث الشامل في الأرشيف
   ================================================================ */
.gs-search-panel { background:rgba(212,175,55,0.04); border:1px solid rgba(212,175,55,0.15);
    border-radius:14px; padding:20px; margin:18px 0; }
.gs-search-row { display:flex; gap:12px; margin-bottom:14px; }
.gs-search-input-wrap { position:relative; flex:1; }
.gs-search-icon { position:absolute; inset-inline-start:16px; top:50%; transform:translateY(-50%); color:var(--text-muted,#8AA4C0); }
.gs-search-input { width:100%; padding:14px 14px 14px 44px; padding-inline-start:44px;
    background:var(--bg-card,#161b22); border:1px solid rgba(212,175,55,0.25); border-radius:10px;
    color:#fff; font-family:'Cairo',sans-serif; font-size:1rem; }
.gs-search-input:focus { outline:none; border-color:var(--gold-primary,#D4AF37); }
.gs-filters-row { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.gs-filter-select { padding:10px 14px; background:var(--bg-card,#161b22);
    border:1px solid rgba(212,175,55,0.2); border-radius:8px; color:#C9D6E3;
    font-family:'Cairo',sans-serif; font-weight:600; cursor:pointer; }
.gs-filter-select:focus { outline:none; border-color:var(--gold-primary,#D4AF37); }
.gs-result-count { margin-top:12px; color:var(--gold-primary,#D4AF37); font-weight:700; font-size:0.9rem; }

.gs-results-list { display:flex; flex-direction:column; gap:10px; }
.gs-card { background:rgba(255,255,255,0.02); border:1px solid rgba(255,255,255,0.06);
    border-radius:10px; padding:14px 18px; transition:all 0.15s; }
.gs-card:hover { background:rgba(255,255,255,0.045); border-color:rgba(212,175,55,0.25); }
.gs-card-title { display:block; color:#fff; font-weight:700; font-size:1.02rem;
    text-decoration:none; line-height:1.7; margin-bottom:10px; }
.gs-card-title:hover { color:var(--gold-primary,#D4AF37); }
.gs-card-meta { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.gs-sent { font-size:0.75rem; font-weight:800; padding:2px 12px; border-radius:12px; }
.gs-sent.pos { background:rgba(46,204,113,0.18); color:#2ecc71; }
.gs-sent.neg { background:rgba(231,76,60,0.18); color:#e74c3c; }
.gs-sent.neu { background:rgba(138,164,192,0.15); color:#8AA4C0; }
.gs-tag { font-size:0.75rem; color:#C9D6E3; background:rgba(255,255,255,0.04);
    padding:2px 10px; border-radius:12px; }
.gs-tag.tier1 { background:rgba(212,175,55,0.15); color:var(--gold-primary,#D4AF37); font-weight:700; }
.gs-date { font-size:0.75rem; color:var(--text-muted,#8AA4C0); margin-inline-start:auto; }
.gs-source-task { margin-top:8px; font-size:0.78rem; color:var(--text-muted,#8AA4C0); }

@media (max-width:700px){ .gs-search-row{ flex-direction:column; } }


/* ================================================================
   لوحة الإشارات القياسية للرادار
   ================================================================ */
.radar-signals-panel { background:rgba(212,175,55,0.04); border:1px solid rgba(212,175,55,0.18);
    border-radius:14px; padding:20px; margin-bottom:22px; }
.radar-signals-head { display:flex; align-items:center; gap:10px; font-weight:800;
    color:var(--gold-primary,#D4AF37); font-size:1.05rem; margin-bottom:16px; }
.radar-signals-badge { margin-inline-start:auto; background:rgba(212,175,55,0.15);
    color:var(--gold-primary,#D4AF37); padding:3px 14px; border-radius:14px; font-size:0.82rem; }

.radar-signal-cards { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:18px; }
.radar-signal-card { display:flex; gap:12px; align-items:flex-start;
    background:rgba(0,0,0,0.18); border-radius:10px; padding:14px; }
.rs-icon { font-size:1.5rem; }
.rs-label { font-size:0.78rem; color:var(--text-muted,#8AA4C0); margin-bottom:2px; }
.rs-value { font-size:1.15rem; font-weight:800; line-height:1.3; }
.rs-sub { font-size:0.75rem; color:var(--text-muted,#8AA4C0); margin-top:3px; line-height:1.5; }

.radar-curve-wrap { height:200px; margin-bottom:18px; }

.radar-spread-title { font-weight:800; color:#C9D6E3; margin-bottom:12px; font-size:0.92rem; }
.radar-spread-track { display:flex; gap:10px; flex-wrap:wrap; }
.radar-spread-node { flex:1; min-width:150px; background:rgba(0,0,0,0.18);
    border-radius:10px; padding:12px; text-align:center; position:relative; }
.rsn-dot { width:26px; height:26px; border-radius:50%; background:var(--gold-primary,#D4AF37);
    color:#10141b; font-weight:800; display:flex; align-items:center; justify-content:center;
    margin:0 auto 8px; font-size:0.85rem; }
.rsn-name { font-weight:700; color:#fff; font-size:0.88rem; }
.rsn-date { font-size:0.75rem; color:var(--text-muted,#8AA4C0); margin-top:3px; }
.rsn-count { font-size:0.78rem; color:var(--gold-primary,#D4AF37); font-weight:700; margin-top:4px; }

.prediction-tags { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }

@media (max-width:900px){ .radar-signal-cards{ grid-template-columns:repeat(2,1fr); } }


/* ================================================================
   مكتبة الردود ومسار الاعتماد
   ================================================================ */
.nl-stat-row { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin:18px 0; }
.nl-results-list { display:flex; flex-direction:column; gap:12px; }
.nl-card { background:rgba(255,255,255,0.02); border:1px solid rgba(255,255,255,0.06);
    border-radius:10px; padding:16px 18px; transition:all 0.15s; }
.nl-card:hover { background:rgba(255,255,255,0.04); border-color:rgba(212,175,55,0.22); }
.nl-card-head { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:10px; }
.nl-status-badge { font-size:0.78rem; font-weight:800; padding:3px 12px; border-radius:14px; }
.nl-title { font-weight:800; color:#fff; font-size:1.02rem; margin-bottom:8px; }
.nl-excerpt { color:#C9D6E3; line-height:1.9; font-size:0.9rem;
    background:rgba(0,0,0,0.18); border-radius:8px; padding:10px 14px; }
.nl-metrics { display:flex; gap:14px; margin-top:10px; font-size:0.8rem; color:var(--text-muted,#8AA4C0); }
.nl-metrics i { color:var(--gold-primary,#D4AF37); }
.nl-approver { margin-top:8px; font-size:0.8rem; color:#2ecc71; }
.nl-actions { display:flex; gap:8px; margin-top:14px; flex-wrap:wrap; }

.nl-modal { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.75);
    z-index:9999; align-items:center; justify-content:center; padding:20px; }
.nl-modal-box { background:var(--bg-card,#161b22); border:1px solid rgba(212,175,55,0.3);
    border-radius:14px; max-width:800px; width:100%; max-height:80vh; display:flex; flex-direction:column; }
.nl-modal-head { display:flex; justify-content:space-between; align-items:center;
    padding:16px 20px; border-bottom:1px solid rgba(255,255,255,0.08); }
.nl-modal-head h3 { margin:0; color:var(--gold-primary,#D4AF37); font-size:1.05rem; }
.nl-modal-head button { background:transparent; border:none; color:#8AA4C0;
    font-size:1.2rem; cursor:pointer; }
.nl-modal-body { padding:18px 20px; overflow-y:auto; }
.nl-version { border-inline-start:3px solid var(--gold-primary,#D4AF37);
    padding:12px 16px; margin-bottom:14px; background:rgba(0,0,0,0.2); border-radius:8px; }
.nl-version-head { display:flex; justify-content:space-between; color:#fff; margin-bottom:6px; }
.nl-version-head span { color:var(--text-muted,#8AA4C0); font-size:0.8rem; }
.nl-version-note { color:var(--gold-primary,#D4AF37); font-size:0.82rem; margin-bottom:8px; }
.nl-version-body { color:#C9D6E3; line-height:1.8; font-size:0.87rem; }

@media (max-width:700px){ .nl-stat-row{ grid-template-columns:repeat(2,1fr); } }


/* ================================================================
   محرر الردود المدمج + أزرار الاعتماد/الرفض
   ================================================================ */
.alert-btn.view { background:rgba(52,152,219,0.18); color:#3498db; }
.alert-btn.approve { background:rgba(46,204,113,0.22); color:#2ecc71; }
.alert-btn.reject { background:rgba(231,76,60,0.20); color:#e74c3c; }

.nl-new-dot { display:inline-block; width:9px; height:9px; border-radius:50%;
    background:#e74c3c; margin-inline-start:8px; vertical-align:middle;
    animation:nlPulse 1.6s ease-in-out infinite; }
@keyframes nlPulse { 0%,100%{ opacity:1; transform:scale(1);} 50%{ opacity:0.45; transform:scale(1.25);} }

.nl-editor-box { max-width:900px; height:82vh; }
.nl-editor-toolbar-wrap { border-bottom:1px solid rgba(255,255,255,0.08); background:rgba(0,0,0,0.15); }
#nl-quill-toolbar { border:none !important; padding:8px 14px; }
#nl-quill-toolbar .ql-stroke { stroke:#C9D6E3; }
#nl-quill-toolbar .ql-fill { fill:#C9D6E3; }
#nl-quill-toolbar button:hover .ql-stroke { stroke:var(--gold-primary,#D4AF37); }
#nl-quill-toolbar button:hover .ql-fill { fill:var(--gold-primary,#D4AF37); }
.nl-editor-body { flex:1; overflow:hidden; padding:0; display:flex; }
#nl-quill-editor { flex:1; overflow-y:auto; border:none !important; }
#nl-quill-editor .ql-editor { color:#E6EDF3; font-size:1.05rem; line-height:1.7; padding:20px 24px; }
/* هامش الفقرات المفروض أُزيل — التباعد من الأسطر الفارغة فقط */
.nl-editor-footer { display:flex; gap:10px; flex-wrap:wrap; padding:14px 20px;
    border-top:1px solid rgba(255,255,255,0.08); background:rgba(0,0,0,0.15); }

/* ===== مكتبة الردود: مكانان منفصلان (معتمد / غير معتمد) ===== */
.nl-group-tabs { display:flex; gap:8px; margin:18px 0 4px; flex-wrap:wrap; }
.nl-group-tab { display:flex; align-items:center; gap:8px; padding:10px 20px;
    background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08);
    border-radius:10px; color:var(--text-muted,#8AA4C0); font-family:inherit;
    font-size:0.9rem; font-weight:700; cursor:pointer; transition:all 0.18s; }
.nl-group-tab:hover { background:rgba(255,255,255,0.06); color:#C9D6E3; }
.nl-group-tab.active { background:rgba(212,175,55,0.12);
    border-color:rgba(212,175,55,0.45); color:var(--gold-primary,#D4AF37); }
.nl-group-count { min-width:24px; padding:1px 8px; border-radius:11px;
    background:rgba(0,0,0,0.28); font-size:0.76rem; font-weight:800; }
.nl-group-tab.active .nl-group-count { background:rgba(212,175,55,0.22); }

/* شارة نوع المقال على البطاقة */
.nl-type-badge { font-size:0.76rem; font-weight:700; padding:3px 11px;
    border-radius:14px; background:rgba(52,152,219,0.14); color:#5dade2; }
.nl-type-badge i { margin-inline-end:4px; opacity:0.8; }

/* زر مزامنة الأرشيف القديم */
.nl-sync-btn { display:inline-flex; align-items:center; gap:7px; }
.nl-sync-btn:disabled { opacity:0.55; cursor:progress; }

@media (max-width:700px){
    .nl-group-tabs { gap:6px; }
    .nl-group-tab { flex:1; justify-content:center; padding:9px 10px; font-size:0.82rem; }
}

/* ===== فولدر غير المعتمدة: سبب الرفض ===== */
.nl-card-rejected { border-inline-start: 3px solid #e74c3c55; }
.nl-reject-reason {
    margin: 10px 0 4px; padding: 9px 14px; border-radius: 8px;
    background: rgba(231,76,60,0.08); border: 1px solid rgba(231,76,60,0.25);
    color: #e8a29a; font-size: 0.88rem; line-height: 1.8;
}
.nl-reject-reason b { color: #e74c3c; }
.nl-reject-reason i { margin-inline-end: 6px; }

#quill-editor .ql-editor p:has(> br:only-child),
#nl-quill-editor .ql-editor p:has(> br:only-child) {
    line-height: 1; min-height: 1em; height: 1em;
}

/* ===== المساعد الاستراتيجي v2: نتائج البحث والجلسات ===== */
.chat-results { max-width: 92% !important; }
.chat-results-title { font-weight: bold; color: var(--accent-gold, #D4AF37); margin-bottom: 8px; font-size: 0.9rem; }
.chat-result-card {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px; padding: 8px 12px; margin-bottom: 7px;
    font-size: 0.86rem; line-height: 1.75;
}
.chat-result-meta { margin-top: 4px; font-size: 0.76rem; opacity: 0.65; }
.chat-sessions-panel {
    position: absolute; top: 52px; left: 10px; right: 10px; z-index: 30;
    background: #101826; border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px; max-height: 260px; overflow-y: auto;
    box-shadow: 0 10px 26px rgba(0,0,0,0.45);
}
.chat-session-item {
    padding: 10px 14px; cursor: pointer; display: flex;
    justify-content: space-between; gap: 10px; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.86rem;
}
.chat-session-item:hover { background: rgba(255,255,255,0.06); }
.chat-session-meta { font-size: 0.72rem; opacity: 0.6; white-space: nowrap; }
/* ================================================================
   شاشة تسجيل الدخول وهوية المستخدم
   تستخدم متغيرات الثيم نفسها فتتبع الوضع الداكن والفاتح تلقائياً
   ================================================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    background-image: radial-gradient(circle at 50% 0%, var(--gold-dim), transparent 60%);
    padding: 20px;
}

/* يمنع تمرير الواجهة خلف الشاشة أثناء عرضها */
body.login-active { overflow: hidden; }

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px var(--shadow-color);
    padding: 36px 32px 28px;
    font-family: var(--font-main);
}

.login-brand { text-align: center; margin-bottom: 26px; }

.login-logo {
    width: 76px;
    height: auto;
    mix-blend-mode: var(--logo-blend);
    margin-bottom: 12px;
}

.login-title {
    color: var(--gold-primary);
    font-size: 1.45rem;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: 0.5px;
}

.login-sub {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
    line-height: 1.6;
}

.login-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0 0 6px;
}

.login-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-family: var(--font-main);
    font-size: 0.95rem;
    padding: 11px 14px;
    margin-bottom: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px var(--gold-dim);
}

.login-btn {
    width: 100%;
    background: var(--gold-primary);
    color: #071220;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover:not(:disabled) { background: var(--gold-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-red);
    border-radius: var(--radius-md);
    color: var(--danger-red);
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.login-foot {
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.7;
    text-align: center;
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

/* ---- هوية المستخدم في الشريط العلوي ---- */
.identity-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-inline-start: 12px;
    margin-inline-start: 4px;
    border-inline-start: 1px solid var(--border-color);
}

.identity-name {
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.identity-role {
    background: var(--gold-dim);
    border: 1px solid var(--gold-primary);
    border-radius: 999px;
    color: var(--gold-primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    white-space: nowrap;
}

.identity-logout {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 9px;
    transition: color 0.2s, border-color 0.2s;
}

.identity-logout:hover { color: var(--danger-red); border-color: var(--danger-red); }

.identity-warn { color: var(--danger-red); font-size: 0.8rem; font-weight: 600; }

/* ================================================================
   حالة مفاتيح الذكاء الاصطناعي المحفوظة على الخادم
   ================================================================ */
.key-status { margin-top: 18px; }

.key-status-title {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.key-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-bottom: 6px;
}

.key-provider {
    color: var(--gold-primary);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    flex: 1;
}

.key-date { color: var(--text-muted); font-size: 0.75rem; }

.key-del {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s, border-color 0.2s;
}

.key-del:hover { color: var(--danger-red); border-color: var(--danger-red); }

.key-status-empty,
.key-status-warn {
    font-size: 0.8rem;
    line-height: 1.7;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.key-status-empty { color: var(--text-muted); background: var(--bg-input); }

.key-status-warn {
    color: var(--danger-red);
    background: var(--danger-bg);
    border: 1px solid var(--danger-red);
}

.key-status-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.8;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}
