/* Global Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --logo-gold: #dcb76a;
    --logo-gold-hover: #f6e0a5;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-dark: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Navigation */
.navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(33, 37, 41, 0.95) !important;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.navbar-brand img {
    height: 40px;
    width: auto;
    margin-right: 10px;
    filter: none;
}

.nav-link {
    font-weight: 500;
    color: var(--logo-gold) !important;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--logo-gold-hover) !important;
}

.nav-link.active,
.nav-link:focus {
    color: var(--logo-gold-hover) !important;
}

.navbar-brand span {
    color: var(--logo-gold);
}

/* Home Hero Text Colors */
#home .display-4,
#home .lead,
#home .stat-item p {
    color: var(--logo-gold) !important;
}

#home .stat-item h3 {
    color: var(--logo-gold-hover) !important;
}

/* Hero Section */
.hero-section {
    background: var(--gradient-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.stat-item h3 {
    font-size: 2.5rem;
    margin-bottom: 0;
}

.hero-image {
    position: relative;
    height: 400px;
}

/* Video Demo Section */
.video-demo-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    background: #000;
    max-width: 800px;
    margin: 0 auto;
}

.demo-video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 20px;
    max-height: 450px;
    object-fit: cover;
}

.video-demo-placeholder {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(13, 110, 253, 0.28), rgba(0, 0, 0, 0.95));
}

.video-overlay-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 4rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.demo-video:hover + .video-overlay-play,
.video-overlay-play:hover {
    opacity: 1;
}

/* Big Logo Section */
.big-logo {
    max-width: 300px;
    height: auto;
    transition: transform 0.3s ease;
    display: block;
    margin: 0 auto;
}

.big-logo:hover {
    transform: scale(1.05);
}

.big-logo-section {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 60px 0;
}

/* Image sections */
.feature-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

.solution-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.tech-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.hero-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
}

.ai-chart-container {
    position: relative;
    width: 100%;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.chart-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 10;
}

.chart-title {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.chart-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.stat {
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.stat-value {
    display: block;
    color: #00ff88;
    font-size: 1.5rem;
    font-weight: bold;
}

.stat-label {
    display: block;
    color: white;
    font-size: 0.8rem;
    margin-top: 5px;
}

.network-node {
    position: absolute;
    width: 25px;
    height: 25px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.8);
    animation: pulse 2s infinite;
    border: 3px solid #ffffff;
}

.network-node:nth-child(1) { animation-delay: 0s; }
.network-node:nth-child(2) { animation-delay: 0.5s; }
.network-node:nth-child(3) { animation-delay: 1s; }
.network-node:nth-child(4) { animation-delay: 1.5s; }

.network-connection {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
    transform: translate(-50%, -50%);
    animation: flow 3s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

@keyframes flow {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* Feature Cards */
.feature-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.feature-card p {
    flex: 1;
    margin-bottom: 1rem;
}

.feature-icon {
    display: inline-block;
    padding: 20px;
    color: var(--primary-color);
}

/* Solution Cards */
.solution-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.solution-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1) !important;
}

.solution-card p {
    flex: 1;
    margin-bottom: 1rem;
}

.solution-card ul {
    margin-top: auto;
}

/* Technology Cards */
.tech-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tech-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.tech-card p {
    flex: 1;
    margin-bottom: 0;
}

.tech-icon {
    display: inline-block;
    padding: 15px;
    color: var(--primary-color);
}

/* Results Section */
.result-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
}

.result-card h3 {
    font-size: 3rem;
    margin-bottom: 0;
}

/* Contact Section */
.contact-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.contact-item i {
    width: 20px;
    text-align: center;
}

/* Form Styles */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn {
    border-radius: 10px;
    padding: 12px 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 123, 255, 0.3);
}

.btn-outline-light:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Social Links */
.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        text-align: center;
    }
    
    .hero-stats {
        margin-bottom: 30px;
    }
    
    .stat-item h3 {
        font-size: 2rem;
    }
    
    .hero-image {
        height: 300px;
        margin-top: 30px;
    }
    
    .hero-bg-video {
        object-position: center;
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .navbar-brand img {
        height: 30px;
        filter: none;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 100px 0 50px;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .result-card h3 {
        font-size: 2.5rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
.loading {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.loading.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* RTL Support for Persian and Arabic */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .navbar-nav {
    padding-right: 0;
}

[dir="rtl"] .me-2 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

[dir="rtl"] .me-3 {
    margin-right: 0 !important;
    margin-left: 1rem !important;
}

[dir="rtl"] .text-md-end {
    text-align: left !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Section Spacing */
section {
    padding: 80px 0;
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

.lead {
    font-size: 1.25rem;
    font-weight: 400;
}

/* Button Enhancements */
.btn {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

/* Card Enhancements */
.card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

/* Background Patterns */
.bg-pattern {
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(0, 123, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* Text Gradients */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Border Gradients */
.border-gradient {
    border: 2px solid;
    border-image: var(--gradient-primary) 1;
}

/* Shadow Effects */
.shadow-custom {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.shadow-custom:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
} 

/* ==========================================================================
   Added sections: Why AIOpt, How it works, Safety gates, Evidence
   Uses the existing tokens (--primary-color, --logo-gold, --gradient-dark)
   ========================================================================== */

.section-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary-color);
}

.why-section .section-eyebrow {
    color: var(--logo-gold);
}

/* --- Why AIOpt --- */
.why-section {
    background: var(--gradient-dark);
    position: relative;
}

.why-claim {
    border-left: 4px solid var(--logo-gold);
    background: rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 20px 24px;
    font-size: 1.08rem;
    font-weight: 600;
}

.why-image {
    width: 100%;
    height: 360px;
    object-fit: cover;
    border-radius: 15px;
}

/* --- Diagrams --- */
.diagram-frame {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    padding: 28px 24px;
    overflow-x: auto;
}

.diagram-svg {
    display: block;
    width: 100%;
    height: auto;
    min-width: 900px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- How it works points --- */
.how-point {
    padding: 24px 4px 0;
}

.how-point i {
    color: var(--primary-color);
}

.how-point h5 {
    font-weight: 700;
    margin-bottom: 10px;
}

/* --- Safety gate cards --- */
.gate-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-top: 3px solid var(--primary-color);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
    padding: 26px 26px 28px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.gate-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.gate-num {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary-color);
    opacity: 0.35;
    letter-spacing: -0.02em;
}

.gate-head i {
    color: var(--primary-color);
    font-size: 1.15rem;
}

.gate-card h5 {
    font-weight: 700;
    margin-bottom: 10px;
}

.gate-card-wide {
    border-top-color: var(--logo-gold);
}

.gate-card-wide .gate-num,
.gate-card-wide .gate-head i {
    color: #b08a3c;
}

.gate-case {
    background: #f8f9fa;
    border-left: 3px solid #dc3545;
    border-radius: 10px;
    padding: 16px 18px;
    height: 100%;
}

.gate-case p {
    font-size: 0.94rem;
    color: #5a6472;
}

.gate-case-src {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b02a37;
    margin-bottom: 8px;
}

/* --- Evidence cards --- */
.ev-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
    padding: 26px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ev-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.1);
}

.ev-card i {
    display: block;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.ev-card h5 {
    font-weight: 700;
    margin-bottom: 10px;
}

/* --- Sovereignty block --- */
.sovereignty {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
    padding: 24px;
}

.sovereignty img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.sovereignty h4 {
    font-weight: 700;
    margin-bottom: 12px;
}

/* --- RTL handling for the added blocks --- */
[dir="rtl"] .why-claim {
    border-left: none;
    border-right: 4px solid var(--logo-gold);
}

[dir="rtl"] .gate-case {
    border-left: none;
    border-right: 3px solid #dc3545;
}

@media (max-width: 767.98px) {
    .why-image {
        height: 240px;
    }

    .diagram-frame {
        padding: 18px 14px;
    }

    .sovereignty img {
        height: 180px;
    }
}

/* Hero chart canvas has hardcoded width=500; keep it inside the viewport on phones */
#aiChart {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Colour system: tinted icon tiles + hue-coded safety gates
   ========================================================================== */

:root {
    --c-blue:   #0d6efd;
    --c-indigo: #5a63e8;
    --c-teal:   #0f9c92;
    --c-amber:  #d1811f;
    --c-green:  #1a9e57;
    --c-rose:   #d63d59;
    --c-violet: #7a4ddb;
    --c-gold:   #b08a3c;
}

.icon-tile {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex: 0 0 auto;
    background: var(--tile-bg);
    color: var(--tile-fg);
    transition: transform 0.3s ease;
}

.icon-tile-lg {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 1.6rem;
}

/* the glyph always takes the tile's colour and size, overriding older rules */
.icon-tile i,
.gate-head i,
.ev-card .icon-tile i,
.how-point .icon-tile i {
    color: inherit;
    font-size: inherit;
    display: inline;
}

.feature-card:hover .icon-tile,
.tech-card:hover .icon-tile,
.gate-card:hover .icon-tile,
.ev-card:hover .icon-tile {
    transform: scale(1.06);
}

.tile-blue   { --tile-bg: rgba(13, 110, 253, 0.11);  --tile-fg: var(--c-blue); }
.tile-indigo { --tile-bg: rgba(90, 99, 232, 0.12);   --tile-fg: var(--c-indigo); }
.tile-teal   { --tile-bg: rgba(15, 156, 146, 0.12);  --tile-fg: var(--c-teal); }
.tile-amber  { --tile-bg: rgba(209, 129, 31, 0.13);  --tile-fg: var(--c-amber); }
.tile-green  { --tile-bg: rgba(26, 158, 87, 0.12);   --tile-fg: var(--c-green); }
.tile-rose   { --tile-bg: rgba(214, 61, 89, 0.11);   --tile-fg: var(--c-rose); }
.tile-violet { --tile-bg: rgba(122, 77, 219, 0.12);  --tile-fg: var(--c-violet); }
.tile-gold   { --tile-bg: rgba(176, 138, 60, 0.15);  --tile-fg: var(--c-gold); }

/* gate cards take their accent from the same hue as their tile */
.gate-card {
    border-top-color: var(--tile-fg, var(--primary-color));
}

.gate-card .gate-num {
    color: var(--tile-fg, var(--primary-color));
    opacity: 0.5;
    margin-left: auto;
    font-size: 1.45rem;
}

.gate-head {
    align-items: center;
}

/* gradient rule under every centred section heading */
section .text-center > h2.display-5 {
    position: relative;
    padding-bottom: 20px;
}

section .text-center > h2.display-5::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 76px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--c-blue) 0%, var(--c-violet) 55%, var(--c-teal) 100%);
}

[dir="rtl"] .gate-card .gate-num {
    margin-left: 0;
    margin-right: auto;
}
