/* Custom Styles */
body {
    background-color: #000;
    color: #E0E0E0;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessibility improvements */
*:focus {
    outline: 2px solid #00f6ff;
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #00f6ff;
    color: #000;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-to-content:focus {
    top: 6px;
}

h1, h2, h3, .font-orbitron {
    font-family: 'Orbitron', sans-serif;
    line-height: 1.2;
}

/* Image Loading Optimizations */
.image-placeholder {
    background: linear-gradient(90deg, #1e293b 25%, #374151 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    position: relative;
}

.image-lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.image-lazy.loaded {
    opacity: 1;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Optimize image rendering */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimizeQuality;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce layout shifts */
.service-card-v2 img,
.work-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    aspect-ratio: 16/9;
}

/* Glowing Effect */
.glow-button {
    box-shadow: 0 0 5px #00f6ff, 0 0 15px #00f6ff, 0 0 25px #00f6ff;
    transition: all 0.3s ease-in-out;
}
.glow-button:hover {
    box-shadow: 0 0 10px #00f6ff, 0 0 25px #00f6ff, 0 0 50px #00f6ff;
    transform: scale(1.05);
}
.glow-button:disabled {
    box-shadow: none; cursor: not-allowed; background-color: #555; color: #999;
}

/* Text Glow */
.text-glow {
    text-shadow: 0 0 8px #00f6ff, 0 0 10px #00f6ff;
}

/* Matrix Canvas */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Page Transition */
.page-content {
    transition: opacity 0.5s ease-in-out;
}
.page-fade-out {
    opacity: 0;
}

/* Glassmorphism Effect for Cards */
.glass-card {
    background: rgba(10, 15, 31, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 246, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.glass-card:hover {
    background: rgba(10, 15, 31, 0.95);
    border: 1px solid rgba(0, 246, 255, 0.6);
    transform: translateY(-10px);
}
.glass-card::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 246, 255, 0.5), transparent);
    transition: 0.5s;
}
.glass-card:hover::before { left: 100%; }

/* NEW Service Card Style with 3D Tilt Effect */
.service-card-v2 {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    transform-style: preserve-3d;
}

.service-card-v2:hover {
    transform: perspective(1000px) rotateY(var(--rotateY)) rotateX(var(--rotateX)) scale3d(1.05, 1.05, 1.05);
    box-shadow: 0 10px 30px rgba(0, 246, 255, 0.3);
    border-color: rgba(56, 189, 248, 0.5);
}

.service-card-v2 .card-content {
    transform: translateZ(20px);
}

/* Loader for Gemini API */
.loader {
    width: 48px; height: 48px; border: 5px solid #FFF; border-bottom-color: #00f6ff;
    border-radius: 50%; display: inline-block; box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
@keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Pulsing Glow Animation */
@keyframes text-pulse {
    0% { text-shadow: 0 0 8px #00f6ff, 0 0 10px #00f6ff; }
    50% { text-shadow: 0 0 15px #00f6ff, 0 0 25px #00f6ff; }
    100% { text-shadow: 0 0 8px #00f6ff, 0 0 10px #00f6ff; }
}

#hero-headline {
    animation: text-pulse 2s ease-in-out infinite;
}

/* Hero Subtext Animation */
#hero-subtext-box {
    opacity: 0;
    animation: fadeInSubtext 1s ease-out forwards;
}

@keyframes fadeInSubtext {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glitch Effect */
.glitch-active .glitch-text {
    animation: glitch-text 1s linear;
}
@keyframes glitch-text {
    0% { transform: translate(0); } 20% { transform: translate(-3px, 3px); } 40% { transform: translate(-3px, -3px); }
    60% { transform: translate(3px, 3px); } 80% { transform: translate(3px, -3px); } 100% { transform: translate(0); }
}

/* Scroll Animation Classes */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- AI Chat Agent Styles --- */
#chat-bubble {
    position: fixed; bottom: 2rem; right: 2rem; width: 60px; height: 60px;
    background-color: #00f6ff; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; cursor: pointer; z-index: 1000;
    box-shadow: 0 0 10px #00f6ff, 0 0 25px #00f6ff; transition: transform 0.3s ease;
}
#chat-bubble:hover { transform: scale(1.1); }
#chat-window {
    position: fixed; bottom: 7rem; right: 2rem; width: 90%; max-width: 400px;
    height: 500px; border-radius: 15px; overflow: hidden; display: flex;
    flex-direction: column; transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right; z-index: 999;
}
.chat-hidden { opacity: 0; transform: scale(0.5); pointer-events: none; }
.chat-message { padding: 10px 15px; border-radius: 20px; margin-bottom: 10px; max-width: 80%; word-wrap: break-word; }
.user-message { background-color: #00f6ff; color: #000; align-self: flex-end; margin-left: auto; border-bottom-right-radius: 5px; }
.ai-message { background-color: #1e293b; color: #e0e0e0; align-self: flex-start; border-bottom-left-radius: 5px; }
.typing-indicator { display: flex; align-items: center; padding: 10px 15px; }
.typing-indicator span {
    height: 8px; width: 8px; background-color: #94a3b8; border-radius: 50%;
    display: inline-block; margin: 0 2px; animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    /* Typography adjustments */
    #hero-headline { 
        font-size: 2rem !important; 
        line-height: 1.2; 
        padding: 0 1rem;
    }
    
    /* Container and spacing */
    .container { 
        padding-left: 1rem; 
        padding-right: 1rem; 
    }
    
    /* Hero section mobile optimization */
    #hero {
        padding-top: 80px;
        min-height: 100vh;
    }
    
    #hero-subtext-box {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    #explore-btn {
        padding: 12px 24px;
        font-size: 1rem;
        margin-top: 1rem;
    }
    
    /* Mobile navigation improvements */
    header {
        padding: 1rem 0;
    }
    
    #mobile-menu {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    #mobile-menu a {
        padding: 16px;
        font-size: 1.1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Service cards mobile optimization */
    .glass-card, .service-card-v2 { 
        margin: 0.5rem 0; 
        padding: 1rem !important; 
    }
    
    .service-card-v2 h3 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .service-card-v2 p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    /* Grid improvements */
    .grid { 
        gap: 1rem; 
        grid-template-columns: 1fr;
    }
    
    /* Mobile chat optimizations */
    #chat-window { 
        width: 95%; 
        height: 400px; 
        bottom: 5rem; 
        right: 1rem; 
        max-width: none;
    }
    
    #chat-bubble { 
        bottom: 1rem; 
        right: 1rem; 
        width: 50px; 
        height: 50px; 
    }
    
    #chat-bubble svg {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    /* Mobile form optimizations */
    .idea-generator-container { 
        flex-direction: column; 
        gap: 0.75rem; 
    }
    
    .idea-generator-container select,
    .idea-generator-container button,
    .idea-generator-container input { 
        width: 100%; 
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    /* Mobile work page */
    .work-image {
        height: 200px;
    }
    
    /* Touch improvements */
    .nav-link,
    .glow-button,
    button {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Mobile text improvements */
    .text-4xl {
        font-size: 2rem !important;
    }
    
    .text-3xl {
        font-size: 1.75rem !important;
    }
    
    .text-2xl {
        font-size: 1.5rem !important;
    }
    
    /* Mobile padding adjustments */
    .py-32 {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }
    
    .py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Disable 3D effects on mobile for performance */
    .service-card-v2:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(0, 246, 255, 0.2);
    }
    
    /* Mobile-specific animations */
    .reveal {
        transform: translateY(20px);
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    #hero-headline { 
        font-size: 1.75rem !important; 
        padding: 0 0.5rem;
    }
    
    #chat-window { 
        width: 98%; 
        height: 350px; 
        right: 0.5rem; 
        left: 0.5rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .service-card-v2,
    .glass-card {
        padding: 0.75rem !important;
        margin: 0.25rem 0;
    }
    
    /* Extra small text adjustments */
    .text-lg {
        font-size: 1rem !important;
    }
    
    #explore-btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    /* Improved touch targets */
    #mobile-menu a {
        padding: 20px;
        font-size: 1.05rem;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    #hero {
        min-height: 100vh;
        padding-top: 60px;
    }
    
    .py-32 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    #chat-window {
        height: 300px;
    }
}

/* High DPI mobile displays */
@media (-webkit-min-device-pixel-ratio: 2) and (max-width: 768px) {
    .text-glow {
        text-shadow: 0 0 4px #00f6ff, 0 0 6px #00f6ff;
    }
    
    .glow-button {
        box-shadow: 0 0 3px #00f6ff, 0 0 8px #00f6ff, 0 0 15px #00f6ff;
    }
}
