/* Styles for terminal effects and forms */

/* Terminal container */
.terminal-frame {
    width: 400px; /* Fast bredde på desktop */
    height: 160px; /* Increased height for desktop */
    padding: 12px;
    border: 2px solid #00FF00;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.terminal-container {
    width: 100%;
    height: 110px; /* Increased height for desktop */
    overflow: hidden;
    margin-bottom: 8px; /* Reduced from 12px */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    box-sizing: border-box;
}

.terminal-line {
    font-size: 0.95rem; /* Slightly smaller font */
    text-align: left;
    align-self: flex-start;
    margin: 0; /* No vertical margin */
    padding: 0;
    line-height: 1.3; /* Tighter line height */
    white-space: nowrap;
}

/* Shared terminal content styles for both login and contact */
.terminal-login, .terminal-contact {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%; /* Ensure full height usage */
}

/* Shake animation for login and contact errors */
.terminal-login.shake, .terminal-contact.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Shared styles for both login and contact forms */
.login-form-terminal, .contact-form-terminal {
    width: 95%;
    margin: auto; /* Center in all directions */
    position: relative;
}

/* Shared input styles for both login and contact forms */
.login-form-terminal input, .contact-form-terminal input,
.contact-form-terminal textarea {
    width: 100%;
    margin: 5px 0;
    padding: 8px;
    background-color: #000000; /* Solid black background */
    color: #00FF00; /* Terminal green text */
    border: 1px solid #00FF00;
    font-family: 'VT323', monospace;
    font-size: 1rem;
    box-sizing: border-box;
    caret-color: #00FF00; /* Green cursor */
}

/* Shared placeholder styles */
.login-form-terminal input::placeholder,
.contact-form-terminal input::placeholder,
.contact-form-terminal textarea::placeholder {
    color: #00AA00;
}

/* Error message with fixed height - shared styles for login and contact */
.contact-error {
    color: #FF5555;
    text-align: center;
    margin-top: 25px; /* Even more margin to move it further down */
    height: 20px; /* Fixed height */
    visibility: hidden; /* Hide but preserve space */
    font-size: 0.9rem;
    position: absolute; /* Position it absolutely */
    bottom: -35px; /* Move it to the bottom of the form */
    left: 0;
    right: 0;
}

/* Specific styling for login error message - moved below password field with minimal margin */
.login-error {
    color: #FF5555;
    text-align: center;
    height: 20px; /* Fixed height */
    visibility: hidden; /* Hide but preserve space */
    font-size: 0.9rem;
    position: absolute; /* Position it absolutely */
    bottom: -20px; /* Minimal margin below the form */
    left: 0;
    right: 0;
}

.login-error.visible, .contact-error.visible {
    visibility: visible; /* Show when needed */
}

/* Special styles for textarea */
.contact-form-terminal textarea {
    resize: none;
    height: 45px !important; /* Forced height with !important to prevent cropping */
    min-height: 45px !important; /* Force min-height with !important */
    max-height: 45px !important; /* Add max-height to enforce limit */
    box-sizing: border-box !important; /* Ensure padding is included in height */
    overflow: auto !important; /* Add scrollbar if needed */
}

/* Special state for sending indication */
.contact-error.sending {
    color: #00FF00;
}

/* Success message in terminal */
.success-message-terminal {
    color: #00FF00;
    text-align: center;
    margin: 20px 0;
    padding: 10px;
    border: 1px solid #00FF00;
    background-color: rgba(0, 255, 0, 0.1);
    width: 90%;
    margin: 20px auto;
}

.success-message-terminal p {
    margin: 5px 0;
}

/* Loading bar styles */
#loading-bar, #send-loading-bar {
    width: 100%;
    height: 12px; /* Slightly reduced height */
    border: 1px solid #00FF00;
    position: relative;
    overflow: hidden;
    margin: 4px 0; /* Significantly reduced from 10px */
}

#progress, #send-progress {
    width: 0%; /* Explicitly start at 0% width */
    height: 100%;
    background-color: #7AFF7A;
    /* No default transition - we'll set it in JavaScript */
}

/* Ensure the send progress bar is clearly visible */
#send-loading-bar {
    max-width: 300px; /* Limit width for better visibility */
    box-shadow: 0 0 5px #00FF00; /* Add glow effect */
}

#send-progress {
    background-color: #00FF00; /* Brighter green for better visibility */
}

/* Enter button styles */
#enter-button {
    display: none;
    margin-top: 8px; /* Reduced from 15px */
    animation: pulseButton 2s infinite; /* Beholder pulsering for denne knappen */
    position: relative;
    z-index: 10; /* Høyere z-index for å sikre at knappen er klikkbar */
    cursor: pointer;
    height: 40px; /* Slightly reduced height from 45px */
    visibility: hidden; /* Starter som skjult men tar opp plass */
    /* Standard button styling - used as reference for other buttons */
    background-color: black;
    color: #00FF00;
    border: 2px solid #00FF00;
    padding: 0 20px; /* Removed vertical padding to rely on height */
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    border-radius: 2px;
    line-height: 36px; /* Vertical centering - matches height minus border */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

#enter-button.ready {
    visibility: visible; /* Vises når den er klar */
}

#enter-button:hover {
    animation: none;
    background-color: #00FF00;
    color: black;
    box-shadow: 0 0 10px #00FF00;
}

/* Footer styles */
.footer {
    margin-top: 20px;
    text-align: center;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    color: #00FF00;
    line-height: 1.5;
    display: none; /* Hidden initially, shown together with Enter button */
}

.footer a {
    color: #00FF00;
    text-decoration: none;
    border-bottom: 1px dotted #00FF00;
    transition: all 0.3s;
}

.footer a:hover {
    color: #7AFF7A;
    border-bottom: 1px solid #7AFF7A;
    text-shadow: 0 0 5px #00FF00;
}

/* Pulse button animation */
@keyframes pulseButton {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 255, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0); }
}

/* Shake animation for errors */
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Responsive justeringer for mobil */
@media (max-width: 480px) {
    .terminal-frame {
        width: 90%;
        height: 150px; /* Keep original height on mobile */
        padding: 8px;
    }

    .terminal-container {
        height: 100px; /* Keep original height on mobile */
    }
    
    .terminal-container .terminal-line {
        font-size: 0.9rem;
        margin: 1px 0;
    }
    
    /* Terminal login form adjustments for mobile */
    .login-form-terminal input, 
    .contact-form-terminal input,
    .contact-form-terminal textarea {
        font-size: 0.9rem;
        padding: 6px;
    }
}