/* Global Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: #050505;
    color: #fff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
    min-height: 100vh;
}

/* Touch-friendly tap targets */
a, button {
    min-height: 44px;
    min-width: 44px;
}

/* Prevent zoom on input focus (iOS) */
input, select, textarea {
    font-size: 16px;
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

.brand-font {
    font-family: 'Space Grotesk', sans-serif;
}

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

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a3e635;
}

/* Blob Animation */
@keyframes blob {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0px, 0px) scale(1); }
}

.animate-blob {
    animation: blob 7s infinite;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    position: relative;
}

.hover-card:hover {
    border-color: #a3e635;
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 10px 30px -10px rgba(163, 230, 53, 0.12);
}

/* Marquee Animation */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.marquee-content {
    display: inline-block;
    animation: marquee 18s linear infinite;
}

.marquee-item {
    display: inline-flex;
    align-items: center;
    margin-right: 2rem;
    font-size: 1.1rem;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-55%);
    }
}

@media (max-width: 640px) {
    .marquee-content {
        font-size: 1rem;
        animation-duration: 28s;
    }
    
    .marquee-item {
        margin-right: 1rem;
    }
}

/* 3D Cube Animation */
.scene {
    width: 60px;
    height: 60px;
    perspective: 1000px;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: spinCube 7s infinite linear;
}

.cube-face {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 1.5px solid #a3e635;
    background: rgba(163, 230, 53, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #a3e635;
}

.front {
    transform: rotateY(0deg) translateZ(30px);
}

.back {
    transform: rotateY(180deg) translateZ(30px);
}

.right {
    transform: rotateY(90deg) translateZ(30px);
}

.left {
    transform: rotateY(-90deg) translateZ(30px);
}

.top {
    transform: rotateX(90deg) translateZ(30px);
}

.bottom {
    transform: rotateX(-90deg) translateZ(30px);
}

@keyframes spinCube {
    0% {
        transform: rotateX(0) rotateY(0);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* LED Blink Animation */
.led-blink {
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 10px #a3e635;
    }
    50% {
        opacity: 0.3;
        box-shadow: none;
    }
}

/* Tank Fill Animation */
.tank-fill {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    background: #a3e635;
    animation: fillTank 4s infinite ease-in-out;
    border-radius: 0 0 6px 6px;
    z-index: 1;
}

@keyframes fillTank {
    0% {
        height: 20%;
    }
    50% {
        height: 80%;
    }
    100% {
        height: 20%;
    }
}

/* Circuit Path Animation */
.circuit-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: dash 2.5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: 0;
    }
}

/* Typing Animation */
.typing::after {
    content: '|';
    animation: blinkCursor 1s infinite;
}

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

/* Phone Mockup Scrollbar */
.phone-scroll {
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.phone-scroll::-webkit-scrollbar {
    width: 5px;
}

.phone-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.phone-scroll::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.phone-scroll::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Tab Button Styles */
.tab-btn {
    transition: all 0.3s ease;
}

.tab-btn.active {
    border-color: #a3e635 !important;
    background: rgba(163, 230, 53, 0.15) !important;
}

.tab-btn.active i {
    color: #a3e635;
}

/* Education Logo Styling */
.edu-logo {
    transition: all 0.3s ease;
    cursor: pointer;
    filter: grayscale(100%);
    opacity: 0.6;
    border: 2px solid transparent;
}

.edu-logo:hover,
.edu-logo.active {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
    border-color: #a3e635;
    box-shadow: 0 0 15px rgba(163, 230, 53, 0.2);
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease-in-out;
    padding: 20px;
}

.modal-content {
    background: #111;
    margin: 3% auto;
    padding: 0;
    border: 1.5px solid #333;
    width: 95%;
    max-width: 600px;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 20px;
    top: 16px;
    color: #a3e635;
    background: #222;
    border-radius: 50%;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, color 0.3s;
    border: 2px solid #a3e635;
}

.close:hover {
    background: #a3e635;
    color: #222;
}

@media (max-width: 640px) {
    .modal-content {
        max-width: 98vw;
    }
    
    .close {
        font-size: 36px;
        width: 52px;
        height: 52px;
    }
}

/* Performance Optimization: Reduce animations on mobile */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    /* Reduce blob animation intensity on mobile for performance */
    .animate-blob {
        animation-duration: 10s;
        filter: blur(80px);
        opacity: 0.08;
    }
    
    /* Optimize touch scrolling */
    .phone-scroll {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better text sizing on mobile */
    h1 {
        font-size: clamp(2rem, 8vw, 4rem);
    }
    
    /* Prevent horizontal scroll */
    section {
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* High DPI screen optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #a3e635;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .animate-blob,
    nav,
    #mobile-menu,
    .phone-scroll {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ============================================
   LANGUAGE SWITCHER STYLES
   ============================================ */

/* Language Dropdown */
#lang-dropdown,
#lang-dropdown-mobile {
    position: relative;
}

#lang-menu,
#lang-menu-mobile {
    z-index: 100;
    animation: fadeIn 0.2s ease-out;
}

/* Language Button Active State */
.lang-btn.active,
.lang-btn-mobile.active {
    background: rgba(163, 230, 53, 0.15) !important;
}

.lang-btn.active::before,
.lang-btn-mobile.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #a3e635;
    border-radius: 0 2px 2px 0;
}

.lang-btn,
.lang-btn-mobile {
    position: relative;
    transition: all 0.2s ease;
}

.lang-btn:hover,
.lang-btn-mobile:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Flag Image Styling */
#current-lang-flag,
#current-lang-flag-mobile,
.lang-btn img,
.lang-btn-mobile img {
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Smooth Language Transition */
[data-i18n] {
    transition: opacity 0.2s ease;
}

/* Language Switch Animation */
@keyframes langSwitch {
    0% { opacity: 0; transform: translateY(-5px); }
    100% { opacity: 1; transform: translateY(0); }
}

.lang-switching [data-i18n] {
    animation: langSwitch 0.3s ease-out;
}
