* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --mystic-purple: #363237;
    --celestial-blue: #2D4262;
    --ethereal-gold: #73605B;
    --spirit-silver: #D09683;
    --light-text: #F5F3F4;
    --dark-bg: #1A191B;
    --medium-bg: #242028;
}

body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
    line-height: 1.6;
    padding: 1rem;
    background: linear-gradient(135deg, var(--dark-bg), var(--medium-bg));
}

/* Mystical Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(54, 50, 55, 0.3) 0%, transparent 25%),
        radial-gradient(circle at 80% 70%, rgba(45, 66, 98, 0.3) 0%, transparent 25%),
        radial-gradient(circle at 40% 80%, rgba(115, 96, 91, 0.2) 0%, transparent 20%);
    animation: mysticalPulse 15s ease-in-out infinite;
}

@keyframes mysticalPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Cosmic Canvas */
#cosmicCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Signup Container */
.signup-container {
    background: rgba(36, 32, 40, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(54, 50, 55, 0.6);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(54, 50, 55, 0.4);
    padding: 2rem;
    width: 100%;
    max-width: 600px;
    min-width: 300px;
    position: relative;
    animation: fadeInUp 1s ease;
    margin: 1rem;
}

.signup-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(208, 150, 131, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
    pointer-events: none;
}

.signup-container:hover::before {
    opacity: 1;
}

/* Header Section */
.signup-header {
    text-align: center;
    margin-bottom: 2rem;
}

.signup-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.signup-logo i {
    font-size: clamp(2rem, 6vw, 3rem);
    color: var(--spirit-silver);
    text-shadow: 0 0 20px rgba(208, 150, 131, 0.4);
    animation: mysticalPulse 2s ease-in-out infinite;
}

.signup-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--spirit-silver);
    text-shadow: 0 0 20px rgba(208, 150, 131, 0.4);
    line-height: 1.2;
}

.signup-subtitle {
    color: var(--light-text);
    opacity: 0.8;
    font-size: clamp(0.875rem, 3vw, 1rem);
    line-height: 1.4;
}

/* Form Styling */
.signup-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--spirit-silver);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid rgba(54, 50, 55, 0.6);
    border-radius: 10px;
    background: rgba(36, 32, 40, 0.5);
    color: var(--light-text);
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.form-control:focus {
    outline: none;
    border-color: var(--spirit-silver);
    box-shadow: 0 0 0 3px rgba(208, 150, 131, 0.3);
    background: rgba(36, 32, 40, 0.7);
}

.form-control::placeholder {
    color: rgba(245, 243, 244, 0.5);
    font-size: 0.9rem;
}

/* Form Icons */
.form-icon {
    position: absolute;
    left: 1rem;
    top: 2.5rem;
    color: var(--spirit-silver);
    font-size: 1.1rem;
    z-index: 1;
    transition: all 0.3s ease;
}

.form-group:focus-within .form-icon {
    transform: scale(1.1);
    text-shadow: 0 0 10px rgba(208, 150, 131, 0.6);
}

/* Error Messages */
.errorlist {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.errorlist li {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.5s ease-in-out;
}

.errorlist li::before {
    content: '\f06a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

/* Submit Button */
.btn-submit {
    background: linear-gradient(135deg, var(--mystic-purple), var(--celestial-blue));
    border: 1px solid rgba(208, 150, 131, 0.4);
    color: var(--light-text);
    border-radius: 25px;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1rem;
    width: 100%;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(208, 150, 131, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(54, 50, 55, 0.5);
    border-color: var(--spirit-silver);
}

.btn-submit:active {
    transform: translateY(-1px);
}

/* Login Link */
.login-link {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(54, 50, 55, 0.4);
}

.login-link p {
    color: var(--light-text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.login-link a {
    color: var(--spirit-silver);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.login-link a:hover {
    text-shadow: 0 0 10px rgba(208, 150, 131, 0.5);
    transform: translateX(5px);
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--light-text);
}

.strength-bar {
    height: 4px;
    background: rgba(245, 243, 244, 0.1);
    border-radius: 2px;
    margin-bottom: 0.25rem;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.password-match {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--light-text);
}

/* Success Modal */
.success-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 25, 27, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: rgba(36, 32, 40, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(208, 150, 131, 0.4);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-family: 'Cinzel', serif;
    color: var(--spirit-silver);
    margin-top: 1rem;
    text-shadow: 0 0 10px rgba(208, 150, 131, 0.4);
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.modal-body p {
    color: var(--light-text);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mysticalPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(208, 150, 131, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(208, 150, 131, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(208, 150, 131, 0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
        overflow: auto;
    }
    
    .signup-container {
        padding: 1.5rem;
        margin: 0.5rem;
        border-radius: 15px;
    }
    
    .signup-header {
        margin-bottom: 1.5rem;
    }
    
    .signup-logo i {
        font-size: 2rem;
    }
    
    .signup-title {
        font-size: 1.75rem;
    }
    
    .signup-form {
        gap: 1rem;
    }
    
    .form-control {
        padding: 0.875rem 0.875rem 0.875rem 2.5rem;
        font-size: 0.95rem;
    }
    
    .form-icon {
        top: 2.2rem;
        left: 0.875rem;
        font-size: 1rem;
    }
    
    .btn-submit {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
        margin-top: 0.5rem;
    }
    
    .login-link {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .signup-container {
        padding: 1.25rem;
        margin: 0.25rem;
        border-radius: 12px;
    }
    
    .signup-header {
        margin-bottom: 1.25rem;
    }
    
    .signup-logo i {
        font-size: 1.75rem;
    }
    
    .signup-title {
        font-size: 1.5rem;
    }
    
    .signup-subtitle {
        font-size: 0.8rem;
    }
    
    .form-group label {
        font-size: 0.8rem;
    }
    
    .form-control {
        padding: 0.75rem 0.75rem 0.75rem 2.25rem;
        font-size: 0.9rem;
    }
    
    .form-icon {
        top: 2rem;
        left: 0.75rem;
        font-size: 0.9rem;
    }
    
    .btn-submit {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        border-radius: 20px;
    }
    
    .login-link p,
    .login-link a {
        font-size: 0.85rem;
    }
    
    .password-strength,
    .password-match {
        font-size: 0.8rem;
    }
    
    .errorlist li {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 320px) {
    .signup-container {
        padding: 1rem;
        margin: 0.25rem;
    }
    
    .form-control {
        padding: 0.625rem 0.625rem 0.625rem 2rem;
    }
    
    .form-icon {
        left: 0.625rem;
        top: 1.8rem;
        font-size: 0.85rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
}

/* Form paragraph styling */
.signup-form p {
    margin: 0;
}

.signup-form input[type="text"],
.signup-form input[type="password"],
.signup-form input[type="email"] {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid rgba(54, 50, 55, 0.6);
    border-radius: 10px;
    background: rgba(36, 32, 40, 0.5);
    color: var(--light-text);
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.signup-form input[type="text"]:focus,
.signup-form input[type="password"]:focus,
.signup-form input[type="email"]:focus {
    outline: none;
    border-color: var(--spirit-silver);
    box-shadow: 0 0 0 3px rgba(208, 150, 131, 0.3);
    background: rgba(36, 32, 40, 0.7);
}

.signup-form input[type="text"]::placeholder,
.signup-form input[type="password"]::placeholder,
.signup-form input[type="email"]::placeholder {
    color: rgba(245, 243, 244, 0.5);
}

/* Help text styling */
.helptext {
    font-size: 0.8rem;
    color: rgba(245, 243, 244, 0.7);
    margin-top: 0.25rem;
    font-style: italic;
    display: block;
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .btn-submit:hover {
        transform: none;
        box-shadow: 0 5px 15px rgba(54, 50, 55, 0.4);
    }
    
    .login-link a:hover {
        transform: none;
    }
    
    .signup-container:hover::before {
        opacity: 0;
    }
    
    .form-group:focus-within .form-icon {
        transform: none;
    }
}

/* Prevent zoom on input focus for iOS */
@media (max-width: 768px) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Improved form spacing for mobile */
@media (max-width: 480px) {
    .signup-form {
        gap: 0.875rem;
    }
    
    .form-group {
        margin-bottom: 0.25rem;
    }
}

/* Better modal responsiveness */
@media (max-width: 480px) {
    .success-modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        padding: 1.25rem;
    }
    
    .modal-header {
        margin-bottom: 1rem;
    }
    
    .modal-header h2 {
        margin-top: 0.5rem;
    }
}