/* ===== ESTILOS BASE PARA EL COMPONENTE ICON ===== */

.icon-component {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    transition: all 0.2s ease-in-out;
    user-select: none;
}

/* ===== TAMAÑOS DE ICONOS ===== */

.icon-xs {
    width: 12px;
    height: 12px;
    font-size: 12px;
}

.icon-sm {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.icon-md {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.icon-lg {
    width: 24px;
    height: 24px;
    font-size: 24px;
}

.icon-xl {
    width: 32px;
    height: 32px;
    font-size: 32px;
}

.icon-2x {
    width: 40px;
    height: 40px;
    font-size: 40px;
}

.icon-3x {
    width: 60px;
    height: 60px;
    font-size: 60px;
}

/* ===== VARIANTES DE COLOR ===== */

.icon-default {
    color: #374151;
}

.icon-primary {
    color: #3b82f6;
}

.icon-secondary {
    color: #6b7280;
}

.icon-success {
    color: #10b981;
}

.icon-warning {
    color: #f59e0b;
}

.icon-error {
    color: #ef4444;
}

.icon-info {
    color: #3b82f6;
}

.icon-muted {
    color: #9ca3af;
    opacity: 0.7;
}

.icon-inverse {
    color: #ffffff;
}

/* ===== ESTADOS ===== */

.icon-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.icon-loading {
    animation: iconSpin 1s linear infinite;
}

@keyframes iconSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== TIPOS DE ICONOS ===== */

/* FontAwesome Icons */
.icon-fontawesome {
    display: inline-block;
}

/* SVG Icons */
.icon-svg-custom,
.icon-svg-data {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-svg-custom svg,
.icon-svg-data {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Image Icons */
.icon-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Emoji Icons */
.icon-emoji {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

/* Unicode Icons */
.icon-unicode {
    font-family: 'Segoe UI Symbol', 'Symbola', sans-serif;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

/* Default fallback icon */
.icon-default {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
}

/* ===== EFECTOS INTERACTIVOS ===== */

.icon-component:not(.icon-disabled) {
    cursor: pointer;
}

.icon-component:not(.icon-disabled):hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.icon-component:not(.icon-disabled):active {
    transform: scale(0.95);
}

/* Efecto de brillo para iconos interactivos */
.icon-component:not(.icon-disabled):hover.icon-primary {
    color: #2563eb;
    filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.4));
}

.icon-component:not(.icon-disabled):hover.icon-success {
    color: #059669;
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.4));
}

.icon-component:not(.icon-disabled):hover.icon-warning {
    color: #d97706;
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.4));
}

.icon-component:not(.icon-disabled):hover.icon-error {
    color: #dc2626;
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.4));
}

/* ===== ANIMACIONES ESPECIALES ===== */

/* Pulso para iconos de notificación */
.icon-pulse {
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Rebote para iconos de éxito */
.icon-bounce {
    animation: iconBounce 0.6s ease-in-out;
}

@keyframes iconBounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* Shake para iconos de error */
.icon-shake {
    animation: iconShake 0.6s ease-in-out;
}

@keyframes iconShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(2px);
    }
}

/* ===== MODO OSCURO ===== */

@media (prefers-color-scheme: dark) {
    .icon-default {
        color: #f3f4f6;
    }

    .icon-muted {
        color: #6b7280;
    }

    .icon-inverse {
        color: #111827;
    }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 640px) {
    .icon-3x {
        width: 48px;
        height: 48px;
        font-size: 48px;
    }

    .icon-2x {
        width: 32px;
        height: 32px;
        font-size: 32px;
    }
}

/* ===== ACCESIBILIDAD ===== */

@media (prefers-reduced-motion: reduce) {
    .icon-component,
    .icon-loading,
    .icon-pulse,
    .icon-bounce,
    .icon-shake {
        animation: none !important;
        transition: none !important;
    }

    .icon-component:hover {
        transform: none !important;
    }
}

/* Focus para navegación por teclado */
.icon-component:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 2px;
}

.icon-component:focus:not(:focus-visible) {
    outline: none;
}

/* ===== GRUPOS DE ICONOS ===== */

.icon-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-group .icon-component {
    flex-shrink: 0;
}

/* ===== ICONOS EN BOTONES ===== */

.btn .icon-component {
    margin-right: 0.5rem;
}

.btn .icon-component:last-child {
    margin-right: 0;
    margin-left: 0.5rem;
}

.btn .icon-component:only-child {
    margin: 0;
}

/* ===== ICONOS EN BADGES ===== */

.badge .icon-component {
    width: 0.875rem;
    height: 0.875rem;
    font-size: 0.875rem;
}

/* ===== PRINT STYLES ===== */

@media print {
    .icon-component {
        color: #000 !important;
        filter: none !important;
        transform: none !important;
    }

    .icon-loading {
        display: none;
    }
}

/* ===== UTILIDADES ===== */

.icon-rotate-90 {
    transform: rotate(90deg);
}

.icon-rotate-180 {
    transform: rotate(180deg);
}

.icon-rotate-270 {
    transform: rotate(270deg);
}

.icon-flip-horizontal {
    transform: scaleX(-1);
}

.icon-flip-vertical {
    transform: scaleY(-1);
}

/* ===== ESTADOS DE CARGA ===== */

.icon-loading-container {
    position: relative;
    display: inline-flex;
}

.icon-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: inherit;
}

/* ===== TOOLTIPS PARA ICONOS ===== */

.icon-component[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.25rem;
}

.icon-component[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}
