:root {
    --primary-bg: #0a0118;
    --surface-bg: #1a0933;
    --surface-elevated: #2e174d;
    --text-light: #f4f0ff;
    --text-muted: #bbaedf;
    --accent: #9c6bff;
    --accent-glow: rgba(156, 107, 255, 0.4);
    --accent-dark: #7a50cc;
    --success: #10b981;
    --error: #ef4444;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Empêche le zoom sur mobile */
    touch-action: manipulation;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-bg);
    color: var(--text-light);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 10px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Fond avec motifs et particules */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        /* Motifs en grille */
        repeating-linear-gradient(
            0deg,
            rgba(156, 107, 255, 0.03) 0px,
            transparent 1px,
            transparent 40px,
            rgba(156, 107, 255, 0.03) 41px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(156, 107, 255, 0.03) 0px,
            transparent 1px,
            transparent 40px,
            rgba(156, 107, 255, 0.03) 41px
        ),
        /* Particules flottantes */
        radial-gradient(circle at 20% 50%, rgba(156, 107, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    z-index: 0;
}

/* Motifs supplémentaires en points */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle, rgba(156, 107, 255, 0.08) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 0;
    opacity: 0.5;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Bouton d'installation PWA */
.install-pwa-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 16px var(--accent-glow);
    transition: all 0.3s ease;
    z-index: 1000;
    animation: slideInDown 0.6s ease;
}

.install-pwa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.install-pwa-btn.show {
    display: flex;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo et titre - Compact sur mobile */
.app-header {
    text-align: center;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease;
}

.app-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    background: var(--gradient-1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 6px 20px var(--accent-glow);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.app-title {
    font-size: 1.6rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 3px;
}

.app-subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Container principal - Optimisé mobile */
.container {
    background: var(--surface-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(156, 107, 255, 0.2);
    animation: fadeInUp 1s ease 0.2s backwards;
}

/* Onglets - Compact */
.form-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--primary-bg);
    padding: 5px;
    border-radius: 12px;
}

.tab-button {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.tab-button.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 3px 10px var(--accent-glow);
}

.tab-button:hover:not(.active) {
    color: var(--accent);
    background: rgba(156, 107, 255, 0.1);
}

/* Formulaires - Hauteur fixe sur mobile */
.form-content {
    position: relative;
    min-height: auto;
}

.form {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(30px);
}

.form.active {
    opacity: 1;
    visibility: visible;
    position: relative;
    transform: translateX(0);
}

h2 {
    color: var(--accent);
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    color: var(--text-light);
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.input-group label i {
    margin-right: 6px;
    color: var(--accent);
}

/* Inputs - Taille optimisée mobile */
input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"] {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid rgba(156, 107, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    font-size: 15px;
    transition: all 0.3s ease;
    /* Empêche le zoom automatique sur iOS */
    -webkit-appearance: none;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(0, 0, 0, 0.4);
}

input::placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Groupe téléphone - Compact */
.phone-input-group {
    display: flex;
    align-items: stretch;
    border: 2px solid rgba(156, 107, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: all 0.3s ease;
}

.phone-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(0, 0, 0, 0.4);
}

.phone-input-group .country-select {
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-light);
    padding: 11px 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-right: 2px solid rgba(156, 107, 255, 0.3);
    min-width: 70px;
}

.phone-input-group .country-code-display {
    padding: 11px 10px;
    color: var(--accent);
    background: rgba(156, 107, 255, 0.1);
    font-weight: 600;
    font-size: 0.9rem;
    border-right: 2px solid rgba(156, 107, 255, 0.3);
    white-space: nowrap;
}

.phone-input-group input[type="tel"] {
    border: none;
    background: transparent;
    box-shadow: none;
    flex: 1;
}

.phone-input-group input[type="tel"]:focus {
    box-shadow: none;
}

/* Messages d'erreur - Compact */
.error-message {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.error-message::before {
    content: '⚠';
    font-size: 0.9rem;
}

.input-error {
    border-color: var(--error) !important;
    animation: shake 0.5s ease;
}

/* Bouton submit - Optimisé */
.submit-button {
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 13px 20px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px var(--accent-glow);
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.submit-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.submit-button:hover::before {
    width: 300px;
    height: 300px;
}

.submit-button:active {
    transform: scale(0.98);
}

/* Footer - Compact */
.form-footer {
    margin-top: 12px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.form-footer a:hover {
    color: var(--text-light);
    text-decoration: underline;
}

.form-footer p {
    margin: 0;
}

/* Message général - Compact */
.general-message {
    text-align: center;
    margin: 12px 0;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    animation: slideInDown 0.5s ease;
}

/* Prompt iOS - Optimisé */
.ios-install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-elevated);
    padding: 16px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    animation: slideInUp 0.5s ease;
    max-height: 50vh;
    overflow-y: auto;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.ios-install-prompt.show {
    display: block;
}

.ios-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.ios-install-icon {
    font-size: 1.8rem;
}

.ios-install-text h3 {
    margin-bottom: 4px;
    color: var(--text-light);
    font-size: 1.1rem;
}

.ios-install-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ios-install-steps {
    background: var(--primary-bg);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.ios-install-steps ol {
    margin-left: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.ios-install-steps li {
    margin: 6px 0;
}

.close-ios-prompt {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Responsive - Mobile First */
@media (max-width: 480px) {
    body {
        padding: 5px;
        justify-content: center;
    }

    .app-header {
        margin-bottom: 10px;
    }

    .app-logo {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
    }

    .app-title {
        font-size: 1.4rem;
    }

    .app-subtitle {
        font-size: 0.75rem;
    }

    .container {
        padding: 16px;
        border-radius: 16px;
    }

    .tab-button {
        padding: 9px 12px;
        font-size: 0.9rem;
    }

    h2 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .input-group {
        margin-bottom: 10px;
    }

    .input-group label {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    input[type="email"],
    input[type="password"],
    input[type="text"],
    input[type="tel"] {
        padding: 10px 12px;
        font-size: 15px;
    }

    .phone-input-group .country-select {
        padding: 10px 6px;
        font-size: 13px;
        min-width: 65px;
    }

    .phone-input-group .country-code-display {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    .submit-button {
        padding: 12px 18px;
        font-size: 1rem;
        margin-top: 6px;
    }

    .form-footer {
        font-size: 0.8rem;
        margin-top: 10px;
    }

    .install-pwa-btn {
        padding: 7px 14px;
        font-size: 0.8rem;
        top: 8px;
        right: 8px;
    }

    .install-pwa-btn span {
        display: none;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .container {
        padding: 12px;
    }

    .app-logo {
        width: 45px;
        height: 45px;
        font-size: 1.4rem;
    }

    .app-title {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    input {
        padding: 9px 10px;
        font-size: 14px;
    }

    .submit-button {
        padding: 11px 16px;
        font-size: 0.95rem;
    }
}

/* Landscape mobile */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: 5px;
    }

    .app-header {
        margin-bottom: 5px;
    }

    .app-logo {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
        margin-bottom: 5px;
    }

    .app-title {
        font-size: 1.2rem;
    }

    .app-subtitle {
        display: none;
    }

    .container {
        padding: 12px;
    }

    .input-group {
        margin-bottom: 8px;
    }

    h2 {
        margin-bottom: 10px;
    }
}
