/* ==========================================
   COMPONENTS.CSS - Componentes Reutilizáveis
   Sistema: Equiparação Hospitalar
   ========================================== */

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: var(--font-semibold);
    line-height: 1;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    text-align: center;
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tamanhos de Botão */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    gap: 0.375rem;
}

.btn-md, .btn {
    padding: 0.75rem 1.5rem;
    font-size: var(--text-base);
    gap: 0.5rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--text-lg);
    gap: 0.625rem;
}

/* Variações de Botão */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-quaternary);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary);
    color: var(--text-white);
}

.btn-ghost {
    background-color: transparent;
    color: var(--primary);
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--primary-50);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--text-white);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-dark);
}

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

.btn-success:hover:not(:disabled) {
    background-color: var(--success-dark);
}

/* Botão de largura total */
.btn-block {
    width: 100%;
    display: flex;
}

/* ==================== CARDS ==================== */
.card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(4, 120, 87, 0.15);
}

.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
}

.stat-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-card .stat-value {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: var(--primary);
    margin-bottom: var(--spacing-2);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: var(--font-medium);
}

/* Comparison Cards */
.comparison-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-8);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.comparison-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.comparison-card.current::before {
    background: linear-gradient(90deg, #6b7280 0%, #9ca3af 100%);
}

.comparison-card.recommended::before {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
}

.comparison-card .card-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    margin-bottom: var(--spacing-4);
}

.comparison-card.current .card-badge {
    background-color: var(--bg-quaternary);
    color: var(--text-secondary);
}

.comparison-card.recommended .card-badge {
    background-color: var(--primary-100);
    color: var(--primary-dark);
}

/* ==================== BADGES/TAGS ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    line-height: 1;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-primary {
    background-color: var(--primary-100);
    color: var(--primary-dark);
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

.tag-sm {
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
}

.tag-lg {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
}

/* ==================== ALERTS ==================== */
.alert {
    padding: var(--spacing-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-4);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert-info {
    background-color: #dbeafe;
    border-color: var(--info);
    color: #1e40af;
}

.alert .alert-icon {
    flex-shrink: 0;
    font-size: var(--text-xl);
}

.alert .alert-content {
    flex: 1;
}

.alert .alert-title {
    font-weight: var(--font-semibold);
    margin-bottom: var(--spacing-1);
}

.alert .alert-message {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.alert-dismissible {
    padding-right: var(--spacing-8);
    position: relative;
}

.alert-dismissible .alert-close {
    position: absolute;
    top: var(--spacing-4);
    right: var(--spacing-4);
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--text-xl);
    color: inherit;
    opacity: 0.6;
    transition: opacity var(--transition-base);
}

.alert-dismissible .alert-close:hover {
    opacity: 1;
}

/* ==================== MODALS ==================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-4);
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    position: relative;
    z-index: var(--z-modal);
    background-color: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease-out;
}

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

.modal-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-3xl);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

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

.modal-body {
    padding: var(--spacing-6);
}

.modal-footer {
    padding: var(--spacing-6);
    border-top: 1px solid var(--bg-tertiary);
    display: flex;
    gap: var(--spacing-3);
    justify-content: flex-end;
}

/* ==================== PROGRESS BARS ==================== */
.progress {
    width: 100%;
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width var(--transition-slow);
    border-radius: var(--radius-full);
}

.progress-bar.accent {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
}

.progress-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2);
    display: flex;
    justify-content: space-between;
}

/* Progress Circle */
.progress-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: var(--text-3xl);
    font-weight: var(--font-extrabold);
}

.progress-circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* ==================== INPUTS/FORMS ==================== */
.form-group {
    margin-bottom: var(--spacing-6);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    margin-bottom: var(--spacing-2);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 2px solid var(--bg-quaternary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background-color: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--danger);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox e Radio */
.form-checkbox,
.form-radio {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    cursor: pointer;
    font-size: var(--text-base);
    color: var(--text-primary);
    padding: var(--spacing-3);
    border-radius: var(--radius-lg);
    transition: background-color var(--transition-base);
}

.form-check-label:hover {
    background-color: var(--bg-secondary);
}

.form-error {
    display: block;
    margin-top: var(--spacing-2);
    font-size: var(--text-sm);
    color: var(--danger);
}

.form-help {
    display: block;
    margin-top: var(--spacing-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ==================== UPLOAD ZONE ==================== */
.upload-zone {
    border: 2px dashed var(--bg-quaternary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-8);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    background-color: var(--bg-secondary);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background-color: var(--primary-50);
}

.upload-zone .upload-icon {
    font-size: var(--text-6xl);
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-4);
}

.upload-zone .upload-text {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2);
}

.upload-zone .upload-hint {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3);
    margin-top: var(--spacing-4);
}

.upload-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    background-color: var(--bg-primary);
    border: 1px solid var(--bg-quaternary);
    border-radius: var(--radius-lg);
}

.upload-item .file-icon {
    font-size: var(--text-2xl);
    color: var(--primary);
}

.upload-item .file-name {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: var(--font-medium);
}

.upload-item .file-size {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.upload-item .file-remove {
    margin-left: auto;
    padding: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.upload-item .file-remove:hover {
    background-color: var(--bg-tertiary);
    color: var(--danger);
}

/* ==================== TABLES ==================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table thead {
    background-color: var(--bg-secondary);
}

.table th {
    padding: var(--spacing-4);
    text-align: left;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    border-bottom: 2px solid var(--bg-quaternary);
}

.table td {
    padding: var(--spacing-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
}

.table tbody tr {
    transition: background-color var(--transition-base);
}

.table-hover tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table-striped tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

/* ==================== TIMELINE ==================== */
.timeline {
    position: relative;
    padding: var(--spacing-4) 0;
}

.timeline-item {
    position: relative;
    padding-left: 48px;
    padding-bottom: var(--spacing-8);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 32px;
    bottom: -8px;
    width: 2px;
    background-color: var(--bg-quaternary);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--bg-primary);
    border: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    color: var(--primary);
    z-index: 1;
}

.timeline-dot.completed {
    background-color: var(--primary);
    color: var(--text-white);
}

.timeline-content {
    background-color: var(--bg-primary);
    border: 1px solid var(--bg-quaternary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
}

.timeline-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-2);
}

.timeline-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ==================== TOOLTIPS ==================== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::before,
.tooltip::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.tooltip::before {
    content: attr(data-tooltip);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-dark);
    color: var(--text-white);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    white-space: nowrap;
    margin-bottom: 8px;
    z-index: var(--z-tooltip);
}

.tooltip::after {
    content: '';
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-dark);
    margin-bottom: 4px;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* ==================== BREADCRUMBS ==================== */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    margin-left: var(--spacing-2);
    color: var(--text-tertiary);
}

.breadcrumb-item a {
    color: var(--primary);
    transition: color var(--transition-base);
}

.breadcrumb-item a:hover {
    color: var(--primary-dark);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: var(--font-medium);
}

/* ==================== SCORE CIRCLE ==================== */
.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-4xl);
    font-weight: var(--font-extrabold);
    position: relative;
    box-shadow: var(--shadow-xl);
}

.score-high {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--text-white);
}

.score-medium {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
    color: var(--text-white);
}

.score-low {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: var(--text-white);
}

/* ==================== LOADING SPINNER ==================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-quaternary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}
