/* ========================================
   HACKER TERMINAL UI - CSS Component
   For Event Followers AI Chat Room
   Code Wall with Mini Terminals
   ======================================== */

/* Import Fira Code for authentic terminal look */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap');

/* Terminal Container - The Code Wall */
.terminal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    font-family: 'Fira Code', 'Courier New', monospace;
    overflow: hidden;
    perspective: 1000px;
}

/* Scanline Effect */
.terminal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 100;
}

/* CRT Glow Effect */
.terminal-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
    z-index: 99;
}

/* The Code Wall Background - 3D Coming Forward Effect */
.code-wall {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    z-index: 1;
    transform-style: preserve-3d;
    animation: float-forward 8s ease-in-out infinite;
}

@keyframes float-forward {
    0%, 100% {
        transform: translateZ(0px) rotateX(2deg);
    }
    50% {
        transform: translateZ(30px) rotateX(0deg);
    }
}

/* Floating Code Background Animation */
.code-rain {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.15;
    z-index: 0;
    font-size: 12px;
    color: #00ff00;
    line-height: 1.2;
    pointer-events: none;
}

/* Mini Terminal Button - 3D Card Effect */
.mini-terminal {
    background: rgba(0, 20, 0, 0.8);
    border: 1px solid #00ff00;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transform-style: preserve-3d;
    transform: translateZ(0);
}

/* Each terminal floats at different depths */
.mini-terminal:nth-child(1) { animation: terminal-float-1 6s ease-in-out infinite; }
.mini-terminal:nth-child(2) { animation: terminal-float-2 7s ease-in-out infinite 0.5s; }
.mini-terminal:nth-child(3) { animation: terminal-float-3 5s ease-in-out infinite 1s; }
.mini-terminal:nth-child(4) { animation: terminal-float-4 8s ease-in-out infinite 1.5s; }

@keyframes terminal-float-1 {
    0%, 100% { transform: translateZ(10px) rotateY(-2deg); }
    50% { transform: translateZ(40px) rotateY(2deg); }
}

@keyframes terminal-float-2 {
    0%, 100% { transform: translateZ(20px) rotateY(2deg); }
    50% { transform: translateZ(50px) rotateY(-2deg); }
}

@keyframes terminal-float-3 {
    0%, 100% { transform: translateZ(5px) rotateX(-2deg); }
    50% { transform: translateZ(35px) rotateX(2deg); }
}

@keyframes terminal-float-4 {
    0%, 100% { transform: translateZ(15px) rotateX(2deg); }
    50% { transform: translateZ(45px) rotateX(-2deg); }
}

.mini-terminal:hover {
    border-color: #00ffff;
    box-shadow:
        0 0 30px rgba(0, 255, 0, 0.5),
        0 0 60px rgba(0, 255, 255, 0.3),
        inset 0 0 30px rgba(0, 255, 0, 0.1);
    transform: translateZ(80px) scale(1.05) !important;
    animation: none !important;
    z-index: 10;
}

.mini-terminal:hover .terminal-header {
    background: rgba(0, 255, 0, 0.2);
}

/* Terminal Header Bar */
.terminal-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 255, 0, 0.1);
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    gap: 8px;
}

.terminal-dots {
    display: flex;
    gap: 5px;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27ca40; }

.terminal-title {
    flex: 1;
    font-size: 0.7rem;
    color: #888;
    text-align: center;
}

.terminal-file {
    font-size: 0.65rem;
    color: #00ff00;
    opacity: 0.7;
}

/* Terminal Content - Preview Code */
.terminal-content {
    flex: 1;
    padding: 12px;
    overflow: hidden;
    position: relative;
}

.terminal-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, rgba(0, 20, 0, 0.95));
    pointer-events: none;
}

/* Code Lines in Preview */
.code-line {
    font-size: 0.65rem;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

/* Syntax Highlighting Colors */
.code-keyword { color: #ff79c6; }      /* Pink - keywords */
.code-function { color: #50fa7b; }     /* Green - functions */
.code-string { color: #f1fa8c; }       /* Yellow - strings */
.code-comment { color: #6272a4; }      /* Gray - comments */
.code-variable { color: #8be9fd; }     /* Cyan - variables */
.code-number { color: #bd93f9; }       /* Purple - numbers */
.code-operator { color: #ff5555; }     /* Red - operators */
.code-class { color: #ffb86c; }        /* Orange - classes */
.code-property { color: #00ff00; }     /* Bright green - properties */

/* Click Hint */
.terminal-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.6rem;
    color: #00ff00;
    opacity: 0;
    transition: opacity 0.3s;
}

.mini-terminal:hover .terminal-hint {
    opacity: 0.8;
}

/* Blinking Cursor */
.cursor-blink {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #00ff00;
    animation: blink 1s infinite;
    vertical-align: middle;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ========================================
   EXPANDED TERMINAL - Full Article View
   ======================================== */

.expanded-terminal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 0, 0.98);
    z-index: 50;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.expanded-terminal.visible {
    display: flex;
    opacity: 1;
}

/* Expanded Terminal Header */
.expanded-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0, 255, 0, 0.1);
    border-bottom: 1px solid #00ff00;
}

.expanded-header .terminal-dots {
    margin-right: 15px;
}

.expanded-header .terminal-title {
    font-size: 0.9rem;
    color: #00ff00;
    text-align: left;
    flex: 1;
}

.close-terminal {
    background: none;
    border: 1px solid #ff5555;
    color: #ff5555;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    transition: all 0.3s;
}

.close-terminal:hover {
    background: rgba(255, 85, 85, 0.2);
    box-shadow: 0 0 10px rgba(255, 85, 85, 0.3);
}

/* Expanded Content Area */
.expanded-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    line-height: 1.8;
}

/* Scrollbar Styling */
.expanded-content::-webkit-scrollbar {
    width: 8px;
}

.expanded-content::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.expanded-content::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

.expanded-content::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

/* Article in Terminal Style */
.terminal-article {
    max-width: 800px;
    margin: 0 auto;
}

.terminal-article h1 {
    font-size: 1.8rem;
    color: #00ffff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.terminal-article .article-meta {
    font-size: 0.85rem;
    color: #6272a4;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #333;
}

.terminal-article .article-body {
    font-size: 1rem;
    color: #e0e0e0;
}

.terminal-article .article-body p {
    margin-bottom: 18px;
}

.terminal-article .article-body strong {
    color: #50fa7b;
}

.terminal-article .article-body em {
    color: #f1fa8c;
}

/* Code Block in Article */
.terminal-article .code-block {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
    overflow-x: auto;
}

/* Terminal Prompt Before Paragraphs */
.terminal-article .article-body p::before {
    content: '> ';
    color: #00ff00;
    opacity: 0.5;
}

/* Source/Quote Styling */
.terminal-article .source {
    background: rgba(98, 114, 164, 0.2);
    border-left: 3px solid #bd93f9;
    padding: 15px 20px;
    margin: 20px 0;
    font-style: italic;
}

.terminal-article .source::before {
    content: '// ';
    color: #6272a4;
}

/* ========================================
   LOADING STATE
   ======================================== */

.terminal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #00ff00;
}

.loading-text {
    font-size: 1rem;
    margin-bottom: 20px;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: #1a1a1a;
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    display: block;
    width: 50%;
    height: 100%;
    background: #00ff00;
    animation: loading 1s infinite ease-in-out;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 600px) {
    .code-wall {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .mini-terminal {
        min-height: 120px;
    }

    .code-line {
        font-size: 0.55rem;
    }

    .terminal-article h1 {
        font-size: 1.3rem;
    }

    .expanded-content {
        padding: 15px;
    }
}

/* ========================================
   GLITCH EFFECT ON HOVER
   ======================================== */

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

.mini-terminal:hover .terminal-content {
    animation: glitch 0.3s ease;
}

/* Matrix-style number rain background */
.matrix-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
}

.matrix-column {
    position: absolute;
    top: -100%;
    font-size: 14px;
    color: #00ff00;
    opacity: 0.3;
    animation: matrix-fall linear infinite;
    white-space: nowrap;
}

@keyframes matrix-fall {
    0% { top: -100%; }
    100% { top: 100%; }
}
