/* ========================================
   MAGMAR ENTERPRISES - SERVICE ANIMATIONS
   Advanced Animations for Individual Services
   ======================================== */

/* ========================================
   WEBSITE DESIGN & DEVELOPMENT
   Blueprint to Final Design Reveal
   ======================================== */

.blueprint-animation {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 4/3;
    margin: 2rem auto;
    perspective: 1000px;
}

.blueprint-layer,
.final-design-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    background-size: cover;
    background-position: center;
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.blueprint-layer {
    background: linear-gradient(135deg, rgba(0, 119, 255, 0.1) 0%, rgba(0, 119, 255, 0.05) 100%),
                url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(0,119,255,0.3)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    border: 2px solid rgba(0, 119, 255, 0.5);
    z-index: 2;
    opacity: 1;
}

.final-design-layer {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.2) 0%, rgba(10, 10, 10, 0.9) 100%);
    border: 2px solid rgba(220, 20, 60, 0.3);
    z-index: 1;
    transform: scale(0.95);
    opacity: 0;
    box-shadow: 0 20px 60px rgba(220, 20, 60, 0.4);
}

.blueprint-animation:hover .blueprint-layer {
    opacity: 0;
    transform: translateX(-50%) rotateY(90deg);
}

.blueprint-animation:hover .final-design-layer {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
}

/* Blueprint grid lines animation */
.blueprint-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.blueprint-line {
    position: absolute;
    background: rgba(0, 119, 255, 0.6);
    animation: draw-line 2s ease-in-out infinite;
}

.blueprint-line.horizontal {
    height: 1px;
    width: 0;
    left: 0;
}

.blueprint-line.vertical {
    width: 1px;
    height: 0;
    top: 0;
}

@keyframes draw-line {
    0%, 100% {
        width: 0;
        height: 0;
        opacity: 0.3;
    }
    50% {
        width: 100%;
        height: 100%;
        opacity: 0.8;
    }
}

/* ========================================
   APP DEVELOPMENT
   Rotating 3D Phone Mockups
   ======================================== */

.phone-mockup-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 500px;
    margin: 2rem auto;
    perspective: 1500px;
}

.phone-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: rotate-phones 20s linear infinite;
}

.phone-carousel:hover {
    animation-play-state: paused;
}

.phone-mockup {
    position: absolute;
    width: 200px;
    height: 400px;
    left: 50%;
    top: 50%;
    transform-style: preserve-3d;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(10, 10, 10, 0.95) 100%);
    border-radius: 30px;
    border: 3px solid rgba(220, 20, 60, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    padding: 15px;
}

.phone-mockup::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.1) 0%, rgba(10, 10, 10, 0.5) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.phone-mockup:nth-child(1) {
    transform: translate(-50%, -50%) rotateY(0deg) translateZ(300px);
}

.phone-mockup:nth-child(2) {
    transform: translate(-50%, -50%) rotateY(120deg) translateZ(300px);
}

.phone-mockup:nth-child(3) {
    transform: translate(-50%, -50%) rotateY(240deg) translateZ(300px);
}

@keyframes rotate-phones {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* ========================================
   DIGITAL MARKETING
   Animated Charts & Rising Metrics
   ======================================== */

.marketing-dashboard {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(10, 10, 10, 0.9) 100%);
    border-radius: 20px;
    border: 1px solid rgba(220, 20, 60, 0.2);
}

.metric-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: rgba(220, 20, 60, 0.1);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(220, 20, 60, 0.3);
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(220, 20, 60, 0.3);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-red);
    animation: count-up 2s ease-out;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--accent-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

@keyframes count-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-container {
    position: relative;
    height: 200px;
    background: rgba(10, 10, 10, 0.5);
    border-radius: 15px;
    padding: 1rem;
    overflow: hidden;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 100%;
    gap: 1rem;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--accent-red) 0%, var(--primary-red) 100%);
    border-radius: 5px 5px 0 0;
    position: relative;
    animation: bar-grow 1.5s ease-out;
    box-shadow: 0 0 20px rgba(220, 20, 60, 0.5);
}

.chart-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
    border-radius: 5px 5px 0 0;
}

@keyframes bar-grow {
    0% {
        height: 0;
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.chart-bar:nth-child(1) { height: 60%; animation-delay: 0.1s; }
.chart-bar:nth-child(2) { height: 45%; animation-delay: 0.2s; }
.chart-bar:nth-child(3) { height: 80%; animation-delay: 0.3s; }
.chart-bar:nth-child(4) { height: 55%; animation-delay: 0.4s; }
.chart-bar:nth-child(5) { height: 90%; animation-delay: 0.5s; }
.chart-bar:nth-child(6) { height: 70%; animation-delay: 0.6s; }

/* Glowing Ads Animation */
.glowing-ads {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.ad-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.2) 0%, rgba(10, 10, 10, 0.8) 100%);
    border: 1px solid rgba(220, 20, 60, 0.3);
    animation: glow-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(220, 20, 60, 0.4);
}

.ad-icon:nth-child(1) { animation-delay: 0s; }
.ad-icon:nth-child(2) { animation-delay: 0.3s; }
.ad-icon:nth-child(3) { animation-delay: 0.6s; }
.ad-icon:nth-child(4) { animation-delay: 0.9s; }

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(220, 20, 60, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px rgba(220, 20, 60, 0.8);
        transform: scale(1.05);
    }
}

/* ========================================
   ANIMATION & CREATIVE DESIGN
   Sketch to Final Cinematic Reel
   ======================================== */

.sketch-to-final {
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 400px;
    margin: 2rem auto;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
}

.sketch-layer,
.final-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: all 1.5s ease;
}

.sketch-layer {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    filter: grayscale(1) contrast(1.5);
    z-index: 2;
    clip-path: circle(70% at 50% 50%);
}

.final-layer {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.3) 0%, rgba(10, 10, 10, 0.7) 100%);
    z-index: 1;
    filter: brightness(1.2) saturate(1.3);
}

.sketch-to-final:hover .sketch-layer {
    clip-path: circle(0% at 50% 50%);
    opacity: 0;
}

/* Cinematic overlay */
.cinematic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    background: 
        linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 10%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 10%);
}

/* Film grain effect */
.film-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    z-index: 4;
    pointer-events: none;
    animation: grain 0.5s steps(2) infinite;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)"/></svg>');
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(-10%, 5%); }
    30% { transform: translate(5%, -10%); }
    40% { transform: translate(-5%, 15%); }
    50% { transform: translate(-10%, 5%); }
    60% { transform: translate(15%, 0); }
    70% { transform: translate(0, 10%); }
    80% { transform: translate(-15%, 0); }
    90% { transform: translate(10%, 5%); }
}

/* ========================================
   FINANCIAL & AUTOMATION
   Futuristic Dashboards & Flowing Data
   ======================================== */

.automation-dashboard {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(10, 10, 10, 0.95) 100%);
    border-radius: 20px;
    border: 1px solid rgba(220, 20, 60, 0.2);
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(220, 20, 60, 0.2);
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--accent-gray);
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--primary-red);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 0 10px var(--glow-red);
}

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

.data-flow-container {
    position: relative;
    height: 300px;
    background: rgba(10, 10, 10, 0.5);
    border-radius: 15px;
    overflow: hidden;
}

.data-stream {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(180deg, transparent 0%, var(--primary-red) 50%, transparent 100%);
    animation: flow-data 3s linear infinite;
    opacity: 0.6;
}

.data-stream:nth-child(1) { left: 10%; animation-delay: 0s; }
.data-stream:nth-child(2) { left: 25%; animation-delay: 0.5s; }
.data-stream:nth-child(3) { left: 40%; animation-delay: 1s; }
.data-stream:nth-child(4) { left: 55%; animation-delay: 1.5s; }
.data-stream:nth-child(5) { left: 70%; animation-delay: 2s; }
.data-stream:nth-child(6) { left: 85%; animation-delay: 2.5s; }

@keyframes flow-data {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(400%);
        opacity: 0;
    }
}

.automation-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.stat-box {
    background: rgba(220, 20, 60, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(220, 20, 60, 0.2);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-red);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
}

/* ========================================
   BRANDING & GRAPHICS
   Logo Evolution Animation
   ======================================== */

.brand-evolution {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 400px;
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.brand-stage {
    position: absolute;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 1s ease;
    border-radius: 20px;
}

.sketch-stage {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    z-index: 3;
    opacity: 1;
}

.refined-stage {
    background: rgba(220, 20, 60, 0.1);
    border: 2px solid rgba(220, 20, 60, 0.3);
    z-index: 2;
    opacity: 0;
    transform: scale(0.8) rotateY(90deg);
}

.final-brand-stage {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.2) 0%, rgba(10, 10, 10, 0.9) 100%);
    border: 2px solid var(--primary-red);
    z-index: 1;
    opacity: 0;
    transform: scale(0.6) rotateY(180deg);
    box-shadow: 0 20px 60px rgba(220, 20, 60, 0.5);
}

.brand-evolution:hover .sketch-stage {
    opacity: 0;
    transform: scale(1.2) rotateY(-90deg);
}

.brand-evolution:hover .refined-stage {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
    transition-delay: 0.3s;
}

.brand-evolution:hover .final-brand-stage {
    opacity: 1;
    transform: scale(1.1) rotateY(0deg);
    transition-delay: 0.6s;
}

.brand-icon {
    font-size: 5rem;
    background: linear-gradient(135deg, var(--accent-white) 0%, var(--primary-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   PORTFOLIO HOVER EFFECTS
   Before/After Peel Animation
   ======================================== */

.portfolio-peel {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
}

.before-image,
.after-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.before-image {
    z-index: 2;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-peel:hover .before-image {
    clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
}

.peel-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 100px 100px 0;
    border-color: transparent rgba(220, 20, 60, 0.8) transparent transparent;
    z-index: 3;
    transition: all 0.8s ease;
    filter: drop-shadow(-5px 5px 10px rgba(0, 0, 0, 0.5));
}

.portfolio-peel:hover .peel-corner {
    border-width: 0 200px 200px 0;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .metric-cards {
        grid-template-columns: 1fr;
    }
    
    .automation-stats {
        grid-template-columns: 1fr;
    }
    
    .phone-mockup-container {
        height: 400px;
    }
    
    .brand-stage {
        width: 250px;
        height: 250px;
    }
    
    .sketch-to-final {
        height: 300px;
    }
}
