/* Body and background */
body {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 50%, #000000 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: white;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Navbar */
.navbar {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    position: relative;
    transition: all 0.3s ease;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    z-index: -1;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    margin: 0 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover {
    color: white !important;
}

.nav-link:hover::before {
    width: 100%;
}

/* Navbar buttons */
.btn-primary {
    background-color: transparent;
    border: 2px solid white;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, #333333 0%, #555555 50%, #333333 100%);
    color: white;
    border-color: white;
}

.btn-outline-primary {
    border: 2px solid white;
    color: white;
    background: transparent;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: white;
    color: black;
    transform: translateY(-2px);
    border-color: white;
}

/* Mobile hamburger */
.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: transparent;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 1.5em;
    height: 1.5em;
}

/* Mobile menu background */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        border-radius: 0.5rem;
        margin-top: 1rem;
        padding: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Main content */
.main-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-top: 100px; /* account for fixed navbar */
}

/* Card */
.card-blur {
    backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.2rem;
    padding: 2rem 1.8rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    max-width: 380px; /* desktop max width */
    width: 100%;
    transition: all 0.3s ease;
}

.card-blur:hover {
    transform: translateY(-3px);
    box-shadow: 0 25px 50px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #ffffff 0%, #cccccc 50%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Checkpoint number */
.checkpoint-number {
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    text-align: center;
}

/* Description text */
.description-text {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* Buttons inside card */
.btn-gradient {
    background: linear-gradient(135deg, #333333 0%, #555555 50%, #333333 100%);
    border: 2px solid white;
    color: white;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    border-radius: 0.6rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, #444444 0%, #666666 50%, #444444 100%);
    color: white;
    text-decoration: none;
}

.btn-gradient:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* reCAPTCHA container */
.recaptcha-container {
    display: flex;
    justify-content: center;
    margin: 1.2rem 0;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer links */
.footer-links {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* KEY DISPLAY STYLES - Improved styling for key creation */
.key-display-container {
    text-align: center;
    padding: 1rem 0;
}

.key-title {
    background: linear-gradient(135deg, #ffffff 0%, #cccccc 50%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.key-display {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.8rem;
    padding: 1.2rem;
    margin: 1.5rem 0;
    position: relative;
    overflow: hidden;
}

.key-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    z-index: -1;
}

.key-code {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    padding: 0.8rem 1rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', 'Liberation Mono', 'Menlo', monospace;
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 2px;
    word-break: break-all;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.key-instructions {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.copy-button {
    background: linear-gradient(135deg, #333333 0%, #555555 50%, #333333 100%);
    border: 2px solid white;
    margin-bottom: 0.75rem;
}

.copy-button:hover {
    background: linear-gradient(135deg, #444444 0%, #666666 50%, #444444 100%);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.2);
}

.copy-button.copied {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 50%, #4CAF50 100%);
    border-color: #4CAF50;
}

.home-button {
    background: transparent;
    border: 2px solid white;
    margin-bottom: 0;
}

.home-button:hover {
    background: white;
    color: black;
    border-color: white;
    transform: translateY(-2px);
}

/* Success animation */
@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success-animation {
    animation: success-pulse 0.6s ease-in-out;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Mobile adjustments: full width card and text scaling */
@media (max-width: 640px) {
    .card-blur {
        max-width: 100%;
        margin: 0 1rem; /* small side margin */
        padding: 1.5rem 1rem;
        border-radius: 1rem;
    }
    .gradient-text {
        font-size: 1.6rem;
    }
    .key-title {
        font-size: 1.6rem;
    }
    .description-text {
        font-size: 0.8rem;
    }
    .key-instructions {
        font-size: 0.8rem;
    }
    .key-code {
        font-size: 1rem;
        padding: 0.7rem;
        letter-spacing: 1.5px;
    }
    .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem !important;
        align-items: center;
        margin-top: 1rem;
    }
}

/* Performance optimizations */
* {
    will-change: auto;
}

.card-blur, .btn-gradient {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
