/* ================================
   GÉNÉRAL
   ================================ */

.tag-badge {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4em 0.8em;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.tag-badge-lg {
    font-size: 0.9rem;
    padding: 0.5em 1em;
}

.tag-badge-sm {
    font-size: 0.7rem;
    padding: 0.3em 0.6em;
}

/* ================================
   COLOR PICKER
   ================================ */

.color-preset {
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 0.375rem;
    position: relative;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.color-preset.active {
    border-color: var(--bs-primary) !important;
    border-width: 3px !important;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.color-preset.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

.color-preview {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

.badge-preview {
    min-width: 80px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.form-control-color {
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control-color:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ================================
   LISTE DES TAGS
   ================================ */

.tags-list-container .table th {
    background-color: var(--bs-dark);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
}

.tags-list-container .table td {
    vertical-align: middle;
    border-color: #f8f9fa;
}

.tags-list-container .table tbody tr:hover {
    background-color: #f8f9fa;
}

.status-toggle {
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-toggle:hover {
    transform: scale(1.1);
}

.status-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ================================
   AUTOCOMPLÉTION
   ================================ */

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: white;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    display: none;
}

.tag-suggestions .list-group-item {
    border: none;
    border-bottom: 1px solid #f8f9fa;
    padding: 0.75rem 1rem;
}

.tag-suggestions .list-group-item:last-child {
    border-bottom: none;
}

.tag-suggestions .list-group-item:hover {
    background-color: #f8f9fa;
}

.tag-suggestions .list-group-item.active {
    background-color: var(--bs-primary);
    color: white;
}

/* ================================
   FORMULAIRES
   ================================ */

.tag-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.tag-form .form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

.tag-form .invalid-feedback {
    font-size: 0.875rem;
}

.tag-form #slug-preview {
    font-weight: 500;
    color: var(--bs-primary);
    background-color: #f8f9fa;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.description-counter {
    font-size: 0.8rem;
    font-weight: 500;
}

.description-counter.text-warning {
    color: #f59e0b !important;
}

.description-counter.text-danger {
    color: #dc2626 !important;
}

/* ================================
   PAGES DE DÉTAIL
   ================================ */

.tag-detail-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

.tag-stats .border-end {
    border-color: #dee2e6 !important;
}

.tag-stats h4 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tag-stats small {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================
   SIDEBAR ACTIONS
   ================================ */

.actions-sidebar .card {
    border: 1px solid #e3e6f0;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.actions-sidebar .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e3e6f0;
}

.actions-sidebar .card-header h6 {
    color: #5a5c69;
    font-weight: 600;
}

.actions-sidebar .btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .color-preset {
        width: 35px !important;
        height: 35px !important;
    }
    
    .badge-preview {
        min-width: 60px;
        font-size: 0.8rem;
    }
    
    .tag-badge {
        font-size: 0.7rem;
        padding: 0.3em 0.6em;
    }
    
    .actions-sidebar {
        margin-top: 2rem;
    }
    
    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .table-responsive table {
        font-size: 0.85rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .color-preview {
        width: 30px !important;
        height: 30px !important;
    }
    
    .form-control-color {
        width: 50px !important;
        height: 35px !important;
    }
}

/* ================================
   ANIMATIONS
   ================================ */

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   ÉTATS ET FEEDBACK
   ================================ */

.tag-item-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.tag-item-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--bs-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tag-empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: #6c757d;
}

.tag-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.tag-empty-state h5 {
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ================================
   UTILITAIRES
   ================================ */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.user-select-none {
    user-select: none;
}