/* FAHNA Group - Custom Styles */

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

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

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff, #7c3aed);
    border-radius: 4px;
}

/* Selection */
::selection {
    background: rgba(0, 212, 255, 0.3);
    color: white;
}

/* Line Clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glow Effect */
.glow {
    box-shadow: 0 0 60px rgba(0, 212, 255, 0.3);
}

.glow-accent2 {
    box-shadow: 0 0 60px rgba(124, 58, 237, 0.3);
}

.glow-green {
    box-shadow: 0 0 60px rgba(16, 185, 129, 0.3);
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.2); }
    50% { box-shadow: 0 0 40px rgba(0, 212, 255, 0.4); }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-in-left {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scale-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Animation Classes */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 3s ease-in-out infinite;
}

.animate-slide-up {
    animation: slide-up 0.6s ease-out forwards;
}

.animate-fade-in {
    animation: fade-in 0.6s ease-out forwards;
}

.animate-slide-in-right {
    animation: slide-in-right 0.6s ease-out forwards;
}

.animate-slide-in-left {
    animation: slide-in-left 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scale-in 0.6s ease-out forwards;
}

/* Delay Classes */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s ease-out;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s ease-out;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s ease-out;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Tech Card Hover */
.tech-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tech-card:hover {
    transform: translateY(-8px);
}

/* Video Overlay */
.video-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(5,5,5,0.3) 0%, rgba(5,5,5,0.8) 100%);
    pointer-events: none;
}

/* Grid Pattern */
.grid-pattern {
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Noise Overlay */
.noise-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* Custom Cursor */
@media (hover: hover) {
    .custom-cursor {
        cursor: none;
    }
    
    .cursor-dot {
        width: 8px;
        height: 8px;
        background: #00d4ff;
        border-radius: 50%;
        position: fixed;
        pointer-events: none;
        z-index: 9999;
        transition: transform 0.1s ease;
        mix-blend-mode: difference;
    }
    
    .cursor-outline {
        width: 40px;
        height: 40px;
        border: 2px solid rgba(0, 212, 255, 0.5);
        border-radius: 50%;
        position: fixed;
        pointer-events: none;
        z-index: 9999;
        transition: transform 0.15s ease, width 0.2s ease, height 0.2s ease;
    }
}

/* Gradient Border */
.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* Shimmer Effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Tilt Effect */
.tilt {
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Glassmorphism */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Counter Animation */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Page Transition */
.page-transition {
    animation: page-fade 0.5s ease-out;
}

@keyframes page-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .tech-card:hover {
        transform: translateY(-4px);
    }
    
    /* Mobile Menu */
    #mobile-menu {
        max-height: 80vh;
        overflow-y: auto;
    }
    
    /* Mobile Typography */
    h1 {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    /* Mobile Spacing */
    section {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Mobile Video */
    video {
        object-position: center;
    }
    
    /* Mobile Cards */
    .tech-card {
        padding: 1.5rem !important;
    }
    
    /* Mobile Footer */
    footer .grid {
        gap: 2rem !important;
    }
    
    /* Touch-friendly buttons */
    button, a {
        min-height: 44px;
    }
    
    /* Better scrolling */
    html {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Hide scrollbar on mobile */
    ::-webkit-scrollbar {
        width: 4px;
    }
    
    /* Mobile hero section */
    .hero-section {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Mobile safe area */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Small phones */
@media (max-width: 380px) {
    h1 {
        font-size: 1.75rem !important;
    }
    
    .text-4xl {
        font-size: 1.5rem !important;
    }
    
    .text-5xl {
        font-size: 2rem !important;
    }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    .tech-card:hover {
        transform: translateY(-6px);
    }
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        min-height: 120vh;
    }
}

/* RTL Specific */
[dir="rtl"] .slide-in-left {
    animation-name: slide-in-left;
}

[dir="rtl"] .slide-in-right {
    animation-name: slide-in-right;
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    padding: 12px 24px;
    border-radius: 50px;
    z-index: 1000;
    animation: slide-up 0.5s ease-out;
}

/* Mobile Touch Feedback */
@media (hover: none) {
    .tech-card:active {
        transform: scale(0.98);
    }
    
    button:active {
        transform: scale(0.95);
    }
    
    a:active {
        opacity: 0.8;
    }
}

/* Bottom Navigation Bar */
#bottom-nav {
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
}

.bottom-nav-item {
    position: relative;
}

.bottom-nav-item .w-10 {
    background: transparent;
    transition: all 0.3s ease;
}

.bottom-nav-item.active .w-10,
.bottom-nav-item:hover .w-10 {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(124, 58, 237, 0.2));
}

.bottom-nav-item.active {
    color: #00d4ff;
}

.bottom-nav-item:not(.active) {
    color: rgba(255, 255, 255, 0.5);
}

.bottom-nav-item:not(.active):hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Active indicator dot */
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #00d4ff;
    border-radius: 50%;
    box-shadow: 0 0 10px #00d4ff;
}

/* Safe area for iPhone */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Bottom nav animation */
@keyframes nav-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.bottom-nav-item:active .w-10 {
    animation: nav-bounce 0.3s ease;
}

/* Hide bottom nav on scroll down */
#bottom-nav.hidden-nav {
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

#bottom-nav.visible-nav {
    transform: translateY(0);
    transition: transform 0.3s ease;
}

/* Desktop: hide bottom nav */
@media (min-width: 1024px) {
    #bottom-nav {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }
}

/* Mobile: add padding to body for bottom nav */
@media (max-width: 1023px) {
    body {
        padding-bottom: 80px;
    }
}

/* Bottom nav glass effect */
#bottom-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
    pointer-events: none;
}

/* Ripple effect on tap */
.bottom-nav-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0, 212, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    border-radius: inherit;
}

.bottom-nav-item:active::after {
    opacity: 1;
    transform: scale(1);
    transition: 0s;
}

/* Video Background Styles */
video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video Playing State */
video.playing {
    opacity: 1;
}

/* Video Not Playing - Fallback */
video:not(.playing) {
    opacity: 0;
}

/* Animated Background Fallback */
.hero-bg-fallback {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 80%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        linear-gradient(180deg, #050505 0%, #0a0a0a 100%);
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* Floating Particles Animation */
.floating-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.floating-particles::before,
.floating-particles::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 10s ease-in-out infinite;
}

.floating-particles::before {
    background: rgba(0, 212, 255, 0.2);
    top: 10%;
    right: 10%;
    animation-delay: 0s;
}

.floating-particles::after {
    background: rgba(124, 58, 237, 0.2);
    bottom: 10%;
    left: 10%;
    animation-delay: 5s;
}

/* Justify paragraph text on mobile so wrapped lines look tidy */
@media (max-width: 767px) {
    p {
        text-align: justify;
        text-align-last: right;
    }

    [dir="ltr"] p {
        text-align-last: left;
    }
}
