/**
 * Modern Tag Styling - Unified across all views
 * v268 - Cantos arredondados, design moderno, consistência visual
 */

/* ========================================
   BASE TAG STYLES
   ======================================== */

.tag-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.813rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    border-radius: 1rem; /* Cantos bem arredondados */
    margin: 0.15rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    cursor: default;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-badge:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   SIZE VARIATIONS
   ======================================== */

.tag-badge-xs {
    font-size: 0.688rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.75rem;
}

.tag-badge-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 0.875rem;
}

.tag-badge-lg {
    font-size: 0.938rem;
    padding: 0.45rem 0.9rem;
    border-radius: 1.25rem;
}

.tag-badge-xl {
    font-size: 1.063rem;
    padding: 0.55rem 1.1rem;
    border-radius: 1.5rem;
}

/* ========================================
   REMOVABLE/CLICKABLE TAGS
   ======================================== */

.tag-badge-removable,
.tag-badge-clickable {
    cursor: pointer;
    padding-right: 2rem;
    position: relative;
}

.tag-badge-removable::after {
    content: '×';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.tag-badge-removable:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
}

.tag-badge-clickable:hover {
    filter: brightness(1.1);
}

/* ========================================
   TAG OPTIONS (Form Selection)
   ======================================== */

.tag-option {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 1.25rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    /* Background definido inline via style attribute */
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    font-size: 0.875rem;
    -webkit-user-select: none;
    user-select: none;
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.tag-option:hover {
    transform: translateY(-2px) scale(1.03);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tag-option.selected {
    border-color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.tag-option input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================
   TAG SUGGESTIONS (AI)
   ======================================== */

.tag-suggestion {
    position: relative;
    animation: fadeInScale 0.3s ease-out;
    border: 2px dashed rgba(255, 255, 255, 0.4);
}

.tag-suggestion.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.tag-suggestion.tag-added {
    background-color: #48bb78 !important;
    animation: fadeOut 1.5s forwards;
}

.tag-suggestion::before {
    content: '✨';
    position: absolute;
    left: -8px;
    top: -8px;
    font-size: 0.75rem;
    animation: sparkle 1.5s infinite;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; transform: scale(0.8); }
}

/* ========================================
   TAG CONTAINERS
   ======================================== */

.tag-list-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    max-width: 100%;
}

.tag-selector-body {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 60px;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.75rem;
    align-items: flex-start;
}

#availableTagsContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid #e9ecef;
}

/* ========================================
   TAG COUNTER
   ======================================== */

.tag-more-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-radius: 1rem;
    margin-left: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.tag-more-counter:hover {
    background: linear-gradient(135deg, #dee2e6 0%, #ced4da 100%);
    transform: scale(1.05);
}

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

@media (max-width: 768px) {
    .tag-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.65rem;
        border-radius: 0.875rem;
    }
    
    .tag-option {
        font-size: 0.813rem;
        padding: 0.4rem 0.75rem;
    }
    
    #availableTagsContainer {
        max-height: 200px;
    }
}

/* ========================================
   TAG SELECTOR ENHANCEMENTS
   ======================================== */

.tag-selector {
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    padding: 1rem;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tag-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e9ecef;
}

.tag-selector-title {
    font-weight: 600;
    font-size: 1rem;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-selector-empty {
    color: #6c757d;
    font-style: italic;
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
}

/* ========================================
   TAG FILTER PANEL
   ======================================== */

.tag-filter-panel {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tag-filter-selected {
    min-height: 45px;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    border: 1px dashed #dee2e6;
}

.tag-filter-available {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 0.5rem;
}

/* ========================================
   TAG CLOUD (Dashboard)
   ======================================== */

.tag-cloud-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.tag-cloud-item:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

/* Tag cloud size classes */
.tag-cloud-item.size-xs { font-size: 0.75rem; padding: 0.5rem 0.9rem; }
.tag-cloud-item.size-sm { font-size: 0.875rem; padding: 0.6rem 1rem; }
.tag-cloud-item.size-md { font-size: 1rem; padding: 0.75rem 1.25rem; }
.tag-cloud-item.size-lg { font-size: 1.25rem; padding: 0.9rem 1.5rem; }
.tag-cloud-item.size-xl { font-size: 1.5rem; padding: 1.1rem 1.75rem; }

/* ========================================
   ACCORDION VIEW SPECIFIC
   ======================================== */

.lancamento-accordion-body .tag-badge {
    margin: 0.2rem;
}

/* ========================================
   UTILITIES
   ======================================== */

.tag-selector-actions .btn {
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.tag-selector-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
