/* 1. IMPORT THE FONT "UNBOUNDED" */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@200;300;400;500;600;700;800;900&display=swap');

:root {
    --bg-color: #050805;
    --text-white: #ffffff;
    --accent-green: #2ecc71;
    --input-bg: #0a140d;
    --border-green: #1a3a2a;
    --glow-custom: rgba(56, 255, 126, 0.4); /* Brighter glow */
    --text-light-green: #C0E4CD; 
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Unbounded', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #020302;
    /* Updated Gradient: Black to Green (Matches Dashboard) */
    background: linear-gradient(180deg, #000000 0%, #001a00 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-white);
    
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
    position: relative;
}

/* Background Noise */
body::before {
    content: "";
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/lines.png');
    background-repeat: repeat; 
    background-size: 300px auto;     
    opacity: 0.25; 
    z-index: 0; 
    pointer-events: none; 
}

.screen-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 40px;
    text-align: center;
    color: #e0f2e9;
    letter-spacing: 0.5px;
}

.input-wrapper {
    width: 100%;
    margin-bottom: 10px;
}

.id-display {
    width: 100%;
    height: 80px; /* Increased height for bigger text */
    background-color: #080f0b; /* Darker background */
    border: 1px solid #1a3a2a;
    border-radius: 20px;
    
    /* BIGGER TEXT STYLES */
    color: #38FF7E; /* Neon Green */
    font-size: 42px; /* Much bigger numbers */
    font-weight: 700;
    letter-spacing: 2px;
    
    text-align: center;
    outline: none;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    user-select: text; 
}

.id-display::placeholder {
    color: #1f3a2d;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0;
}

.sub-link {
    color: #55665f;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 30px;
    margin-top: 10px;
    font-weight: 500;
}

/* --- GLOWING BUTTON ANIMATION --- */
@keyframes btn-pulse {
    0% { box-shadow: 0 0 15px rgba(46, 204, 113, 0.2); border-color: #2a7a45; }
    50% { box-shadow: 0 0 25px rgba(46, 204, 113, 0.5); border-color: #4aff92; }
    100% { box-shadow: 0 0 15px rgba(46, 204, 113, 0.2); border-color: #2a7a45; }
}

.login-btn {
    width: 100%;
    height: 65px;
    
    /* Green Gradient */
    background: linear-gradient(180deg, #1b5e35 0%, #052912 100%);
    
    border: 1px solid #2a7a45;
    border-radius: 18px;
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 40px;
    
    /* Apply Glow Animation */
    animation: btn-pulse 3s infinite ease-in-out;
    
    transition: transform 0.1s;
    font-family: 'Unbounded', sans-serif;
    text-transform: uppercase;
}

.login-btn:active {
    transform: scale(0.98);
    filter: brightness(1.2);
}

/* Keypad Styles */
.keypad-container {
    width: 100%;
    background-color: #080f0b; /* Darker bg */
    border: 1px solid #15251d;
    border-radius: 30px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    backdrop-filter: blur(10px);
}

.key-row {
    display: flex;
    justify-content: space-between;
}

.key {
    background: transparent;
    border: none;
    color: #e0f2e9;
    font-size: 28px;
    font-weight: 500;
    width: 33%;
    height: 60px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    font-family: 'Unbounded', sans-serif;
}

.key:active {
    background-color: rgba(46, 204, 113, 0.1);
    color: #38FF7E;
}

.key-placeholder {
    width: 33%;
}

.backspace svg {
    width: 28px;
    height: 28px;
    pointer-events: none;
    stroke: #e0f2e9;
}

.backspace:active svg {
    stroke: #38FF7E;
}

/* === ERROR MODAL STYLES === */

/* Import font if not already in main css */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@200;300;400;500;600;700;800;900&display=swap');

/* The full-screen overlay container */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999; /* Sit on top of everything */
    
    /* Background from your error.css body */
    background-color: #020302;
    background: linear-gradient(180deg, #000000 0%, #001a00 100%);
    
    /* Flex to center the card */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Transition for showing/hiding */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Class to make it visible */
.error-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Background pattern overlay */
.error-overlay::before {
    content: "";
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/lines.png'); /* Ensure this path is correct relative to index.html */
    background-repeat: repeat; 
    background-size: 350px auto;     
    opacity: 0.25; 
    z-index: -1; 
    pointer-events: none; 
}

.error-content-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

/* Close/Back Button Position */
.modal-close-btn {
    position: absolute;
    top: -40px; /* Adjust based on preference */
    left: 20px;
    background: none;
    border: none;
    color: #e0f2e9;
    cursor: pointer;
    z-index: 2;
}

/* 1. Make the Card container smaller/tighter */
.error-card {
    background-color: #050a07; 
    border: 1px solid #1a2e25; 
    border-radius: 30px; /* Slightly smaller radius */
    
    /* REDUCED PADDING: Was 40px 30px -> Now 25px 20px */
    padding: 25px 20px; 
    
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

/* 2. Your Image Style (Kept your size, adjusted margin) */
.error-icon-img {
    max-width: 280px; 
    height: auto;
    /* Reduced margin: Was 30px -> Now 15px */
    margin-bottom: 15px; 
    display: block;
}

/* 3. Tighten the Title */
.error-title {
    font-family: 'Unbounded', sans-serif;
    font-size: 26px; /* Slightly smaller font to match */
    font-weight: 600;
    color: #e0f2e9;
    margin-bottom: 5px; /* Very tight to the description */
    letter-spacing: 0.5px;
}

/* 4. Tighten the Description spacing */
.error-desc {
    font-family: 'Unbounded', sans-serif;
    font-size: 15px;
    color: #6e7f75;
    /* Reduced space before button: Was 40px -> Now 25px */
    margin-bottom: 25px; 
    font-weight: 300;
}

.action-btn {
    width: 100%;
    padding: 18px;
    background: #050a07;
    border: 1px solid #2ecc71;
    border-radius: 16px;
    color: #e0f2e9;
    font-family: 'Unbounded', sans-serif;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.15), inset 0 0 10px rgba(46, 204, 113, 0.05);
    transition: all 0.2s;
}

.action-btn:active {
    transform: scale(0.98);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.3);
    background: #0b1f13;
}

/* Back Arrow Button Styles */
.back-arrow-btn {
    position: absolute;
    top: 25px; /* Adjust distance from top */
    left: 20px; /* Adjust distance from left */
    
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px; /* Increases touch area for easier clicking */
    z-index: 100; /* Ensure it sits on top of everything */
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    transition: transform 0.2s ease, opacity 0.2s;
    opacity: 0.8;
}

.back-arrow-btn:active {
    transform: scale(0.9) translateX(-2px); /* Slight nudge left when pressed */
    opacity: 1;
}

.back-arrow-btn svg {
    width: 32px; /* Large size as per your image */
    height: 32px;
    display: block;
}

/* Ensure the arrow color matches your theme */
.back-arrow-btn svg path {
    stroke: #e0f2e9; /* Light Mint Green */
}

/* --- ERROR MODAL ANIMATION --- */

/* 1. Define the bounce animation */
@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px); /* Starts smaller and lower */
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0); /* Ends full size and centered */
    }
}

/* 2. Apply animation ONLY when the overlay has the 'active' class */
.error-overlay.active .error-card {
    /* The cubic-bezier creates the "bouncy" effect */
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}