/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #0ea5e9;
    --accent-color: #22d3ee;
    --background-dark: #0f0f1a;
    --background-card: #1a1a2e;
    --background-input: #252540;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #3f3f5a;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
    --gradient-2: linear-gradient(135deg, #0ea5e9 0%, #22d3ee 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary-color);
    top: 50%;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 350px;
    height: 350px;
    background: var(--accent-color);
    bottom: -100px;
    left: 30%;
    animation-delay: -10s;
}

.shape-4 {
    width: 250px;
    height: 250px;
    background: var(--primary-light);
    top: 30%;
    left: 50%;
    animation-delay: -15s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(50px, 50px) rotate(90deg);
    }
    50% {
        transform: translate(0, 100px) rotate(180deg);
    }
    75% {
        transform: translate(-50px, 50px) rotate(270deg);
    }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 40px 20px;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    max-width: 600px;
}

.welcome-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
}

.welcome-title .highlight {
    display: block;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
}

/* Auth Container */
.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    background: var(--background-input);
    padding: 6px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-container a {
    color: var(--primary-light);
    text-decoration: none;
}

.checkbox-container a:hover {
    text-decoration: underline;
}

.forgot-link {
    font-size: 0.875rem;
    color: var(--primary-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--gradient-1);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Social Login */
.social-login {
    display: flex;
    gap: 12px;
}

.btn-social {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-social svg {
    width: 20px;
    height: 20px;
}

.btn-social:hover {
    background: var(--background-card);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .welcome-title {
        font-size: 2.25rem;
    }

    .welcome-description {
        font-size: 1rem;
    }

    .auth-container {
        padding: 24px;
    }

    .main-content {
        gap: 30px;
        padding: 20px 10px;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 1.875rem;
    }

    .social-login {
        flex-direction: column;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .floating-shape {
        opacity: 0.2;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-section {
    animation: fadeInUp 0.8s ease-out;
}

.auth-container {
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

/* Input Focus Effects */
.form-group input:focus {
    background: rgba(99, 102, 241, 0.05);
}

/* Button Loading State */
.btn-primary.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-primary.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Auth Page Specific Styles */
.auth-page {
    max-width: 440px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-footer a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Form Row for side-by-side inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Homepage Auth Buttons */
.auth-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-large {
    padding: 16px 48px;
    font-size: 1.125rem;
    min-width: 180px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    color: var(--primary-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* Features Preview */
.features-preview {
    display: flex;
    gap: 32px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.feature-item {
    text-align: center;
    max-width: 200px;
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    transition: all 0.3s ease;
}

.feature-icon svg {
    width: 32px;
    height: 32px;
    color: var(--primary-light);
}

.feature-item:hover .feature-icon {
    background: var(--gradient-1);
    border-color: transparent;
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.feature-item:hover .feature-icon svg {
    color: white;
}

.feature-item h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Avatar Upload Styles */
.avatar-upload {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--background-input);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.avatar-preview svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview.has-image {
    border-style: solid;
    border-color: var(--primary-color);
}

.avatar-upload-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-upload svg {
    width: 18px;
    height: 18px;
}

.btn-upload:hover {
    background: var(--background-card);
    border-color: var(--primary-color);
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Google Sign-In Button Container */
#google-signin-btn {
    display: flex;
    justify-content: center;
    width: 100%;
}

#google-signin-btn > div {
    width: 100% !important;
}

.btn-google-fallback {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-google-fallback:hover {
    background: var(--background-card);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Email Verification Modal */
.verification-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.verification-modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.verification-content {
    background: var(--background-card);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5),
                0 0 60px rgba(99, 102, 241, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.verification-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
    }
}

.verification-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.verification-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.verification-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.verification-content p span {
    color: var(--primary-color);
    font-weight: 600;
}

.verification-inputs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.code-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--background-input);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.code-input.filled {
    border-color: var(--success-color);
    background: rgba(34, 197, 94, 0.1);
}

.code-input.error {
    border-color: var(--error-color);
    animation: shake 0.3s ease;
}

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

.verification-content .btn-primary {
    width: 100%;
    margin-bottom: 16px;
}

.resend-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.resend-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.resend-text a:hover {
    text-decoration: underline;
}

.resend-text a.disabled {
    color: var(--text-muted);
    pointer-events: none;
}

.timer-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* About Section - ScudoDigitale Space Description */
.about-section {
    width: 100%;
    max-width: 900px;
    margin: 3rem auto;
    padding: 3rem;
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.about-content {
    text-align: center;
}

.about-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.about-text:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .about-section {
        padding: 2rem;
        margin: 2rem auto;
    }
    
    .about-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .about-text {
        font-size: 1rem;
        line-height: 1.6;
    }
}

