/* ==========================================================================
   RUBENZ.COM - CYBERSECURITY NEXUS STYLESHEET
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CENTER TERMINAL VERTICALLY & HORIZONTALLY */
body {
    background: #000;
    overflow: hidden;
    font-family: 'Share Tech Mono', monospace;
    color: #0f0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#matrix {
    display: block;
}

/* SPINNING R BACKGROUND ELEMENT - VISIBLE THROUGH TERMINAL */
.spinning-r {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    font-size: 18rem;
    font-weight: bold;
    color: rgba(0, 255, 0, 0.04);
    pointer-events: none;
    z-index: 2;
    font-family: 'Share Tech Mono', monospace;
    text-shadow: 
        0 0 8px rgba(0, 255, 0, 0.15),
        0 0 15px rgba(0, 255, 0, 0.08),
        0 0 25px rgba(0, 255, 0, 0.03);
    animation: spin 18s linear infinite;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.spinning-r::after {
    content: "R";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(180deg);
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    text-shadow: inherit;
    animation: spinReverse 22s linear infinite;
}

@keyframes spinReverse {
    from { transform: translate(-50%, -50%) rotate(180deg); }
    to { transform: translate(-50%, -50%) rotate(540deg); }
}

/* TERMINAL - FIXED SIZE WITH INTERNAL AUTO-SCROLLING */
.terminal-wrapper {
    position: relative;
    z-index: 3;
    width: 90%;
    max-width: 1200px;
    height: 70vh;
    display: flex;
    flex-direction: column;
    background: rgba(0, 12, 0, 0.12);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 4px;
    box-shadow: 
        0 0 15px rgba(0, 255, 0, 0.2),
        inset 0 0 10px rgba(0, 255, 0, 0.1);
    overflow: hidden; /* Hide overflow from children */
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 18, 0, 0.18);
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red { 
    background: #f00; 
    box-shadow: 0 0 6px #f00;
}
.dot.yellow { 
    background: #ff0; 
    box-shadow: 0 0 6px #ff0;
}
.dot.green { 
    background: #0f0; 
    box-shadow: 0 0 6px #0f0;
}

.terminal-title {
    font-size: 1rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.3);
}

/* TERMINAL BODY - Acts as a static wrapper container */
.terminal-body {
    flex: 1;
    padding: 10px;
    background: transparent;
    overflow: hidden; /* Prevents layout fracturing or double scrollbars */
}

/* TERMINAL OUTPUT - Correctly targets JavaScript insertion context for scrolling */
#terminalOutput {
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Handles text clipping and allows data scroll behavior */
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    font-size: 0.9rem;
    text-shadow: 
        0 0 1px rgba(0, 255, 0, 0.4),
        0 0 2px rgba(0, 255, 0, 0.2);
        
    /* HIDE SCROLLBAR BUT KEEP SCROLLING INTERACTION ACTIVE */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#terminalOutput::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.terminal-line {
    margin: 3.5px 0;
    padding-left: 6px;
    border-left: 1.5px solid rgba(0, 255, 0, 0.2);
    position: relative;
    white-space: pre-wrap; /* Formats output code wraps elegantly */
    word-break: break-all;
}

.terminal-line::before {
    content: "";
    position: absolute;
    left: -1.5px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 3px;
    background: #0f0;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 255, 0, 0.5);
}

.terminal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(0, 18, 0, 0.18);
    border-top: 1px solid rgba(0, 255, 0, 0.2);
    font-size: 0.8rem;
}

.terminal-menu a {
    color: #0f0;
    text-decoration: none;
    margin: 0 3px;
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.2);
}

.terminal-menu a:hover {
    text-decoration: underline;
    color: #0ff;
    text-shadow: 0 0 3px rgba(0, 255, 255, 0.4);
}

.terminal-status {
    display: flex;
    gap: 10px;
    align-items: center;
}

#system-time, #system-temp {
    font-family: 'Share Tech Mono', monospace;
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.3);
    letter-spacing: 0.5px;
}

/* POPUP ALERT STYLES */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ff0;
    border-radius: 6px;
    padding: 24px;
    max-width: 90%;
    width: 400px;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.5);
    animation: popupShow 0.3s ease-out forwards;
}

.popup-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.popup-title {
    color: #ff0;
    font-size: 1.4rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-message {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 16px;
    line-height: 1.4;
}

.popup-details {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #0f0;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    color: #0f0;
    width: 100%;
    max-height: 140px;
    overflow-y: auto;
    text-align: left;
}

.popup-close {
    background: #ff0;
    color: #000;
    border: none;
    margin-top: 16px; /* Corrects proximity layout conflict with elements above */
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-weight: bold;
    transition: all 0.2s;
}

.popup-close:hover {
    background: #fff;
    transform: scale(1.05);
}

@keyframes popupShow {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.pulse {
    animation: pulse 1.5s infinite;
}

/* FLASH EFFECT - Aggressive Security Breach Design */
.flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.35); /* Swapped plain black overlay out for a stark red tint */
    z-index: 999;
    pointer-events: none;
    animation: flash 0.2s ease-out forwards;
}

@keyframes flash {
    to { background: rgba(255, 0, 0, 0); }
}

/* RESPONSIVE ADJUSTMENTS */
@media (max-width: 768px) {
    .terminal-wrapper {
        width: 95%;
        height: 65vh;
    }
    
    .terminal-title {
        font-size: 0.9rem;
    }
    
    .terminal-body {
        padding: 8px;
    }
    
    .popup {
        width: 90%;
        padding: 16px;
    }
    
    .popup-title {
        font-size: 1.2rem;
    }
    
    .popup-message {
        font-size: 1rem;
    }
    
    .spinning-r {
        font-size: 14rem;
    }
}