:root {
    --primary: #e64980;
    --primary-light: #ff8787;
    --primary-grad: linear-gradient(135deg, #e64980 0%, #ff8787 100%);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-card: rgba(255, 255, 255, 0.06);
    --glass-blur: blur(50px);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-dim: #b0bec5;
    --danger: #ff4d4d;
    --success: #3fb950;
}

* { margin: 0; padding: 0; box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #012; scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { display: none; }
body { font-family: 'Plus Jakarta Sans', sans-serif; color: var(--text); min-height: 100vh; overflow: hidden; }
body.app-active { overflow: auto; }

.bubbles-bg { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.bubble { position: absolute; border-radius: 50%; opacity: 0.6; animation: float linear infinite; }
@keyframes float { 0% { transform: translateY(100vh) translateX(0) rotate(0deg); opacity: 0; } 10% { opacity: 0.6; } 90% { opacity: 0.6; } 100% { transform: translateY(-100px) translateX(200px) rotate(360deg); opacity: 0; } }
.bubble:nth-child(1) { width: 45px; height: 45px; background: linear-gradient(to bottom, #e64980, #ff8787); left: 5%; animation-duration: 20s; animation-delay: 0s; }
.bubble:nth-child(2) { width: 30px; height: 30px; background: linear-gradient(to bottom, #82c91e, #3bc9db); left: 15%; animation-duration: 18s; animation-delay: 2s; }
.bubble:nth-child(3) { width: 55px; height: 55px; background: linear-gradient(to bottom, #7950f2, #f783ac); left: 25%; animation-duration: 22s; animation-delay: 4s; }
.bubble:nth-child(4) { width: 35px; height: 35px; background: linear-gradient(to bottom, #4481eb, #04befe); left: 35%; animation-duration: 16s; animation-delay: 1s; }
.bubble:nth-child(5) { width: 40px; height: 40px; background: linear-gradient(to bottom, #e64980, #ff8787); left: 45%; animation-duration: 24s; animation-delay: 6s; }
.bubble:nth-child(6) { width: 25px; height: 25px; background: linear-gradient(to bottom, #82c91e, #3bc9db); left: 55%; animation-duration: 19s; animation-delay: 3s; }
.bubble:nth-child(7) { width: 50px; height: 50px; background: linear-gradient(to bottom, #7950f2, #f783ac); left: 65%; animation-duration: 21s; animation-delay: 5s; }
.bubble:nth-child(8) { width: 38px; height: 38px; background: linear-gradient(to bottom, #4481eb, #04befe); left: 75%; animation-duration: 17s; animation-delay: 7s; }
.bubble:nth-child(9) { width: 32px; height: 32px; background: linear-gradient(to bottom, #e64980, #ff8787); left: 85%; animation-duration: 23s; animation-delay: 8s; }
.bubble:nth-child(10) { width: 48px; height: 48px; background: linear-gradient(to bottom, #82c91e, #3bc9db); left: 10%; animation-duration: 15s; animation-delay: 9s; }
.bubble:nth-child(11) { width: 42px; height: 42px; background: linear-gradient(to bottom, #7950f2, #f783ac); left: 50%; animation-duration: 25s; animation-delay: 10s; }
.bubble:nth-child(12) { width: 36px; height: 36px; background: linear-gradient(to bottom, #4481eb, #04befe); left: 90%; animation-duration: 18s; animation-delay: 11s; }
.bubble:nth-child(13) { width: 40px; height: 40px; background: linear-gradient(to bottom, #e64980, #ff8787); left: 30%; animation-duration: 20s; animation-delay: 12s; }
.bubble:nth-child(14) { width: 28px; height: 28px; background: linear-gradient(to bottom, #82c91e, #3bc9db); left: 70%; animation-duration: 16s; animation-delay: 13s; }

#login-screen { position: fixed; inset: 0; display: flex; justify-content: center; align-items: center; z-index: 10; }
.login-card { background: var(--glass-bg-card); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); padding: 70px 50px; border-radius: 40px; width: 90%; max-width: 460px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,0.6); }

input, textarea, select {
    background: rgba(0,0,0,0.5) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 18px 22px !important;
    color: #fff !important;
    width: 100%;
    font-size: 16px !important;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px rgba(230,73,128,0.3);
}

.btn-action {
    background: var(--primary-grad);
    color: #fff;
    border: none;
    padding: 18px 30px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(230,73,128,0.4);
}
.btn-action:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(230,73,128,0.6);
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 15px 30px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 15px;
    transition: all 0.3s ease;
}
.btn-secondary:hover {
    background: rgba(230,73,128,0.15);
    border-color: var(--primary-light);
    color: #fff;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 85px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 30px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(50px);
    border-bottom: 1px solid var(--glass-border);
}
.menu-btn {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.menu-btn div {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}
.header-logo {
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 22px;
    justify-self: center;
    cursor: pointer;
}
.header-logout {
    background: rgba(255,77,77,0.1);
    color: var(--danger);
    border: none;
    padding: 10px 20px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    justify-self: end;
}
.header-logout:hover { background: rgba(255,77,77,0.2); }

#sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 330px;
    height: 100vh;
    padding: 130px 20px;
    transition: 0.6s ease;
    z-index: 999;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(50px);
    border-right: 1px solid var(--glass-border);
}
#sidebar.open { left: 0; }

#sidebar button {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 16px;
    font-weight: 600;
    padding: 18px 24px;
    width: 100%;
    border-radius: 20px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    transition: all 0.3s ease;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}
#sidebar button i {
    width: 36px;
    font-size: 18px;
    text-align: center;
    flex-shrink: 0;
}
#sidebar button span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
#sidebar button:hover, #sidebar button.active {
    background: var(--primary-grad);
    color: #fff;
    border-color: transparent;
}

#main-content {
    padding: 130px 40px 100px;
    max-width: 1200px;
    margin: 0 auto;
    z-index: 5;
    position: relative;
    min-height: 100vh;
}

.section { display: none; }
.section.active { display: block; }

.card, .user-card, .module-card {
    background: var(--glass-bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 35px;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    transition: 0.4s;
    position: relative;
}
.user-card:hover, .module-card:hover { transform: translateY(-8px); }
.user-card {
    display: flex;
    align-items: center;
    gap: 20px;
}
.user-card .delete-btn {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}
.user-card .delete-btn:hover { color: var(--danger); }

.progress-container {
    background: rgba(255,255,255,0.08);
    height: 8px;
    border-radius: 10px;
    margin-top: 15px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}
.progress-bar {
    height: 100%;
    background: var(--primary-grad);
    width: 0%;
    transition: width 1.2s ease;
}
.obj-info {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
    display: block;
    font-weight: 600;
}

.pass-container { position: relative; }
.pass-toggle {
    position: absolute;
    right: 22px;
    top: 20px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 20px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 5000;
    padding: 20px;
    overflow-y: auto;
}
.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--glass-bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 40px;
    padding: 50px;
    margin: auto;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

.role-btn {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    padding: 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.4s;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
}
.role-btn:hover { background: rgba(230,73,128,0.15); border-color: var(--primary-light); }
.role-btn.selected {
    background: var(--primary-grad);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 30px rgba(230,73,128,0.4);
}

#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--glass-bg-card);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    padding: 20px 40px;
    border-radius: 20px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.5s ease;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.success { border-left: 6px solid var(--success); }
#toast.error { border-left: 6px solid var(--danger); }

#app-interface { display: none; opacity: 0; transition: opacity 1s ease; }

.toggle-visible {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-dim);
}
.toggle-visible.active { color: var(--success); }

.media-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    margin-top: 15px;
    padding: 10px 0;
}
.media-item img, .media-item video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 15px;
}
.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}
.upload-preview img, .upload-preview video {
    max-width: 150px;
    max-height: 150px;
    border-radius: 10px;
    object-fit: cover;
}

.upload-btn {
    background: var(--primary-grad);
    color: #fff;
    padding: 15px 25px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 15px;
    display: inline-block;
}

.pdf-link { margin-top: 15px; font-size: 16px; }
.pdf-link a { color: var(--primary-light); font-weight: 600; text-decoration: none; }
.pdf-link a:hover { text-decoration: underline; }

.formations-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}
.formations-tab {
    padding: 12px 25px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}
.formations-tab.active {
    background: var(--primary-grad);
    border-color: transparent;
    color: #fff;
}

.formations-section { display: none; }
.formations-section.active { display: block; }

.formations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.stats-container { margin-top: 40px; }
.stats-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}
.progress-tiles { display: grid; gap: 20px; }

.perf-tile {
    background: var(--glass-bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 25px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    transition: 0.4s;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.perf-tile:hover { transform: translateY(-8px); }
.perf-tile-header { display: flex; align-items: center; gap: 15px; }
.perf-tile-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.08);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--primary-light);
}
.perf-tile-info { flex: 1; }
.perf-tile-info span:first-child {
    font-size: 13px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 6px;
}
.perf-tile-info span:last-child {
    font-size: 28px;
    font-weight: 800;
}

.reward-card {
    background: var(--primary-grad);
    border: none;
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(230,73,128,0.5);
    text-align: center;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.reward-card .icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 15px;
}
.reward-card h3 { font-size: 16px; opacity: 0.9; margin-bottom: 8px; }
.reward-card .palier-name { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.reward-card .bonus { font-size: 32px; font-weight: 800; }
.next-bonus { font-size: 14px; opacity: 0.85; }
.next-bonus strong { font-weight: 700; color: #fff; }
.max-level { font-size: 14px; opacity: 0.9; margin-top: 8px; }

#congrats-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-grad);
    color: white;
    padding: 20px 40px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(230,73,128,0.6);
    font-size: 20px;
    font-weight: 700;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
#congrats-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    body { font-size: 14px; }
    header { height: 70px; padding: 0 15px; }
    .menu-btn { width: 45px; height: 45px; }
    .menu-btn div { width: 20px; height: 2px; }
    .header-logo { font-size: 18px; letter-spacing: 1.5px; }
    .header-logout { padding: 8px 15px; font-size: 13px; }
    #sidebar { width: 280px; padding: 100px 15px; }
    #main-content { padding: 90px 20px 80px; }
    .card, .user-card, .module-card { padding: 25px; border-radius: 20px; }
    .btn-action, .btn-secondary { padding: 14px 20px; font-size: 15px; }
    input, textarea, select { padding: 14px 18px; font-size: 15px; }
    .user-card { flex-direction: column; align-items: flex-start; gap: 15px; padding: 20px; }
    .user-card .delete-btn { position: static; margin-top: 10px; font-size: 22px; }
    .perf-tile { height: auto; min-height: 140px; padding: 20px; }
    .reward-card { height: auto; padding: 20px; }
    .reward-card .bonus { font-size: 26px; }
    .reward-card .palier-name { font-size: 18px; }
    .stats-grid { grid-template-columns: 1fr; gap: 20px; }
    .progress-tiles { grid-template-columns: 1fr; }
    .formations-tabs { flex-direction: column; gap: 10px; }
    .media-carousel { flex-direction: column; align-items: center; }
    .media-item img, .media-item video { max-height: 300px; }
    .modal-content { padding: 30px 20px; border-radius: 25px; }
    .login-card { padding: 50px 25px; border-radius: 30px; }
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
}
@media (max-width: 480px) {
    .login-card { padding: 40px 20px; }
    .btn-action { font-size: 14px; }
    #sidebar { width: 85%; padding: 100px 10px; }
    .header-logo { font-size: 16px; }
}