/* ===========================
   PREMIUM ENHANCEMENTS CSS
   Mustafa Portfolio
   MOBILE-OPTIMIZED VERSION
   =========================== */

:root {
    --primary-cyan: #00ffe7;
    --primary-magenta: #ff00ff;
    --gradient-primary: linear-gradient(135deg, #00ffe7, #ff00ff);
    --glass-border: rgba(0, 255, 231, 0.25);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --animation-speed: 1;
    /* Default multiplier */
}

body {
    padding-top: 80px !important;
    /* Forces offset for fixed headers across all pages */
    overflow-x: hidden;
}

/* 1. Loading Screen */
#loading-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

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

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loader-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 20px var(--primary-cyan);
    letter-spacing: 5px;
}

.loader-bar-container {
    width: 250px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: var(--gradient-primary);
    box-shadow: 0 0 15px var(--primary-cyan);
    animation: loadProgress 2s ease-in-out forwards;
}

@keyframes loadProgress {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

.loader-text {
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    color: var(--primary-cyan);
    letter-spacing: 3px;
    text-indent: 0;
    /* Remove optical centering - use actual center */
    text-align: center;
    width: 100%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* 2. Custom Cursor (Desktop Only) */
@media (min-width: 1025px) {
    body {
        cursor: none;
    }

    a,
    button,
    .fab-item,
    .skill-item,
    .project-card,
    .btn-primary {
        cursor: none;
    }

    .custom-cursor {
        width: 18px;
        height: 18px;
        border: 1.5px solid var(--primary-cyan);
        border-radius: 50%;
        position: fixed;
        pointer-events: none;
        z-index: 30000;
        transition: transform 0.1s ease-out, width 0.3s, height 0.3s, border-color 0.3s;
        transform: translate(-50%, -50%);
        mix-blend-mode: difference;
    }

    .custom-cursor-dot {
        width: 4px;
        height: 4px;
        background: var(--primary-magenta);
        border-radius: 50%;
        position: fixed;
        pointer-events: none;
        z-index: 30001;
        transform: translate(-50%, -50%);
    }

    body.cursor-hover .custom-cursor {
        width: 32px;
        height: 32px;
        background: rgba(0, 255, 231, 0.1);
        border-color: var(--primary-magenta);
    }
}

/* MOBILE: Hide cursor elements completely */
@media (max-width: 1024px) {

    .custom-cursor,
    .custom-cursor-dot {
        display: none !important;
    }
}

/* 3. Hero Section Enhancements */
.hero {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    margin-bottom: 50px;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.hero-image-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 1.5rem;
}

.hero-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-cyan);
    position: relative;
    z-index: 2;
    box-shadow: 0 0 40px rgba(0, 255, 231, 0.4);
}

.hero-image-glow {
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    background: var(--gradient-primary);
    border-radius: 50%;
    filter: blur(25px);
    opacity: 0.4;
    animation: glowPulseHero 5s infinite;
}

/* MOBILE FIX: Much slower glow animation */
@keyframes glowPulseHero {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@media (max-width: 768px) {
    .hero-image-glow {
        animation: glowPulseHero 8s infinite;
        /* Much slower on mobile */
    }
}

.typing-container {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--primary-cyan);
    font-family: 'Poppins', sans-serif;
    height: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    text-align: center;
    width: 100%;
}

.cursor-blink {
    animation: blinkCursor 0.8s infinite;
    margin-left: 5px;
    color: #fff;
}

@keyframes blinkCursor {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.hero-stats {
    display: flex;
    gap: 3rem;
    margin: 2rem auto;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 5px;
}

/* 4. Timeline Upgrades */
.timeline-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.2rem;
}

.company-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* MOBILE FIX: Disable transform on mobile */
@media (min-width: 769px) {
    .timeline-item:hover .company-logo {
        transform: scale(1.1) rotate(5deg);
        border-color: var(--primary-cyan);
    }
}

.title-group h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary-cyan);
}

.duration {
    background: rgba(0, 255, 231, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(0, 255, 231, 0.2);
}

/* 5. Skills Progress Upgrades */
.skill-item-wrapper {
    margin-bottom: 1.5rem;
    width: 100%;
}

.skill-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.skill-progress-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
    position: relative;
}

.skill-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    box-shadow: 0 0 15px var(--primary-cyan);
    border-radius: 10px;
    width: 0;
    /* Animated via JS or simple CSS transition */
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* MOBILE FIX: Slower skill bar animation */
@media (max-width: 768px) {
    .skill-progress-fill {
        transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
        /* Slower on mobile */
    }
}

/* 6. Section Dividers & Layout Stability */
section {
    position: relative;
    z-index: 10;
    overflow: visible;
}

section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
    box-shadow: 0 0 15px var(--primary-cyan);
    z-index: 11;
}

/* 7. Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 99999;
    animation: confettiFall 4s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
}

/* MOBILE FIX: Reduce particle canvas opacity on mobile for better performance */
@media (max-width: 768px) {
    #particleCanvas {
        opacity: 0.3;
        /* Even less prominent on mobile */
    }

    /* Extra slow glow animation on mobile */
    .hero-image-glow {
        animation: glowPulseHero 12s infinite !important;
    }

    /* Slower loading bar */
    .loader-bar {
        animation: loadProgress 3.5s ease-in-out forwards !important;
    }

    /* Slower pulse */
    .loader-text {
        animation: pulse 2.5s infinite !important;
    }

    /* Slower confetti */
    .confetti {
        animation: confettiFall 7s linear forwards !important;
    }

    /* CRITICAL: Slow down background particles */
    .particle {
        animation-duration: 12s !important;
        /* Much slower floating particles */
    }

    /* Keep background animations slow */
    .particles,
    #particles {
        animation-duration: 10s !important;
    }

    /* Slow down any background animations */
    .background-animation,
    .background-animation::before,
    .background-animation::after {
        animation-duration: 20s !important;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .hero-stats {
        gap: 1.5rem;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .typing-container {
        height: 2rem;
        font-size: 1.1rem;
    }

    .timeline-header {
        gap: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .company-logo {
        width: 45px;
        height: 45px;
    }

    /* Disable heavy hover effects on mobile */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* CRITICAL MOBILE PERFORMANCE FIXES */
@media (max-width: 768px) {

    /* Force slow animations on mobile - cannot be overridden */
    html,
    body {
        --animation-speed: 3 !important;
        /* Slow multiplier */
    }

    /* Slow down specific animations with maximum specificity */
    .hero-image-glow {
        animation: glowPulseHero 12s infinite !important;
        animation-timing-function: ease-in-out !important;
    }

    /* Disable complex transforms on mobile */
    .timeline-item:hover,
    .skill-item:hover,
    .project-card:hover,
    .video-card:hover,
    .company-logo:hover {
        transform: none !important;
    }

    /* Specific slow transitions for interactive elements only */
    button,
    .btn-primary,
    .fab-item,
    .skill-item,
    .timeline-item {
        transition-duration: 0.3s !important;
    }

    /* Keep skill bars slow */
    .skill-progress-fill {
        transition: width 3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Lock particle animation speeds */
    .particle {
        animation-duration: 12s !important;
        animation-timing-function: linear !important;
    }

    /* Lock background particles */
    .particles *,
    #particles * {
        animation-duration: 12s !important;
    }

    /* Don't affect canvas or particle canvas */
    #particleCanvas,
    canvas {
        animation: none !important;
        transition: none !important;
    }

    /* Prevent any scroll-based animation speed changes */
    * {
        animation-play-state: running !important;
    }
}

/* Performance optimization for all devices */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================
   MOBILE LAYOUT FIXES & IMPROVEMENTS
   Fixes: Loading screen centering, video card sizing, content alignment
   ========================================== */
@media (max-width: 768px) {

    /* Fix loading screen text centering */
    .loader-content {
        width: 100%;
        padding: 0 1rem;
    }

    .loader-logo {
        text-indent: 0;
        text-align: center;
    }

    /* Video Grid: Make cards smaller and fit 2 per row on mobile */
    .video-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
        gap: 1.5rem !important;
        padding: 1rem !important;
        max-width: 100% !important;
    }

    /* Video Cards: Reduce size significantly on mobile */
    .video-card {
        padding: 1rem !important;
        min-height: auto !important;
        max-width: 100% !important;
        height: auto !important;
    }

    .video-card video,
    .video-card .video-placeholder {
        height: 160px !important;
        /* Smaller video height */
        object-fit: cover !important;
        max-height: 160px !important;
    }

    .video-card h3 {
        font-size: 1rem !important;
        margin: 0.8rem 0 0.5rem 0 !important;
    }

    .video-card p {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
        margin-bottom: 0.5rem !important;
    }

    .video-card .tags {
        font-size: 0.75rem !important;
    }

    /* Portfolio intro: more compact */
    .portfolio-intro {
        padding: 1.5rem 1rem !important;
        margin: 0 1rem 2rem 1rem !important;
    }

    .intro-text {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    /* Section titles: better spacing */
    .section-title {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        padding: 0 1rem !important;
    }

    /* Portfolio sections: proper spacing */
    .portfolio-section {
        padding: 2rem 0 !important;
        margin: 0 auto !important;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {

    /* Video cards: stack in single column on very small screens */
    .video-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0.5rem !important;
    }

    .video-card {
        padding: 0.8rem !important;
    }

    .video-card video,
    .video-card .video-placeholder {
        height: 140px !important;
        /* Even smaller on tiny screens */
        max-height: 140px !important;
    }

    .video-card h3 {
        font-size: 0.95rem !important;
    }

    .video-card p {
        font-size: 0.8rem !important;
    }

    /* Loading screen: adjust for small screens */
    .loader-logo {
        font-size: 2.5rem !important;
    }

    .loader-bar-container {
        width: 200px !important;
    }

    .loader-text {
        font-size: 0.7rem !important;
        letter-spacing: 2px !important;
    }
}

/* ==========================================
   EXPERIENCE BLOCKS - MOBILE OPTIMIZATION
   Make timeline/experience cards compact on mobile
   ========================================== */
@media (max-width: 768px) {

    /* Experience Section: Reduce spacing */
    #experience {
        padding: 2rem 0 !important;
    }

    /* Timeline: More compact */
    .timeline {
        padding-left: 1rem !important;
        margin: 0 !important;
    }

    .timeline::before {
        left: 0 !important;
        width: 1px !important;
        /* Thinner line on mobile */
    }

    /* Timeline Items: Much more compact */
    .timeline-item {
        padding: 0.8rem 1rem !important;
        margin-bottom: 0.8rem !important;
        font-size: 0.9rem !important;
    }

    .timeline-item::before {
        left: -0.5rem !important;
        width: 8px !important;
        height: 8px !important;
        top: 1rem !important;
    }

    /* Timeline Headers: Smaller */
    .timeline-header {
        gap: 0.8rem !important;
        margin-bottom: 0.5rem !important;
        flex-direction: row !important;
        align-items: center !important;
    }

    .timeline-item h3,
    .title-group h3 {
        font-size: 0.95rem !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }

    /* Company Logos: Smaller */
    .company-logo {
        width: 35px !important;
        height: 35px !important;
        padding: 5px !important;
        flex-shrink: 0 !important;
    }

    /* Timeline Text: Compact */
    .timeline-item .company {
        font-size: 0.85rem !important;
        display: block !important;
        margin-top: 0.3rem !important;
    }

    .timeline-item .duration,
    .duration {
        font-size: 0.75rem !important;
        padding: 3px 8px !important;
        margin-bottom: 0.5rem !important;
        display: inline-block !important;
    }

    .timeline-item .location {
        font-size: 0.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .timeline-item p,
    .timeline-item ul {
        font-size: 0.8rem !important;
        line-height: 1.5 !important;
        margin: 0.5rem 0 !important;
    }

    .timeline-item ul {
        padding-left: 1.2rem !important;
    }

    .timeline-item li {
        margin-bottom: 0.3rem !important;
        font-size: 0.8rem !important;
    }

    /* Disable hover effects on mobile */
    .timeline-item:hover {
        transform: none !important;
    }
}

/* Extra small screens: Even more compact */
@media (max-width: 480px) {

    .timeline {
        padding-left: 0.8rem !important;
    }

    .timeline-item {
        padding: 0.7rem 0.8rem !important;
        margin-bottom: 0.6rem !important;
    }

    .timeline-item h3 {
        font-size: 0.9rem !important;
    }

    .company-logo {
        width: 30px !important;
        height: 30px !important;
    }

    .timeline-item p,
    .timeline-item li {
        font-size: 0.75rem !important;
    }

    .timeline-header {
        gap: 0.6rem !important;
    }
}