/* ========================================
   MiniPyme360 - Componentes Reutilizables
   ======================================== */

/* === Tooltips === */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(123, 220, 181, 0.15);
    color: var(--primary-dark, #56b891);
    font-size: 0.75rem;
    cursor: help;
    margin-left: 6px;
    transition: all 0.2s ease;
}

.tooltip-icon:hover {
    background: var(--primary, #7bdcb5);
    color: white;
    transform: scale(1.1);
}

.tooltip-content {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #2d3748;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 250px;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2d3748;
}

.tooltip-wrapper:hover .tooltip-content {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === Breadcrumbs === */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 12px;
}

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

.breadcrumb-item a {
    color: var(--primary-dark, #56b891);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: var(--primary, #7bdcb5);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #ccc;
    user-select: none;
}

.breadcrumb-current {
    color: var(--text, #1f2d3d);
    font-weight: 500;
}

/* === Loading States === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(123, 220, 181, 0.2);
    border-top-color: var(--primary, #7bdcb5);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* === Modales === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(2px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.modal-body {
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* === Badges y Pills === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-primary {
    background: rgba(123, 220, 181, 0.15);
    color: var(--primary-dark, #56b891);
}

.badge-success {
    background: rgba(116, 198, 157, 0.15);
    color: #2d7a4f;
}

.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: #c87d0a;
}

.badge-danger {
    background: rgba(229, 124, 115, 0.15);
    color: #c53030;
}

.badge-info {
    background: rgba(66, 153, 225, 0.15);
    color: #2c5282;
}

.badge-notification {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e57c73;
    color: white;
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* === Botones Mejorados === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

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

.btn-primary {
    background: var(--primary, #7bdcb5);
    color: var(--text, #1f2d3d);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark, #56b891);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 220, 181, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e0;
}

.btn-danger {
    background: #e57c73;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #d65d54;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 124, 115, 0.3);
}

.btn-success {
    background: #74c69d;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #5fb383;
}

.btn-orange {
    background: #FF7A00 !important;
    color: white !important;
    border: none !important;
}

.btn-orange:hover:not(:disabled) {
    background: #FF9A3D !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 122, 0, 0.3);
}



.btn-ghost {
    background: transparent;
    color: var(--primary-dark, #56b891);
    border: 1px solid var(--primary, #7bdcb5);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(123, 220, 181, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* === Notificaciones Toast === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: all;
    transform: translateX(400px);
    animation: slideIn 0.3s ease forwards;
}

.toast.removing {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 0.9rem;
}

.toast-message {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.toast-success {
    border-left: 4px solid #74c69d;
}

.toast-error {
    border-left: 4px solid #e57c73;
}

.toast-warning {
    border-left: 4px solid #f39c12;
}

.toast-info {
    border-left: 4px solid #4299e1;
}

/* === Ayuda Flotante === */
.help-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #7bdcb5), var(--primary-dark, #56b891));
    color: white;
    border: none;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(123, 220, 181, 0.4);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: help-pulse 3s ease-in-out infinite;
}

@keyframes help-pulse {

    0%,
    100% {
        box-shadow: 0 8px 24px rgba(123, 220, 181, 0.4);
    }

    50% {
        box-shadow: 0 8px 32px rgba(123, 220, 181, 0.6);
    }
}

.help-button:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 12px 32px rgba(123, 220, 181, 0.6);
    animation: none;
}

.help-button:active {
    transform: scale(0.95);
}

/* === Utilidades === */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* === Responsive === */
@media (max-width: 768px) {
    .tooltip-content {
        max-width: 200px;
        font-size: 0.75rem;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .toast {
        min-width: auto;
        max-width: calc(100vw - 40px);
    }

    .help-button {
        width: 48px;
        height: 48px;
        bottom: 16px;
        right: 16px;
    }
}