/**
 * Code to UI Section - Live Transform Animation
 * "Koddan Ürüne, Fikirden Gerçeğe"
 */

/* Section Base */
.code-to-ui-section {
    position: relative;
    background: linear-gradient(135deg, #000000 0%, #0a0a0a 100%);
    overflow: hidden;
    isolation: isolate;
    z-index: 1;
}

.code-to-ui-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255, 67, 8, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.code-to-ui-section > .container {
    position: relative;
    z-index: 2;
}

/* ========== CODE EDITOR ========== */
.code-editor-wrapper {
    position: relative;
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Editor Header */
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #2d2d30;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.editor-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #FF4308; }

.editor-title {
    flex: 1;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', monospace;
}

.editor-lang {
    background: rgba(255, 67, 8, 0.1);
    color: #FB8500;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Code Content */
.code-content {
    display: flex;
    padding: 20px 0;
    background: #1e1e1e;
    min-height: 280px;
}

.line-numbers {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    line-height: 24px;
    user-select: none;
    text-align: right;
    min-width: 50px;
}

.code-text {
    flex: 1;
    padding-right: 20px;
}

.code-text pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    line-height: 24px;
    color: #d4d4d4;
}

.code-text code {
    display: block;
}

/* Syntax Highlighting */
.token.keyword { color: #569cd6; }
.token.function { color: #dcdcaa; }
.token.string { color: #ce9178; }
.token.tag { color: #569cd6; }
.token.attr-name { color: #9cdcfe; }
.token.attr-value { color: #ce9178; }
.token.punctuation { color: #d4d4d4; }
.token.operator { color: #d4d4d4; }
.token.comment { color: #6a9955; font-style: italic; }

/* Terminal Output */
.terminal-output {
    background: #0c0c0c;
    padding: 16px 20px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.terminal-line:last-child {
    margin-bottom: 0;
}

.terminal-prompt {
    color: #4ec9b0;
    font-weight: bold;
}

.terminal-command {
    color: rgba(255, 255, 255, 0.9);
}

.terminal-success {
    color: #4ec9b0;
    animation: fadeInTerminal 1s ease 3s both;
}

.terminal-icon {
    color: #FF4308;
    font-weight: bold;
}

@keyframes fadeInTerminal {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Particle Canvas */
.particle-canvas {
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    width: 200px;
    height: 400px;
    pointer-events: none;
    z-index: 5;
}

/* ========== UI PREVIEW ========== */
.ui-preview-wrapper {
    position: relative;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 40px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 67, 8, 0.1);
    overflow: hidden;
}

.preview-header {
    margin-bottom: 30px;
}

.preview-badge {
    display: inline-block;
    background: rgba(254, 254, 31, 0.1);
    color: #FEFE1F;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid rgba(254, 254, 31, 0.2);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(254, 254, 31, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(254, 254, 31, 0);
    }
}

.ui-output {
    position: relative;
    z-index: 2;
    min-height: 400px;
}

/* Compilation States */
.brand-message {
    opacity: 1;
}

/* Compiling Loader */
.compilation-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.compilation-loader.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 67, 8, 0.1);
    border-top-color: #FF4308;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loader-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', monospace;
    animation: loaderPulse 1.5s ease-in-out infinite;
}

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

.loader-dots {
    display: inline-block;
    width: 20px;
}

.loader-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.message-icon {
    margin-bottom: 24px;
    opacity: 0;
    transform: scale(0) rotate(-180deg);
}

.message-icon.building {
    animation: iconBuild 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes iconBuild {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
        filter: blur(10px) drop-shadow(0 0 40px rgba(255, 67, 8, 0.8));
    }
    60% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0) drop-shadow(0 0 20px rgba(255, 67, 8, 0.3));
    }
}

.message-icon.built svg {
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.brand-slogan {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    color: #ffffff;
}

.slogan-line {
    display: block;
    opacity: 0;
    transform: translateX(-30px);
    filter: blur(5px);
}

.slogan-line.building {
    animation: textReveal 0.6s ease-out forwards;
}

@keyframes textReveal {
    0% {
        opacity: 0;
        transform: translateX(-30px);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

.gradient-text {
    background: linear-gradient(90deg, #FF4308, #FB8500, #FEFE1F, #FB8500, #FF4308);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text.building {
    animation: gradientShimmer 1.2s ease-in-out forwards, textReveal 0.6s ease-out forwards;
}

@keyframes gradientShimmer {
    0% {
        background-position: 0% center;
        filter: brightness(1);
    }
    50% {
        background-position: 100% center;
        filter: brightness(1.5) drop-shadow(0 0 20px rgba(254, 254, 31, 0.6));
    }
    100% {
        background-position: 200% center;
        filter: brightness(1);
    }
}

.brand-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 32px;
    opacity: 0;
}

.brand-description.building {
    animation: fadeInBlur 0.8s ease-out forwards;
}

@keyframes fadeInBlur {
    0% {
        opacity: 0;
        filter: blur(8px);
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

/* Tech Stack */
.tech-stack {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.tech-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
}

.tech-item.building {
    animation: techItemPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes techItemPop {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    60% {
        transform: translateY(-5px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tech-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-gradient);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
}

.tech-item.building .tech-dot {
    animation: dotExpand 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.tech-item.built .tech-dot {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes dotExpand {
    0% {
        opacity: 0;
        transform: scale(0);
        box-shadow: 0 0 0 0 rgba(255, 67, 8, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 67, 8, 0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 67, 8, 0);
    }
}

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

/* Glow Effect */
.glow-effect {
    position: absolute;
    top: 50%;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 67, 8, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    animation: glowPulse 4s ease-in-out infinite;
    z-index: 1;
    will-change: transform, opacity;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Fade In Up Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 991px) {
    .particle-canvas {
        display: none;
    }

    /* Mobile Split Screen Layout */
    .code-to-ui-section .row {
        display: flex;
        flex-direction: column;
        height: 100vh;
        max-height: 800px;
        margin: 0;
    }

    .code-to-ui-section .col-lg-6 {
        padding: 0;
    }

    .code-to-ui-section .col-lg-6:first-child {
        flex: 0 0 40%;
        min-height: 40%;
        max-height: 40%;
        overflow: hidden;
        position: relative;
    }

    .code-to-ui-section .col-lg-6:first-child::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #FF4308, #FB8500, #FEFE1F);
        box-shadow: 0 0 10px rgba(255, 67, 8, 0.5);
        z-index: 100;
    }

    .code-to-ui-section .col-lg-6:last-child {
        flex: 0 0 60%;
        min-height: 60%;
        max-height: 60%;
        overflow-y: auto;
        position: relative;
    }

    /* Scroll indicator */
    .code-to-ui-section .col-lg-6:last-child::before {
        content: '↓';
        position: absolute;
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        background: rgba(255, 67, 8, 0.2);
        border: 2px solid #FF4308;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #FF4308;
        font-size: 18px;
        font-weight: bold;
        z-index: 50;
        animation: scrollBounce 2s ease-in-out infinite;
    }

    @keyframes scrollBounce {
        0%, 100% {
            transform: translateY(0);
        }
        50% {
            transform: translateY(5px);
        }
    }

    .code-editor-wrapper {
        margin-bottom: 0;
        border-radius: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .code-content {
        min-height: auto;
        flex: 1;
        overflow: hidden;
        padding: 15px 0;
    }

    .line-numbers {
        padding: 0 10px;
        font-size: 12px;
        line-height: 20px;
    }

    .code-text pre {
        font-size: 12px;
        line-height: 20px;
    }

    .terminal-output {
        padding: 12px 15px;
        font-size: 11px;
    }

    .ui-preview-wrapper {
        padding: 25px 20px;
        border-radius: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .ui-output {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: auto;
    }

    .brand-slogan {
        font-size: 28px;
    }

    .brand-description {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .message-icon svg {
        width: 45px;
        height: 45px;
    }

    .preview-badge {
        font-size: 10px;
        padding: 5px 12px;
    }
}

@media (max-width: 767px) {
    /* Mobile Split Screen - Smaller */
    .code-to-ui-section .row {
        max-height: 700px;
    }

    .code-content {
        min-height: auto;
        padding: 10px 0;
    }

    .line-numbers {
        padding: 0 8px;
        font-size: 11px;
        line-height: 18px;
    }

    .code-text pre {
        font-size: 11px;
        line-height: 18px;
    }

    .editor-header {
        padding: 10px 12px;
    }

    .editor-title {
        font-size: 12px;
    }

    .editor-lang {
        font-size: 10px;
        padding: 3px 10px;
    }

    .terminal-output {
        padding: 10px 12px;
        font-size: 10px;
    }

    .brand-slogan {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .brand-description {
        font-size: 13px;
        margin-bottom: 15px;
        line-height: 1.6;
    }

    .tech-stack {
        gap: 12px;
    }

    .tech-item {
        font-size: 12px;
    }

    .message-icon {
        margin-bottom: 15px;
    }

    .message-icon svg {
        width: 40px;
        height: 40px;
    }

    .ui-preview-wrapper {
        padding: 20px 15px;
    }

    .compilation-loader {
        min-height: 200px;
    }

    .loader-spinner {
        width: 50px;
        height: 50px;
    }

    .loader-text {
        font-size: 12px;
    }
}
