/* style.css - CarbonX | Security Hardened
   FIX #2: أزلنا كل inline styles من JS واستبدلناها بـ classes هنا
   حتى نتمكن من إزالة unsafe-inline من CSP بالكامل
*/

:root {
    --obsidian:      #050505;
    --gold:          #C5A059;
    --gold-dim:      rgba(197, 160, 89, 0.3);
    --gold-glow:     rgba(197, 160, 89, 0.2);
    --slate:         #2c2c2e;
    --text-primary:  #e8e8e8;
    --text-secondary:#9a9a9a;
    --text-warn:     #C5A059;
    --text-error:    #a05050;
    --transition:    all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--obsidian);
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ── BACKGROUND ── */
#inkCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    opacity: 0.4;
}

.ambient-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 40% 50%, rgba(5,5,5,0.2) 0%, var(--obsidian) 90%);
    z-index: -1;
    pointer-events: none;
}

/* ── LAYOUT ── */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 2.5rem 4rem;
    position: relative;
}

/* ── HEADER ── */
.neo-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-bottom: 1px solid var(--gold-dim);
    padding-bottom: 1.2rem;
    margin-bottom: 3rem;
}

.brand h1 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 5px;
    color: var(--gold);
    text-shadow: 0 0 6px var(--gold-glow);
}

.brand p {
    font-size: 0.7rem;
    letter-spacing: 2.5px;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.status-cluster {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.secure-node {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    padding: 0.35rem 1.2rem;
    border-radius: 40px;
    border: 0.5px solid var(--gold-dim);
}

/* FIX #6 (CSS): pulse animation صحيح مع alternate */
.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--gold);
    animation: pulse-node 1.8s ease-in-out infinite alternate;
}

@keyframes pulse-node {
    0%   { opacity: 0.3; transform: scale(0.7); }
    100% { opacity: 1;   transform: scale(1.2); }
}

.node-text {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--gold);
}

.silent-clock {
    font-family: 'Inter', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    background: rgba(0,0,0,0.5);
    padding: 0.35rem 1rem;
    border-radius: 28px;
    letter-spacing: 1px;
    border: 0.5px solid var(--slate);
}

.lang-toggle {
    display: flex;
    gap: 6px;
    background: #0c0c0c;
    padding: 0.2rem 0.6rem;
    border-radius: 32px;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 5px 10px;
    border-radius: 24px;
    font-family: inherit;
}

.lang-btn.active {
    color: var(--gold);
    background: rgba(197, 160, 89, 0.18);
    text-shadow: 0 0 2px rgba(197,160,89,0.4);
}

/* ── SEARCH ── */
.search-hub {
    margin-bottom: 2.5rem;
    text-align: center;
}

.search-container {
    max-width: 720px;
    margin: 0 auto;
}

.search-bar-wrapper {
    background: rgba(8, 8, 8, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--gold-dim);
    border-radius: 80px;
    display: flex;
    align-items: center;
    padding: 0.2rem 0.2rem 0.2rem 2rem;
    transition: var(--transition);
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}

.search-bar-wrapper:focus-within {
    border-color: var(--gold);
    transform: scale(1.01);
    box-shadow: 0 8px 28px var(--gold-glow);
}

.search-icon {
    color: var(--gold);
    font-size: 1.2rem;
    margin-right: 14px;
    opacity: 0.8;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-primary);
    outline: none;
    font-family: 'Inter', monospace;
    /* FIX #3: autocomplete off مُعرَّف في HTML */
}

.search-input::placeholder {
    color: #5a5a5a;
    letter-spacing: 0.3px;
}

.execute-btn {
    background: linear-gradient(135deg, #181208 0%, #0a0802 100%);
    border: 1px solid var(--gold);
    border-radius: 60px;
    padding: 0.7rem 2.2rem;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    letter-spacing: 1.2px;
    font-size: 0.85rem;
    color: var(--gold);
    cursor: pointer;
    transition: var(--transition);
    margin-left: 8px;
    white-space: nowrap;
}

.execute-btn:hover {
    background: var(--gold);
    color: var(--obsidian);
    box-shadow: 0 0 16px var(--gold);
}

/* ── FILTERS ── */
.tactic-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
    margin: 2.5rem 0 2rem;
}

.filter-tab {
    background: rgba(12,12,12,0.7);
    backdrop-filter: blur(4px);
    border: 1px solid #2a2a2a;
    padding: 0.6rem 1.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.6px;
}

.filter-tab.active {
    background: rgba(197, 160, 89, 0.18);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.filter-tab:hover {
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-1px);
}

/* ── DIVIDER ── */
.elegant-divider {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 2rem auto 0;
    opacity: 0.4;
}

/* ── TERMINAL PANEL ── */
.terminal-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(3, 3, 3, 0.97);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--gold);
    box-shadow: 0 -15px 35px rgba(0,0,0,0.8);
    transform: translateY(100%);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    padding: 1.5rem 2rem 2rem;
}

.terminal-panel.open {
    transform: translateY(0);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gold-dim);
    padding-bottom: 0.75rem;
    margin-bottom: 1.2rem;
}

.terminal-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    letter-spacing: 2px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-terminal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 30px;
}

.close-terminal:hover {
    color: var(--gold);
    background: rgba(197,160,89,0.1);
}

.terminal-content {
    max-height: 280px;
    overflow-y: auto;
    font-size: 0.85rem;
    color: #cfcfcf;
    line-height: 1.6;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-dim) transparent;
}

.terminal-content::-webkit-scrollbar       { width: 3px; }
.terminal-content::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }

.terminal-line {
    margin: 0.35rem 0;
    white-space: pre-wrap;
    border-left: 2px solid var(--gold-dim);
    padding-left: 14px;
    opacity: 0.9;
    color: #cfcfcf;
}

/* FIX #2: بدلاً من inline style في JS، نستخدم classes */
.terminal-line--error {
    color: var(--text-error);
    border-left-color: var(--text-error);
    opacity: 0.9;
}

.terminal-line--warn {
    color: var(--text-warn);
    border-left-color: var(--text-warn);
    opacity: 0.85;
}

/* ── RTL ── */
html[dir="rtl"] body {
    font-family: 'Cairo', sans-serif;
}

html[dir="rtl"] .brand h1,
html[dir="rtl"] .terminal-title,
html[dir="rtl"] .execute-btn {
    font-family: 'Cairo', serif;
    letter-spacing: 1px;
}

html[dir="rtl"] .terminal-line {
    border-left: none;
    border-right: 2px solid var(--gold-dim);
    padding-left: 0;
    padding-right: 14px;
    text-align: right;
}

html[dir="rtl"] .terminal-line--error {
    border-right-color: var(--text-error);
}

html[dir="rtl"] .terminal-line--warn {
    border-right-color: var(--text-warn);
}

html[dir="rtl"] .search-bar-wrapper {
    padding: 0.2rem 2rem 0.2rem 0.2rem;
}

html[dir="rtl"] .search-icon {
    margin-left: 14px;
    margin-right: 0;
}

html[dir="rtl"] .execute-btn {
    margin-left: 0;
    margin-right: 8px;
}

html[dir="rtl"] .status-cluster {
    flex-direction: row-reverse;
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
    .app-container      { padding: 1.2rem 1.5rem 2rem; }
    .search-bar-wrapper { padding: 0.2rem 0.2rem 0.2rem 1.2rem; }
    .execute-btn        { padding: 0.5rem 1.5rem; }
    .filter-tab         { padding: 0.5rem 1.2rem; font-size: 0.7rem; }
}

@media (max-width: 640px) {
    .neo-header     { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .status-cluster { width: 100%; justify-content: space-between; }
    .brand h1       { font-size: 1.5rem; }
}
