/**
 * Componentes CSS - NewVitec360
 * Componentes reutilizables
 */

/* ===== BOTONES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: 1;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-gradient-hover);
    box-shadow: var(--shadow-primary);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--neutral-700);
    border: var(--border-width) solid var(--neutral-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--neutral-50);
    border-color: var(--neutral-400);
}

.btn-ghost {
    background: transparent;
    color: var(--neutral-600);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--neutral-100);
    color: var(--neutral-900);
}

.btn-danger {
    background: var(--error-500);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--error-600);
}

.btn-success {
    background: var(--success-500);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-600);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
}

.btn-icon {
    padding: var(--space-2);
    width: 40px;
    height: 40px;
}

.btn-block {
    width: 100%;
}

/* ===== CARDS PREMIUM ===== */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.01) 0%, transparent 100%);
}

.card-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--neutral-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    background: var(--neutral-50);
}

/* ===== STAT CARDS PREMIUM ===== */
.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.stat-card:hover {
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: var(--space-4);
    position: relative;
    transition: all 0.25s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.08);
}

.stat-card .stat-icon.primary {
    background: linear-gradient(135deg, rgba(247, 148, 29, 0.15) 0%, rgba(247, 148, 29, 0.05) 100%);
    color: var(--primary-600);
    box-shadow: 0 4px 12px rgba(247, 148, 29, 0.15);
}

.stat-card .stat-icon.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
    color: var(--success-600);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}

.stat-card .stat-icon.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
    color: var(--warning-600);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.stat-card .stat-icon.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    color: var(--info-600);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.stat-card .stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--neutral-900);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    font-size: var(--text-sm);
    color: var(--neutral-500);
    margin-top: var(--space-2);
    font-weight: var(--font-medium);
}

/* ===== FORMULARIOS ===== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--neutral-700);
    margin-bottom: var(--space-2);
}

.form-label.required::after {
    content: ' *';
    color: var(--error-500);
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    color: var(--neutral-900);
    background: white;
    border: var(--border-width) solid var(--neutral-300);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(247, 148, 29, 0.15);
}

.form-control:disabled {
    background: var(--neutral-100);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--error-500);
}

.form-control::placeholder {
    color: var(--neutral-400);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23737373'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-text {
    font-size: var(--text-sm);
    color: var(--neutral-500);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-sm);
    color: var(--error-500);
    margin-top: var(--space-1);
}

/* Checkbox y Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-500);
    cursor: pointer;
}

/* Input group */
.input-group {
    display: flex;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
    background: var(--neutral-100);
    border: var(--border-width) solid var(--neutral-300);
    color: var(--neutral-600);
    font-size: var(--text-sm);
}

/* ===== TABLAS ===== */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    vertical-align: middle;
}

.table th {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--neutral-50);
    border-bottom: var(--border-width) solid var(--neutral-200);
}

.table td {
    font-size: var(--text-sm);
    color: var(--neutral-700);
    border-bottom: var(--border-width) solid var(--neutral-100);
}

.table tbody tr:hover {
    background: var(--neutral-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-success {
    background: var(--success-50);
    color: var(--success-600);
}

.badge-warning {
    background: var(--warning-50);
    color: var(--warning-600);
}

.badge-error {
    background: var(--error-50);
    color: var(--error-600);
}

.badge-info {
    background: var(--info-50);
    color: var(--info-600);
}

.badge-neutral {
    background: var(--neutral-100);
    color: var(--neutral-600);
}

/* ===== ALERTAS ===== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.alert-success {
    background: var(--success-50);
    color: var(--success-600);
    border-left: 4px solid var(--success-500);
}

.alert-warning {
    background: var(--warning-50);
    color: var(--warning-600);
    border-left: 4px solid var(--warning-500);
}

.alert-error {
    background: var(--error-50);
    color: var(--error-600);
    border-left: 4px solid var(--error-500);
}

.alert-info {
    background: var(--info-50);
    color: var(--info-600);
    border-left: 4px solid var(--info-500);
}

/* ===== AVATAR ===== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-xs);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-lg);
}

/* ===== DROPDOWN PREMIUM ===== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    min-width: 220px;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: var(--space-2) 0;
    overflow: hidden;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: rgba(255, 255, 255, 0.75);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
    margin: 0 var(--space-2);
    border-radius: var(--radius-lg);
}

.dropdown-item .material-icons-round {
    font-size: 20px;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.dropdown-item:hover .material-icons-round {
    color: var(--primary-400);
    text-shadow: 0 0 10px rgba(247, 148, 29, 0.4);
}

/* Danger item (Cerrar Sesión) */
.dropdown-item[style*="error"],
.dropdown-item.danger {
    color: rgba(239, 68, 68, 0.9) !important;
}

.dropdown-item[style*="error"]:hover,
.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444 !important;
}

.dropdown-item[style*="error"]:hover .material-icons-round,
.dropdown-item.danger:hover .material-icons-round {
    color: #ef4444 !important;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 20%,
            rgba(255, 255, 255, 0.1) 80%,
            transparent 100%);
    margin: var(--space-2) var(--space-4);
}

/* ===== MODAL ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    padding: var(--space-5);
    border-bottom: var(--border-width) solid var(--neutral-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--neutral-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--neutral-600);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: var(--border-width) solid var(--neutral-100);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    font-size: 64px;
    color: var(--neutral-300);
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--neutral-700);
    margin-bottom: var(--space-2);
}

.empty-state-text {
    color: var(--neutral-500);
    margin-bottom: var(--space-6);
}

/* ===== LOADING ===== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--neutral-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-item {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    color: var(--neutral-600);
    background: white;
    border: var(--border-width) solid var(--neutral-200);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.pagination-item:hover {
    background: var(--neutral-50);
    border-color: var(--neutral-300);
}

.pagination-item.active {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
}

.pagination-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== SEARCH ===== */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 44px;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-400);
    pointer-events: none;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    min-width: 300px;
    padding: var(--space-4);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 4px solid var(--success-500);
}

.toast-error {
    border-left: 4px solid var(--error-500);
}

.toast-warning {
    border-left: 4px solid var(--warning-500);
}

.toast-info {
    border-left: 4px solid var(--info-500);
}