:root {
    --primary: var(--primary, #0ea5e9);
    --primary-hover: var(--primary-hover, #0284c7);
    --accent: var(--accent, #38bdf8);
    --purple: #a855f7;
    --bg-dark: var(--bg-base, #0f172a);
    --text-main: var(--text-primary, #f8fafc);
    --text-muted: var(--text-secondary, #94a3b8);
    --glass-bg: var(--bg-surface, rgba(30, 41, 59, 0.7));
    --glass-border: var(--border-color, rgba(255, 255, 255, 0.08));
    --glass-shadow: var(--shadow-xl, 0 25px 50px -12px rgba(0, 0, 0, 0.5));
    --card-hover-border: var(--border-glow, rgba(14, 165, 233, 0.35));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    color: var(--text-main);
    padding: 2rem 1rem;
}

/* Animated Background Shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    z-index: 0;
    animation: float 12s infinite alternate ease-in-out;
}

.shape1 {
    width: 450px;
    height: 450px;
    background: rgba(14, 165, 233, 0.25);
    top: -100px;
    left: -100px;
}

.shape2 {
    width: 500px;
    height: 500px;
    background: rgba(168, 85, 247, 0.18);
    bottom: -150px;
    right: -100px;
    animation-delay: -6s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-40px) scale(1.05); }
}

.selection-container {
    width: 100%;
    max-width: 900px;
    position: relative;
    z-index: 10;
    text-align: center;
}

.selection-logo {
    margin-bottom: 1.5rem;
    animation: fadeIn 0.8s ease-out;
}

.selection-logo img {
    height: 64px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.selection-header {
    margin-bottom: 3.5rem;
    animation: fadeIn 1s ease-out;
}

.selection-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(to right, #fff, #a5f3fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.selection-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto;
}

.selection-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3.5rem;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.space-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 3rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}

.space-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    pointer-events: none;
}

.space-card.disabled {
    opacity: 0.65;
}

.space-card:not(.disabled):hover {
    transform: translateY(-8px);
    border-color: var(--card-hover-border);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 20px rgba(14, 165, 233, 0.15);
}

.space-card.pro:not(.disabled):hover {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 20px rgba(168, 85, 247, 0.15);
}

.icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(56, 189, 248, 0.05));
    border: 1px solid rgba(14, 165, 233, 0.25);
    color: var(--accent);
    transition: all 0.4s ease;
}

.space-card.pro .icon-wrapper {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.05));
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: #d8b4fe;
}

.space-card:not(.disabled):hover .icon-wrapper {
    transform: scale(1.1) rotate(3deg);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.35);
    border-color: transparent;
}

.space-card.pro:not(.disabled):hover .icon-wrapper {
    background: linear-gradient(135deg, var(--purple), #c084fc);
    color: #fff;
    box-shadow: 0 10px 25px rgba(168, 85, 247, 0.35);
    border-color: transparent;
}

.space-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.3px;
}

.space-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
    flex-grow: 1;
}

.btn-enter {
    width: 100%;
    padding: 1.1rem;
    border-radius: 14px;
    border: none;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
}

.space-card .btn-enter {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.space-card.pro .btn-enter {
    background: linear-gradient(135deg, var(--purple), #9333ea);
    color: #fff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.space-card:not(.disabled) .btn-enter:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.45);
}

.space-card.pro:not(.disabled) .btn-enter:hover {
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.45);
}

.space-card.disabled .btn-enter {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* Badge pour état d'accès */
.access-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
}

.access-badge.active {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.25);
}

.access-badge.locked {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Footer & Logout Button */
.selection-footer {
    margin-top: 1.5rem;
    animation: fadeIn 1.2s ease-out;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: translateY(-1px);
}

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

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

/* Responsive Layout */
@media (max-width: 768px) {
    .selection-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .selection-header {
        margin-bottom: 2.5rem;
    }

    .space-card {
        padding: 2.5rem 1.5rem;
        border-radius: 24px;
    }
}

/* User Space Header Button (Style pill semblable au bouton theme toggle) */
.user-space-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    border-radius: 9999px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 150ms ease;
    user-select: none;
    text-decoration: none;
    border: 1px solid rgba(56, 189, 248, 0.35);
    background: rgba(14, 165, 233, 0.12);
    color: #38bdf8;
}

.user-space-header-btn:hover {
    background: rgba(14, 165, 233, 0.22);
    border-color: rgba(56, 189, 248, 0.6);
    transform: translateY(-1px);
    color: #ffffff;
}

[data-theme="light"] .user-space-header-btn,
html:not([data-theme="dark"]) .user-space-header-btn {
    background-color: #f0f9ff !important;
    color: #0284c7 !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .user-space-header-btn:hover,
html:not([data-theme="dark"]) .user-space-header-btn:hover {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
}

[data-theme="dark"] .user-space-header-btn {
    background-color: rgba(14, 165, 233, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .user-space-header-btn:hover {
    background-color: rgba(14, 165, 233, 0.25) !important;
    color: #ffffff !important;
}
