/* Unified CSS for Registration & Login Pages */

/* ===== COMMON STYLES ===== */

/* Animated gradient background */
.container-fluid.bg-light {
    background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 50%, #f0f9ff 100%);
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Subtle dot pattern overlay */
.container-fluid.bg-light::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(13, 110, 253, 0.05) 2px, transparent 2px),
        radial-gradient(circle at 80% 70%, rgba(40, 167, 69, 0.05) 2px, transparent 2px);
    background-size: 100px 100px;
    pointer-events: none;
}

/* Card styling - Common for both forms */
.card {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.95));
    backdrop-filter: blur(10px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Animated border */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        #0d6efd 0%, 
        #20c997 33%, 
        #0d6efd 66%, 
        #20c997 100%);
}

@keyframes borderShimmer {
    0% { background-position: 300% 0; }
    100% { background-position: -300% 0; }
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Card header - Different colors for register/login */
.card-header {
    border-radius: 18px 18px 0 0 !important;
    border-bottom: none;
    padding: 2rem 1.5rem !important;
    position: relative;
    overflow: hidden;
}

/* Register specific header */
.card-header.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

/* Login specific header */
.card-header.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #20c997 100%) !important;
}

/* Shine effect for header */
.card-header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    pointer-events: none;
}

@keyframes headerShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.card-header h4 {
    font-weight: 700;
    letter-spacing: 0.8px;
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header i {
    font-size: 1.2em;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}

/* ===== FORM ELEMENTS ===== */

/* Form labels */
.form-label {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.form-label::before {
    content: '→';
    color: #0d6efd;
    font-weight: bold;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

/* Input fields */
.form-control-lg {
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.form-control-lg:focus {
    border-color: #0d6efd;
    background: white;
    box-shadow: 
        0 0 0 4px rgba(13, 110, 253, 0.15),
        inset 0 2px 6px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.form-control-lg:focus + .form-label::before {
    opacity: 1;
    transform: translateX(0);
}

.form-control-lg::placeholder {
    color: #94a3b8;
    font-weight: 400;
    transition: all 0.3s ease;
}

.form-control-lg:focus::placeholder {
    color: #6c757d;
    transform: translateX(5px);
}

/* Form text */
.form-text {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.5rem;
    padding-left: 1rem;
    font-weight: 400;
}

/* ===== LOGIN PAGE SPECIFIC ===== */

/* CAPTCHA Styles */
.captcha-container {
    margin-bottom: 1.5rem;
}

.captcha-text {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 8px;
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    user-select: none;
}

@keyframes captchaDistort {
    0% { transform: skewX(-1deg); }
    100% { transform: skewX(1deg); }
}

.captcha-card {
    border-radius: 12px;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.captcha-card:hover {
    transform: rotate(-0.5deg);
    border-color: rgba(13, 110, 253, 0.3);
}

/* Refresh button */
.btn-outline-secondary {
    border-radius: 10px;
    border-width: 2px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-outline-secondary:hover:not(:disabled) {
    background: #6c757d;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
}

.btn-outline-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== BUTTONS ===== */

/* Common button styles */
.btn-success, .btn-primary {
    border: none;
    border-radius: 14px;
    padding: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    text-transform: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Register button */
.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1ba97e 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(40, 167, 69, 0.3);
}

/* Login button */
.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #20c997 100%) !important;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0b5ed7 0%, #1ba97e 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(13, 110, 253, 0.3);
}

/* Common button hover effect */
.btn-success:hover:not(:disabled)::before,
.btn-primary:hover:not(:disabled)::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: buttonShine 0.8s ease;
}

@keyframes buttonShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.btn-success:disabled,
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== LINKS ===== */

a.text-decoration-none {
    color: #0d6efd;
    font-weight: 600;
    position: relative;
    padding-bottom: 3px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    display: inline-block;
}

a.text-decoration-none::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #0d6efd, #20c997);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s ease;
}

a.text-decoration-none:hover {
    color: #0b5ed7;
}

a.text-decoration-none:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ===== ANIMATIONS ===== */

/* Entrance animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== VALIDATION STATES ===== */

.form-control.ng-invalid.ng-touched {
    border-color: #dc3545;
    background: linear-gradient(to right, rgba(220, 53, 69, 0.03), transparent);
    animation: shake 0.5s ease;
}

.form-control.ng-valid.ng-touched {
    border-color: #28a745;
    background: linear-gradient(to right, rgba(40, 167, 69, 0.03), transparent);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Success checkmark */
.form-control.ng-valid.ng-touched::after {
    content: '';
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2328a745'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    opacity: 0;
    animation: checkmarkFade 0.3s ease forwards 0.2s;
}

@keyframes checkmarkFade {
    to { opacity: 1; }
}

/* ===== LOADING STATES ===== */

.spinner-border {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 0.2em;
    vertical-align: middle;
    border-top-color: currentColor;
    border-right-color: transparent;
    border-bottom-color: currentColor;
    border-left-color: transparent;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .card {
        margin: 1rem;
        border-radius: 14px;
        backdrop-filter: blur(5px);
    }
    
    .card-header {
        padding: 1.5rem 1.25rem !important;
    }
    
    .form-control-lg {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    .btn-success, .btn-primary {
        padding: 0.875rem;
    }
    
    .captcha-text {
        font-size: 2rem;
        letter-spacing: 6px;
    }
    
    .container-fluid.bg-light {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .card-header h4 {
        font-size: 1.25rem;
    }
    
    .form-control-lg {
        font-size: 0.95rem;
    }
    
    .captcha-text {
        font-size: 1.75rem;
        letter-spacing: 4px;
    }
}

/* ===== ACCESSIBILITY ===== */

.form-control-lg:focus-visible,
.btn-success:focus-visible,
.btn-primary:focus-visible,
.btn-outline-secondary:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    outline-color: rgba(13, 110, 253, 0.5);
}

/* ===== UTILITY CLASSES ===== */

.font-monospace {
    font-family: 'Courier New', monospace;
}

.display-6 {
    font-size: 2.5rem;
}

/* Smooth transitions for all interactive elements */
button, input, a {
    transition: all 0.3s ease;
}

/* Enhanced button focus states */
.btn-success:focus,
.btn-primary:focus,
.btn-outline-secondary:focus {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(13, 110, 253, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Password strength indicator for registration */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 0.5rem;
    background: #e2e8f0;
    overflow: hidden;
    position: relative;
}

.password-strength::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #dc3545, #ffc107, #28a745);
    transition: width 0.3s ease;
}
