/**
 * Sort & Swipe (Trie & Swipe) Activity Styles
 *
 * @package Crowdaa_Challenges_Calendar
 * @since   4.12.107
 */

/* Container principal */
.sort-swipe-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.ss-header {
    text-align: center;
    margin-bottom: 24px;
}

.ss-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #d946ef, #a855f7);
    border-radius: 20px;
    margin-bottom: 16px;
    color: white;
}

.ss-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.ss-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Bandeau défi */
.ss-challenge-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.ss-challenge-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #92400e;
    font-size: 14px;
}

.ss-challenge-score {
    background: #f59e0b;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Écran d'intro */
.ss-intro {
    text-align: center;
}

/* Preview catégories - Layout vertical */
.ss-categories-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

.ss-category {
    background: white;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
}

.ss-category-a {
    border: 3px solid #f472b6;
}

.ss-category-b {
    border: 3px solid #a78bfa;
}

.ss-cat-emoji {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}

.ss-cat-content {
    flex: 1;
    text-align: left;
}

.ss-cat-name {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2px;
}

.ss-cat-direction {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 12px;
}

.ss-cat-direction svg {
    width: 14px;
    height: 14px;
}

.ss-category-a .ss-cat-direction {
    color: #db2777;
    background: #fce7f3;
}

.ss-category-b .ss-cat-direction {
    color: #7c3aed;
    background: #ede9fe;
}

.ss-vs {
    display: none; /* Masquer le VS en mode vertical */
}

/* Instructions */
.ss-instructions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
    text-align: left;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.ss-instruction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #4b5563;
}

.ss-instruction-item svg {
    flex-shrink: 0;
    stroke: #d946ef;
}

/* Bouton start */
.ss-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #d946ef, #a855f7);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(217, 70, 239, 0.4);
}

.ss-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(217, 70, 239, 0.5);
}

/* === ZONE DE JEU === */

/* Header jeu */
.ss-game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    padding: 12px 20px;
    background: white;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ss-timer,
.ss-score {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.ss-timer svg {
    stroke: #d946ef;
}

.ss-score svg {
    stroke: #f59e0b;
}

.ss-timer.ss-timer-warning {
    color: #f59e0b;
}

.ss-timer.ss-timer-critical {
    color: #dc2626;
    animation: timerPulse 0.5s ease infinite;
}

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

.ss-combo {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

.ss-combo-pulse {
    animation: comboPulse 0.3s ease;
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Indicateurs catégorie - v4.12.117 Layout vertical pour plus de clarté */
.ss-category-indicators {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.ss-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.ss-indicator-a {
    background: linear-gradient(135deg, #fdf2f8, #fce7f3);
    color: #be185d;
    border: 2px solid #f9a8d4;
}

.ss-indicator-a::before {
    content: '←';
    font-size: 16px;
    font-weight: 700;
    margin-right: 4px;
}

.ss-indicator-b {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #6d28d9;
    border: 2px solid #c4b5fd;
}

.ss-indicator-b::after {
    content: '→';
    font-size: 16px;
    font-weight: 700;
    margin-left: auto;
}

.ss-ind-emoji {
    font-size: 20px;
}

.ss-ind-name {
    flex: 1;
}

/* Zone de carte */
.ss-card-zone {
    position: relative;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    touch-action: pan-y;
}

.ss-card {
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 20px;
    padding: 40px 60px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.2s ease;
    max-width: 90%;
}

.ss-card:active {
    cursor: grabbing;
}

.ss-card-text {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
    display: block;
}

/* Animations swipe */
.ss-card.ss-swipe-left {
    animation: swipeLeft 0.3s ease forwards;
}

.ss-card.ss-swipe-right {
    animation: swipeRight 0.3s ease forwards;
}

@keyframes swipeLeft {
    to {
        transform: translateX(-200px) rotate(-30deg);
        opacity: 0;
    }
}

@keyframes swipeRight {
    to {
        transform: translateX(200px) rotate(30deg);
        opacity: 0;
    }
}

/* Feedback */
.ss-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.ss-feedback.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.ss-feedback-correct svg {
    stroke: #22c55e;
}

.ss-feedback-wrong svg {
    stroke: #ef4444;
}

/* Boutons de contrôle - v4.12.119 Boutons ronds avec flèches SVG */
.ss-controls {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
}

.ss-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 3px solid;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ss-control-btn:active {
    transform: scale(0.95);
}

.ss-control-left {
    border-color: #f472b6;
    color: #be185d;
}

.ss-control-left svg {
    stroke: #be185d;
}

.ss-control-left:hover {
    background: linear-gradient(135deg, #fdf2f8, #fce7f3);
    transform: translateX(-4px);
    box-shadow: 0 6px 16px rgba(244, 114, 182, 0.3);
}

.ss-control-right {
    border-color: #a78bfa;
    color: #6d28d9;
}

.ss-control-right svg {
    stroke: #6d28d9;
}

.ss-control-right:hover {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    transform: translateX(4px);
    box-shadow: 0 6px 16px rgba(167, 139, 250, 0.3);
}

/* Progress */
.ss-progress {
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

/* === RÉSULTATS === */

.ss-results-content {
    text-align: center;
}

.ss-result-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    font-size: 18px;
    font-weight: 700;
}

.ss-result-win {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
}

.ss-result-lose {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.ss-result-done {
    background: linear-gradient(135deg, #fae8ff, #f5d0fe);
    color: #86198f;
}

.ss-result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.ss-result-stat {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.ss-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.ss-stat-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
}

/* === SECTION DÉFI === */

.ss-challenge-section {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
    border-radius: 16px;
    border: 2px solid #f5d0fe;
}

.ss-challenge-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
    color: #a21caf;
}

.ss-challenge-header svg {
    stroke: #d946ef;
}

.ss-challenge-desc {
    text-align: center;
    font-size: 13px;
    color: #7e22ce;
    margin: 0 0 16px 0;
}

.ss-challenge-select-wrapper {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.ss-challenge-select {
    padding: 12px 16px;
    border: 2px solid #e9d5ff;
    border-radius: 12px;
    font-size: 14px;
    min-width: 200px;
    background: white;
}

.ss-challenge-select:focus {
    outline: none;
    border-color: #d946ef;
}

.ss-challenge-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #d946ef, #a855f7);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ss-challenge-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(217, 70, 239, 0.4);
}

.ss-challenge-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.ss-challenge-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 16px 0 0 0;
    font-size: 12px;
    color: #9333ea;
}

.ss-challenge-sent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #166534;
}

/* === ÉTAT COMPLÉTÉ === */

.sort-swipe-container.ss-completed .results-header {
    margin-bottom: 24px;
    text-align: center;
}

.sort-swipe-container.ss-completed .results-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.sort-swipe-container .results-icon,
.sort-swipe-container .ss-results-icon,
.crowdaa-modal .sort-swipe-container .results-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #d946ef, #a855f7);
    border-radius: 50%;
    margin-bottom: 16px;
    color: white;
    font-size: 0;
    animation: none;
}

.sort-swipe-container .results-icon svg,
.crowdaa-modal .sort-swipe-container .results-icon svg {
    width: 48px;
    height: 48px;
    stroke: white;
}

.sort-swipe-container .results-stats,
.sort-swipe-container .ss-results-stats,
.crowdaa-modal .sort-swipe-container .results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.sort-swipe-container .result-card,
.crowdaa-modal .sort-swipe-container .result-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.sort-swipe-container .result-card .result-icon,
.crowdaa-modal .sort-swipe-container .result-card .result-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #fae8ff, #f5d0fe);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    margin-bottom: 8px;
}

.sort-swipe-container .result-card .result-icon svg,
.crowdaa-modal .sort-swipe-container .result-card .result-icon svg {
    width: 24px;
    height: 24px;
    stroke: #d946ef;
}

.sort-swipe-container .result-card .result-value,
.crowdaa-modal .sort-swipe-container .result-card .result-value {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.sort-swipe-container .result-card .result-label,
.crowdaa-modal .sort-swipe-container .result-card .result-label {
    font-size: 12px;
    color: #6b7280;
}

.sort-swipe-container .completion-message,
.crowdaa-modal .sort-swipe-container .completion-message {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.sort-swipe-container .completion-message p,
.crowdaa-modal .sort-swipe-container .completion-message p {
    margin: 0;
}

/* === RESPONSIVE === */

@media (max-width: 480px) {
    .sort-swipe-container {
        padding: 15px 10px;
    }

    .ss-title {
        font-size: 20px;
    }

    .ss-categories-preview {
        flex-direction: column;
        gap: 12px;
    }

    .ss-category {
        min-width: 100%;
        padding: 16px;
    }

    .ss-vs {
        display: none;
    }

    .ss-card {
        padding: 30px 40px;
    }

    .ss-card-text {
        font-size: 18px;
    }

    .ss-controls {
        gap: 12px;
    }

    .ss-control-btn {
        padding: 12px 20px;
    }

    .ss-result-stats {
        grid-template-columns: 1fr;
    }

    .ss-challenge-select-wrapper {
        flex-direction: column;
    }

    .ss-challenge-select {
        width: 100%;
    }

    .ss-challenge-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Désactivation hover sur tactile */
@media (hover: none), (pointer: coarse) {
    .ss-start-btn:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(217, 70, 239, 0.4);
    }

    .ss-control-left:hover,
    .ss-control-right:hover {
        transform: none;
        background: white;
    }

    .ss-control-left:active,
    .ss-control-right:active {
        transform: scale(0.95);
    }

    .ss-challenge-btn:hover:not(:disabled) {
        transform: none;
        box-shadow: none;
    }

    .ss-challenge-btn:active:not(:disabled) {
        transform: scale(0.98);
    }
}

/* ================================================================
   BOTTOM SHEET USER SELECT - v4.12.116
   Style identique à peer-recognition
   ================================================================ */

/* Bouton pour ouvrir le modal */
.ss-open-user-select-btn {
    width: 100%;
    padding: 15px;
    background: white;
    border: 2px solid #e9d5ff;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    font-size: 16px;
    min-height: 56px;
    margin-bottom: 16px;
}

.ss-open-user-select-btn:hover {
    border-color: #d946ef;
    background: #fdf4ff;
}

.ss-selected-user-display {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.ss-selected-user-display .ss-placeholder-text {
    color: #999;
}

.ss-selected-user-display .ss-selected-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.ss-selected-user-display .ss-selected-name {
    color: #333;
    font-weight: 600;
}

.ss-open-user-select-btn svg {
    color: #999;
    flex-shrink: 0;
}

/* Modal Bottom Sheet */
.ss-user-select-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    animation: ssFadeIn 0.2s;
}

.ss-user-select-modal.active {
    display: flex;
    align-items: flex-end;
}

@media (min-width: 768px) {
    .ss-user-select-modal.active {
        align-items: center;
        justify-content: center;
    }
}

.ss-user-select-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: ssFadeIn 0.2s;
}

.ss-user-select-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: ssSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 768px) {
    .ss-user-select-content {
        border-radius: 16px;
        animation: ssScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}

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

@keyframes ssSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes ssScaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Header */
.ss-user-select-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.ss-user-select-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ss-user-select-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.ss-user-select-close:hover {
    background: #e5e5e5;
    transform: scale(1.05);
}

/* Search Bar */
.ss-user-select-search {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fafafa;
    flex-shrink: 0;
}

.ss-user-select-search svg {
    color: #999;
    flex-shrink: 0;
}

.ss-user-select-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #333;
    outline: none;
}

.ss-user-select-search input::placeholder {
    color: #999;
}

/* User List */
.ss-user-select-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ss-user-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.ss-user-option:hover {
    background: #fdf4ff;
}

.ss-user-option:active {
    background: #fae8ff;
}

.ss-user-option.selected {
    background: #fae8ff;
}

.ss-user-option .ss-user-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.ss-user-option .ss-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ss-user-option .ss-user-info {
    flex: 1;
    min-width: 0;
}

.ss-user-option .ss-user-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ss-user-option .ss-user-email {
    font-size: 13px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ss-user-option .ss-user-check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: #d946ef;
    opacity: 0;
    transition: opacity 0.2s;
}

.ss-user-option.selected .ss-user-check {
    opacity: 1;
}

/* Empty State */
.ss-user-select-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.ss-user-select-empty p {
    margin: 0;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
