/* ============================================
   PapouBasket PWA - Composants UI
   ============================================ */

/* ============================================
   Boutons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    text-decoration: none;
    gap: 8px;
    min-height: 44px; /* Accessibilité tactile */
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(92, 187, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #3d8bc5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(92, 187, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: rgba(92, 187, 246, 0.1);
    transform: translateY(-2px);
}

.btn-text {
    background: transparent;
    color: var(--text-light);
    padding: 12px 16px;
}

.btn-text:hover {
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.05);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-height: 36px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1rem;
    min-height: 52px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Formulaires
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-white);
    color: var(--text-color);
    transition: all 0.2s ease;
    min-height: 48px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 187, 246, 0.2);
}

.form-input::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

.form-input.error {
    border-color: #dc3545;
}

.form-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 6px;
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Checkbox et Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-check-label {
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
}

/* ============================================
   Cartes
   ============================================ */
.card {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.card-body {
    margin-bottom: 12px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background-color: rgba(92, 187, 246, 0.15);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.badge-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.badge-danger {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.badge-secondary {
    background-color: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

/* ============================================
   Alertes
   ============================================ */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.9rem;
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-left: 4px solid #28a745;
    color: #28a745;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    color: #856404;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid #dc3545;
    color: #dc3545;
}

.alert-info {
    background-color: rgba(92, 187, 246, 0.1);
    border-left: 4px solid var(--primary-color);
    color: var(--primary-color);
}

/* ============================================
   Loading
   ============================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-text {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* ============================================
   Listes
   ============================================ */
.list {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.list-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: rgba(92, 187, 246, 0.05);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(92, 187, 246, 0.1);
    border-radius: var(--radius-sm);
    margin-right: 16px;
    font-size: 1.25rem;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 2px;
}

.list-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-light);
}

.list-item-action {
    color: var(--text-light);
    font-size: 1.25rem;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
    display: flex;
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: var(--shadow-light);
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}

.tab.active {
    background-color: var(--primary-color);
    color: var(--text-white);
}

.tab:hover:not(.active) {
    background-color: rgba(92, 187, 246, 0.1);
    color: var(--primary-color);
}

/* ============================================
   Avatar
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

/* ============================================
   Divider
   ============================================ */
.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}

.divider-with-text {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.divider-with-text::before,
.divider-with-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.divider-text {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, 
        var(--border-color) 25%, 
        rgba(92, 187, 246, 0.1) 50%, 
        var(--border-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
}