/* ==========================================================
   Base – Reset, HTML/Body, Scrollbar, Typography, Navigation
   ========================================================== */

/* Basic reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* RTL global direction */
* {
    direction: rtl;
}

/* HTML / Body */
html, body {
    direction: rtl !important;
    font-family: 'Heebo', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    overflow-x: clip;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    scroll-padding-top: 80px;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    html, body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}

/* Scrollbar – keep it on the right even in RTL */
html {
    scrollbar-width: thin;
    scrollbar-color: #3a3a3a var(--dark-bg);
    direction: ltr !important;
    overflow-x: clip;
    scroll-padding-top: 100px;
}

html::-webkit-scrollbar        { width: 8px; }
html::-webkit-scrollbar-track  { background: var(--dark-bg); }
html::-webkit-scrollbar-thumb  { background: #3a3a3a; border-radius: 4px; transition: background 0.3s ease; }
html::-webkit-scrollbar-thumb:hover { background: #4d4d4d; }

/* Body background */
body {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    min-height: 100vh;
    height: 100%;
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0;
    overflow-x: clip;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

h3, h4 {
    color: #ffffff;
    margin-bottom: 0.8rem;
}

p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.text-lg    { line-height: 1.7; }
.leading-relaxed { line-height: 1.8; }
.border-r-4 { border-right-width: 4px; }

/* Links */
a {
    transition: all 0.2s ease;
}
a:hover { color: var(--accent-blue); }
a:focus  { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

/* Anchor links styled as glowing buttons */
a.glowing-button {
    text-decoration: none;
    display: inline-block;
    color: white;
}

/* Buttons */
button:not(.glowing-button) {
    transition: all 0.2s ease;
}
button:not(.glowing-button):hover { transform: translateY(-1px); }
button:focus { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

/* Sections */
section {
    position: relative;
    z-index: 2;
    clear: both;
    width: 100%;
    overflow: visible;
    scroll-margin-top: 80px;
    transform: translateZ(0);
}

/* Containers */
.container {
    overflow: visible;
    position: relative;
}

/* Lists */
ul, ol {
    padding-right: 20px;
    padding-left: 0;
    text-align: right !important;
    direction: rtl !important;
}
ul li, ol li {
    text-align: right !important;
    direction: rtl !important;
    list-style-position: inside;
}

/* Alignment exceptions – centred elements */
h1, h2, .text-center, button, input, .glowing-button, .search-box, i, .fas, .fab {
    text-align: center !important;
}
.text-center h3, .text-center p, .text-center ul { text-align: center !important; }
.text-center ul li { text-align: center !important; list-style: none; padding-left: 0; padding-right: 0; }

/* Navigation */
nav { direction: rtl !important; }
nav a { text-align: center; padding: 8px 16px; margin: 0 4px; }

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
header nav { justify-content: center !important; text-align: center !important; }
header nav a { text-align: center !important; }

header { backdrop-filter: blur(15px); border-bottom: 1px solid rgba(0, 102, 204, 0.1); }
footer { backdrop-filter: blur(10px); border-top:    1px solid rgba(0, 102, 204, 0.1); }

/* RTL margin/padding helpers */
.ml-2  { margin-left: 0 !important;  margin-right: 8px !important; }
.mr-2  { margin-right: 0 !important; margin-left:  8px !important; }
.ml-4  { margin-left: 0 !important;  margin-right: 16px !important; }
.mr-4  { margin-right: 0 !important; margin-left:  16px !important; }
.pl-10 { padding-left: 0 !important;  padding-right: 40px !important; }
.pr-10 { padding-right: 0 !important; padding-left:  40px !important; }
.md\:pl-10 { padding-left: 0 !important;  padding-right: 40px !important; }
.md\:pr-10 { padding-right: 0 !important; padding-left:  40px !important; }
.flex-col { flex-direction: column !important; }
.md\:flex-row { flex-direction: row-reverse !important; }

/* Window chrome (demo windows) */
.window-header {
    background: rgba(20, 20, 25, 0.95);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    direction: rtl;
    border-bottom: 1px solid rgba(0, 102, 204, 0.2);
}

.window-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    transition: all 0.2s ease;
}
.window-btn:hover { transform: scale(1.1); }

.window-content {
    padding: 20px;
    height: 280px;
    overflow-y: auto;
    direction: ltr !important;
    text-align: right !important;
    scrollbar-width: thin;
    scrollbar-color: #3a3a3a rgba(0,0,0,0.3);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.window-content::-webkit-scrollbar       { width: 6px; }
.window-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 3px; }
.window-content::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 3px; transition: background 0.3s ease; }
.window-content::-webkit-scrollbar-thumb:hover { background: #4d4d4d; }

/* Anchor smooth‑scrolling is handled in JS (smoothScrollTo in main.ts) */

/* Smooth transitions for all interactive elements */
*, *::before, *::after {
    transition-property: transform, opacity, background-color, border-color, color, box-shadow;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    will-change: auto;
}

/* Misc utility */
.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 163, 255, 0.5);
    pointer-events: none;
}
