/* Custom styles to complement Tailwind */
.challenge-solved {
    border: 2px solid #10B981;
    position: relative;
}

.challenge-solved::after {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #10B981;
    font-size: 1.5rem;
    font-weight: bold;
}

.flag-input {
    width: 100%;
    background: rgba(17, 24, 39, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    color: #D1D5DB;
    font-family: monospace;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.flag-input:focus {
    outline: none;
    border-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.flag-input.success {
    border-color: #10B981;
    background: rgba(16, 185, 129, 0.1);
}

.flag-input.error {
    border-color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
    animation: shake 0.3s ease-in-out;
}

.success-message,
.error-message {
    display: none;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease-in-out;
}

.success-message {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid #10B981;
    color: #10B981;
}

.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid #EF4444;
    color: #EF4444;
}

/* Input validation styles */
.flag-input.valid {
    border-color: #10B981;
    background-color: rgba(16, 185, 129, 0.05);
}

.flag-input.invalid {
    border-color: #EF4444;
    background-color: rgba(239, 68, 68, 0.05);
}

/* Progress indicator */
.flag-progress {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.flag-progress-bar {
    flex-grow: 1;
    height: 4px;
    background: #374151;
    border-radius: 2px;
    margin: 0 0.5rem;
    overflow: hidden;
}

.flag-progress-fill {
    height: 100%;
    background: #10B981;
    transition: width 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Responsive improvements */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .challenge-card {
        margin-bottom: 1rem;
    }
}

/* Notification styles */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: #1F2937;
    border-left: 4px solid;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    max-width: 24rem;
    opacity: 0;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left-color: #10B981;
}

.notification.error {
    border-left-color: #EF4444;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-icon {
    flex-shrink: 0;
}

.notification-message {
    flex-grow: 1;
    color: #D1D5DB;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

/* Add at the end of your existing CSS */
.challenge-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(to right, #10B981, #3B82F6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.challenge-card:hover::before {
    opacity: 1;
}

.challenge-solved {
    border: none !important;
}

.challenge-solved::before {
    opacity: 1;
}

.challenge-solved::after {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #10B981;
    font-size: 1.25rem;
    font-weight: bold;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    z-index: 10;
}

.notification {
    backdrop-filter: blur(8px);
    background: rgba(31, 41, 55, 0.95);
}

/* Add to your existing styles */
.challenge-container {
    animation: fadeIn 0.5s ease-out;
}

.hint-container {
    position: relative;
    overflow: hidden;
}

.hint-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: inherit;
    z-index: -1;
}

.submit-button {
    width: 100%;
    background: linear-gradient(to right, #34D399, #3B82F6);
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

.submit-button:hover::before {
    left: 100%;
}

/* Mobile improvements */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    .grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .welcome-section {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .welcome-title {
        font-size: 2.25rem;
        margin-bottom: 1rem;
    }
}

.nav-container {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.8));
    backdrop-filter: blur(8px);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(17, 24, 39, 0.5);
    border-radius: 1rem;
    margin: 0.5rem 0;
}

.challenge-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.8));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 1rem;
    padding: 1.25rem;
    margin: 0.75rem 0;
    position: relative;
    overflow: hidden;
}

.challenge-title {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(to right, #34D399, #60A5FA);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.challenge-description {
    color: #9CA3AF;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.start-button {
    background: linear-gradient(to right, #34D399, #3B82F6);
    padding: 0.875rem;
    border-radius: 0.75rem;
    font-weight: 500;
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.challenge-header {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.8));
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    padding: 1rem;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #34D399;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(52, 211, 153, 0.1);
}

.back-button:hover {
    background: rgba(52, 211, 153, 0.2);
    transform: translateX(-2px);
}

.challenge-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.instruction-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.8));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.encoded-message-container {
    background: rgba(17, 24, 39, 0.5);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    font-family: monospace;
    position: relative;
}

.copy-button {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: rgba(52, 211, 153, 0.1);
    color: #34D399;
    transition: all 0.2s ease;
}

.hint-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #34D399;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(52, 211, 153, 0.1);
    margin: 1rem 0;
    transition: all 0.2s ease;
}