/**
 * ============================================
 * ATLANTIS - Popup Templates CSS
 * ============================================
 * Styles pour les popups Shapespark améliorées
 * - Templates App Integration
 * - Carrousel 3D
 * - Animations modernes
 *
 * v1.0 - 2026-01-11
 */

/* ============================================
   VARIABLES SUPPLÉMENTAIRES
   ============================================ */
:root {
    --popup-bg: linear-gradient(160deg, rgba(13, 13, 26, 0.98) 0%, rgba(18, 18, 31, 0.98) 100%);
    --popup-border: rgba(26, 200, 219, 0.25);
    --popup-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(26, 200, 219, 0.1);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --gold: #fbbf24;
    --silver: #9ca3af;
    --bronze: #d97706;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* ============================================
   POPUP CONTENEUR PRINCIPAL
   ============================================ */
.atl-popup-app {
    background: var(--popup-bg);
    border-radius: 24px;
    width: 520px;
    max-width: 95vw;
    max-height: 85vh;
    border: 1px solid var(--popup-border);
    box-shadow: var(--popup-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.atl-popup-app .atl-header {
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.atl-popup-app .atl-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

.atl-popup-app .atl-title-icon {
    font-size: 24px;
}

.atl-popup-app .atl-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.atl-popup-app .atl-footer {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: center;
}

/* ============================================
   APP_VCARD - CARTE DE VISITE
   ============================================ */
.atl-vcard {
    text-align: center;
}

.atl-vcard-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 16px;
    border: 3px solid var(--atl-cyan);
    box-shadow: 0 0 30px rgba(26, 200, 219, 0.3);
    object-fit: cover;
}

.atl-vcard-name {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
}

.atl-vcard-title {
    font-size: 16px;
    color: var(--atl-cyan);
    margin: 0 0 4px;
}

.atl-vcard-company {
    font-size: 14px;
    color: #94a3b8;
    margin: 0 0 20px;
}

.atl-vcard-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.atl-vcard-badge {
    width: 36px;
    height: 36px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.atl-vcard-info {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.atl-vcard-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--card-border);
}

.atl-vcard-info-row:last-child {
    border-bottom: none;
}

.atl-vcard-info-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.atl-vcard-info-value {
    flex: 1;
    color: #e2e8f0;
    font-size: 14px;
}

.atl-vcard-info-value a {
    color: var(--atl-cyan);
    text-decoration: none;
}

.atl-vcard-info-value a:hover {
    text-decoration: underline;
}

.atl-vcard-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.atl-vcard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.atl-vcard-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.atl-vcard-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}

.atl-vcard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.atl-vcard-qrcode {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
}

.atl-vcard-qrcode canvas,
.atl-vcard-qrcode img {
    width: 120px !important;
    height: 120px !important;
    border-radius: 8px;
    background: white;
    padding: 8px;
}

/* ============================================
   APP_LEADERBOARD - CLASSEMENT
   ============================================ */
.atl-leaderboard {
    position: relative;
}

.atl-leaderboard-period {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.atl-period-btn {
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.atl-period-btn:hover {
    border-color: var(--atl-cyan);
    color: var(--atl-cyan);
}

.atl-period-btn.active {
    background: rgba(26, 200, 219, 0.15);
    border-color: var(--atl-cyan);
    color: var(--atl-cyan);
}

.atl-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.atl-leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.2s;
}

.atl-leaderboard-item:hover {
    border-color: var(--atl-cyan);
    transform: translateX(4px);
}

.atl-leaderboard-item.current-user {
    background: rgba(26, 200, 219, 0.1);
    border-color: var(--atl-cyan);
}

.atl-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    border-radius: 50%;
    background: var(--card-bg);
}

.atl-rank-1 { background: linear-gradient(135deg, #fbbf24, #d97706); color: #000; }
.atl-rank-2 { background: linear-gradient(135deg, #9ca3af, #6b7280); color: #000; }
.atl-rank-3 { background: linear-gradient(135deg, #d97706, #92400e); color: #fff; }

.atl-leaderboard-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
}

.atl-leaderboard-info {
    flex: 1;
    min-width: 0;
}

.atl-leaderboard-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atl-leaderboard-company {
    font-size: 12px;
    color: #64748b;
}

.atl-leaderboard-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    min-width: 60px;
}

.atl-leaderboard-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--atl-cyan), #60a5fa);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.atl-leaderboard-points {
    font-size: 14px;
    font-weight: 600;
    color: var(--atl-cyan);
    min-width: 70px;
    text-align: right;
}

.atl-leaderboard-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: #64748b;
    font-size: 12px;
}

.atl-leaderboard-separator::before,
.atl-leaderboard-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}

/* ============================================
   APP_EVENTS - ÉVÉNEMENTS
   ============================================ */
.atl-events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.atl-event-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.2s;
}

.atl-event-card:hover {
    border-color: var(--atl-cyan);
    transform: translateY(-2px);
}

.atl-event-cover {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.atl-event-content {
    padding: 16px;
}

.atl-event-type {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(26, 200, 219, 0.15);
    border-radius: 20px;
    font-size: 11px;
    color: var(--atl-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.atl-event-title {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 12px;
}

.atl-event-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.atl-event-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #94a3b8;
}

.atl-event-meta-icon {
    font-size: 14px;
}

.atl-event-spots {
    display: flex;
    align-items: center;
    gap: 8px;
}

.atl-event-spots-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.atl-event-spots-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s;
}

.atl-event-spots-fill.warning { background: var(--warning); }
.atl-event-spots-fill.danger { background: var(--danger); }

.atl-event-actions {
    display: flex;
    gap: 8px;
}

.atl-event-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.atl-event-btn-register {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.atl-event-btn-registered {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.atl-event-btn-view {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

/* ============================================
   CARROUSEL 3D
   ============================================ */
.atl-carousel3d-container {
    perspective: 1000px;
    height: 280px;
    position: relative;
    overflow: visible;
}

.atl-carousel3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.atl-carousel3d-item {
    position: absolute;
    width: 200px;
    height: 240px;
    left: 50%;
    margin-left: -100px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.6s ease;
    cursor: pointer;
    backface-visibility: hidden;
}

.atl-carousel3d-item:hover {
    border-color: var(--atl-cyan);
}

.atl-carousel3d-item.active {
    z-index: 10;
    transform: translateZ(50px) scale(1.1);
    border-color: var(--atl-cyan);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(26, 200, 219, 0.2);
}

.atl-carousel3d-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.atl-carousel3d-content {
    padding: 12px;
}

.atl-carousel3d-title {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atl-carousel3d-subtitle {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 8px;
}

.atl-carousel3d-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--atl-cyan);
}

.atl-carousel3d-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    background: var(--success);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

/* Navigation carrousel */
.atl-carousel3d-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.atl-carousel3d-arrow {
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 20px;
    color: #94a3b8;
}

.atl-carousel3d-arrow:hover {
    background: rgba(26, 200, 219, 0.15);
    border-color: var(--atl-cyan);
    color: var(--atl-cyan);
    transform: scale(1.1);
}

.atl-carousel3d-dots {
    display: flex;
    gap: 8px;
}

.atl-carousel3d-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s;
}

.atl-carousel3d-dot:hover {
    background: rgba(255, 255, 255, 0.4);
}

.atl-carousel3d-dot.active {
    background: var(--atl-cyan);
    transform: scale(1.2);
}

/* Réflexion sous le carrousel */
.atl-carousel3d-reflection {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(26, 200, 219, 0.1), transparent);
    transform: scaleY(-1);
    opacity: 0.3;
    pointer-events: none;
}

/* ============================================
   APP_REWARDS - RÉCOMPENSES
   ============================================ */
.atl-rewards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.atl-rewards-points {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
}

.atl-rewards-points-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--atl-cyan);
}

.atl-rewards-points-label {
    font-size: 12px;
    color: #64748b;
}

.atl-reward-active {
    text-align: center;
    padding: 20px;
}

.atl-reward-title {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 12px 0 8px;
}

.atl-reward-description {
    font-size: 14px;
    color: #94a3b8;
    margin: 0 0 8px;
}

.atl-reward-cost {
    font-size: 24px;
    font-weight: 700;
    color: var(--atl-cyan);
    margin: 12px 0;
}

.atl-reward-cost span {
    font-size: 14px;
    color: #64748b;
}

.atl-reward-expires {
    font-size: 12px;
    color: var(--warning);
}

.atl-reward-claim-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
}

.atl-reward-claim-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.atl-reward-claim-btn:disabled {
    background: #374151;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================
   APP_SPACES - ESPACES
   ============================================ */
.atl-space-active {
    text-align: center;
    padding: 20px;
}

.atl-space-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 12px 0;
}

.atl-space-feature {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    font-size: 12px;
    color: #94a3b8;
}

.atl-space-included {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    border-radius: 20px;
    color: var(--success);
    font-size: 13px;
    font-weight: 500;
    margin: 12px 0;
}

.atl-space-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.atl-space-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.atl-space-btn-visit {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.atl-space-btn-subscribe {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.atl-space-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ============================================
   GALERIE D'IMAGES (template gallery)
   ============================================ */
.atl-gallery {
    position: relative;
}

.atl-gallery-caption {
    text-align: center;
    padding: 12px;
    color: #e2e8f0;
    font-size: 14px;
}

.atl-gallery-counter {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.atl-popup-app .atl-body > * {
    animation: fadeSlideUp 0.4s ease forwards;
}

.atl-leaderboard-item {
    animation: fadeSlideUp 0.4s ease forwards;
}

.atl-leaderboard-item:nth-child(1) { animation-delay: 0s; }
.atl-leaderboard-item:nth-child(2) { animation-delay: 0.05s; }
.atl-leaderboard-item:nth-child(3) { animation-delay: 0.1s; }
.atl-leaderboard-item:nth-child(4) { animation-delay: 0.15s; }
.atl-leaderboard-item:nth-child(5) { animation-delay: 0.2s; }
.atl-leaderboard-item:nth-child(6) { animation-delay: 0.25s; }
.atl-leaderboard-item:nth-child(7) { animation-delay: 0.3s; }
.atl-leaderboard-item:nth-child(8) { animation-delay: 0.35s; }
.atl-leaderboard-item:nth-child(9) { animation-delay: 0.4s; }
.atl-leaderboard-item:nth-child(10) { animation-delay: 0.45s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .atl-popup-app {
        width: 100%;
        max-width: 100vw;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
    }

    .atl-carousel3d-container {
        height: 240px;
    }

    .atl-carousel3d-item {
        width: 160px;
        height: 200px;
        margin-left: -80px;
    }

    .atl-vcard-actions {
        flex-direction: column;
    }

    .atl-vcard-btn {
        width: 100%;
        justify-content: center;
    }

    .atl-leaderboard-bar {
        display: none;
    }
}

/* ============================================
   LOADER
   ============================================ */
.atl-popup-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.atl-popup-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--card-border);
    border-top-color: var(--atl-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.atl-popup-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--danger);
}

.atl-popup-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
