/* Code animation page styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #ffffff;
    color: #333333;
    font-family: 'Consolas', 'Monaco', 'Lucida Console', monospace;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    position: relative;
}

.container {
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.animation_container {
    width: 100%;
    height: 400px;
    /* display: flex; */
    /* flex-direction: column; */
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Allow content to expand naturally */
.code-display {
    background: #ffffff;
    padding: 15px;
    /* height: 400px; */
    /* overflow-y: visible; */
    /* overflow-x: auto; */
    white-space: pre;
    position: relative;
    font-size: 12px;
    line-height: 1.4;
    min-width: max-content;
    box-sizing: border-box;
    scrollbar-width: auto;
    scrollbar-color: #999 #ffffff;
}

/* Reset bulma .number styles for code display area */
.code-display .number,
.fullscreen-code-display .number {
    display: inline !important;
    background-color: transparent !important;
    border-radius: 0 !important;
    font-size: inherit !important;
    height: auto !important;
    margin-right: 0 !important;
    min-width: auto !important;
    padding: 0 !important;
    text-align: inherit !important;
    vertical-align: baseline !important;
    align-items: normal !important;
    justify-content: normal !important;
}

/* Fix first element positioning
.code-display .code-word:first-child {
    vertical-align: top;
    position: relative;
} */

/* Wrap toggle button and fullscreen toggle button - positioned relative to container */
.wrap-toggle-btn,
.fullscreen-toggle-btn {
    position: absolute;
    width: 32px;
    height: 32px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s ease;
    z-index: 1000;
    opacity: 0.9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wrap-toggle-btn {
    top: 10px;
    right: 10px;
}

.fullscreen-toggle-btn {
    top: 10px;
    right: 52px;
}

.wrap-toggle-btn:hover,
.fullscreen-toggle-btn:hover {
    background: #e8e8e8;
    border-color: #999;
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.wrap-toggle-btn:active,
.fullscreen-toggle-btn:active {
    transform: scale(0.95);
}

.wrap-toggle-btn.active,
.fullscreen-toggle-btn.active {
    background: #569cd6;
    color: white;
    border-color: #569cd6;
}

/* Text wrapping mode styles */
.code-display.wrap-mode {
    white-space: pre-wrap;
    word-break: break-all;
    min-width: auto;
    overflow-x: hidden;
}

/* Hide line numbers in wrap mode */
.code-display.wrap-mode .code-line-number {
    display: none;
}

.code-line {
    display: block;
    margin-bottom: 0;
    white-space: pre;
    min-width: max-content;
}

/* Code line styles in wrap mode */
.code-display.wrap-mode .code-line {
    white-space: pre-wrap;
    min-width: auto;
}

.code-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #333333;
    animation: blink 1s infinite;
    margin-left: 1px;
    vertical-align: top;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.code-line-number {
    color: #999999;
    margin-right: 10px;
    user-select: none;
    display: inline-block;
    width: 25px;
    text-align: right;
    flex-shrink: 0;
}

.code-word {
    opacity: 0;
    animation: wordPop 0.15s ease forwards;
    display: inline;
    white-space: pre;
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* Word styles in wrap mode */
.code-display.wrap-mode .code-word {
    white-space: pre-wrap;
}

@keyframes wordPop {
    0% {
        opacity: 0;
        transform: scale(0.95) translateZ(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
}

/* Python Syntax Highlighting */
.keyword { 
    color: #0066cc; 
    font-weight: bold; 
}

.string { 
    color: #cc7700; 
}

/* Use more specific selectors for code numbers to avoid bulma conflicts */
.code-display .number,
.fullscreen-code-display .number { 
    color: #009900 !important; 
}

.comment { 
    color: #008000; 
    font-style: italic; 
}

.function { 
    color: #9900cc; 
}

.variable { 
    color: #0088cc; 
}

.operator { 
    color: #333333; 
}

.auto-start {
    animation-delay: 0.5s;
}

/* Custom scrollbar styles - enhanced visibility */
.code-display::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.code-display::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.code-display::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 6px;
    border: 1px solid #999;
}

.code-display::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.code-display::-webkit-scrollbar-corner {
    background: #ffffff;
}

/* Ensure content is not truncated during horizontal scrolling */
.code-display * {
    box-sizing: border-box;
}

/* Fullscreen Modal */
.fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fullscreen-modal.active {
    display: flex;
    opacity: 1;
}

.fullscreen-modal-content {
    position: relative;
    width: 95vw;
    height: 95vh;
    margin: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.fullscreen-code-display {
    width: 100%;
    height: 100%;
    padding: 24px;
    overflow: auto;
    background: #fff;
    font-family: 'Consolas', 'Monaco', 'Lucida Console', monospace;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
}

.fullscreen-code-display .code-word {
    opacity: 1;
    animation: none;
}

.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s ease;
    z-index: 10000;
}

.close-modal-btn:hover {
    background: #e8e8e8;
    color: #333;
    transform: scale(1.05);
}

/* Optimize animation performance */
.code-display, .fullscreen-code-display {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
} 

