/**
 * Bottom Sheet - Style Discord/Notion
 */

.bottomsheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    backdrop-filter: blur(2px);
}

.bottomsheet-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.bottomsheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: var(--bottomsheet-max-height);
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    z-index: var(--z-bottomsheet);
    transform: translateY(100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}

.bottomsheet.active {
    transform: translateY(0);
}

.bottomsheet-handle {
    display: flex;
    justify-content: center;
    padding: var(--spacing-3) 0;
    cursor: grab;
}

.bottomsheet-handle::before {
    content: '';
    width: 36px;
    height: 4px;
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
}

.bottomsheet-header {
    padding: 0 var(--spacing-4) var(--spacing-3);
    border-bottom: 1px solid var(--color-border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bottomsheet-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.bottomsheet-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.bottomsheet-close:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.bottomsheet-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-4);
    overscroll-behavior: contain;
}

.bottomsheet-footer {
    padding: var(--spacing-3) var(--spacing-4);
    border-top: 1px solid var(--color-border-default);
    display: flex;
    gap: var(--spacing-2);
    justify-content: flex-end;
}

/* Variantes de taille */
.bottomsheet.small {
    max-height: 40vh;
}

.bottomsheet.medium {
    max-height: 60vh;
}

.bottomsheet.large {
    max-height: 85vh;
}

.bottomsheet.fullscreen {
    max-height: 100vh;
    border-radius: 0;
}

/* Sur desktop, le bottomsheet devient un modal centré */
@media (min-width: 768px) {
    .bottomsheet {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 50%;
        width: 100%;
        max-width: 560px;
        max-height: 80vh;
        border-radius: var(--radius-xl);
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
    }

    .bottomsheet.active {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    .bottomsheet-handle {
        display: none;
    }

    .bottomsheet.large {
        max-width: 720px;
    }

    .bottomsheet.fullscreen {
        max-width: 90vw;
        max-height: 90vh;
        border-radius: var(--radius-xl);
    }
}

/* Animation de l'ouverture */
@keyframes bottomsheet-slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes bottomsheet-scale-in {
    from {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Modal Overlay - Règles Interclub */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-4);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.2s ease;
}

.modal-header {
    padding: var(--spacing-4);
    border-bottom: 1px solid var(--color-border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
}

.modal-body {
    padding: var(--spacing-4);
    overflow-y: auto;
}

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

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Rules Styles */
.rules-section {
    padding-bottom: var(--spacing-3);
    border-bottom: 1px solid var(--color-border-subtle);
}

.rules-section:last-child {
    border-bottom: none;
}

.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rules-list li {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) 0;
}

.rule-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-1) var(--spacing-2);
    background: var(--color-accent-blue-bg);
    color: var(--color-accent-blue);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-md);
    min-width: 60px;
}

.rule-badge.success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.rules-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.rule-option {
    background: var(--color-bg-subtle);
    border-radius: var(--radius-lg);
    padding: var(--spacing-3);
}

.rule-option-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-2);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.rule-option-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-1);
}

.rule-option-separator {
    text-align: center;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.rule-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    background: var(--color-warning-bg);
    border-radius: var(--radius-lg);
    color: var(--color-warning);
}

.rule-alert svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.rule-alert span {
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-4);
}

@media (max-width: 640px) {
    .rules-grid {
        grid-template-columns: 1fr;
    }
}

/* Divider */
.divider {
    height: 1px;
    background: var(--color-border-default);
}

/* Import modal styles */
.import-section h4 {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.bg-surface {
    background: var(--color-bg-subtle);
}

.w-full {
    width: 100%;
}

/* Success/error backgrounds with transparency */
.bg-success\/10 {
    background: rgba(52, 211, 153, 0.1);
}

.bg-error\/10 {
    background: rgba(248, 113, 113, 0.1);
}

.bg-warning\/10 {
    background: rgba(251, 191, 36, 0.1);
}

.text-success {
    color: var(--color-success);
}

.text-error {
    color: var(--color-error);
}

.text-warning {
    color: var(--color-warning);
}

/* Athlete Search Modal */
.athlete-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.athlete-search-item:hover {
    background: var(--color-bg-hover);
}

.athlete-search-item + .athlete-search-item {
    border-top: 1px solid var(--color-border-subtle);
}

.athlete-search-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--color-bg-subtle);
}

/* Epreuve slot buttons */
.epreuve-athlete-slot {
    cursor: pointer;
}

.epreuve-athlete-slot .btn-icon {
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.epreuve-athlete-slot:hover .btn-icon {
    opacity: 1;
}

.epreuve-athlete-slot.empty {
    border: 1px dashed var(--color-border-default);
    border-radius: var(--radius-md);
    justify-content: space-between;
}

.epreuve-athlete-slot.empty:hover {
    border-color: var(--color-accent-blue);
    background: var(--color-accent-blue-bg);
}

.badge-sm {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--color-warning-bg);
    color: var(--color-warning);
}
