/* 
 * Archivo: elementor-widgets.css
 * Estilos para widgets personalizados de Elementor
 * 
 * Este archivo debe colocarse en: /wp-content/plugins/ebooks-premium-manager/assets/css/
 */

/* Variables CSS */
:root {
    --epm-primary: #deb156;
    --epm-dark: #000000;
    --epm-light: #ffffff;
    --epm-gray: #666666;
    --epm-border: #e1e1e1;
    --epm-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --epm-transition: all 0.3s ease;
}

/* Estilos Generales para Widgets EPM */
.epm-cart-widget,
.epm-user-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

/* =================
   WIDGET DE CARRITO
   ================= */

.epm-cart-widget {
    display: inline-block;
    position: relative;
}

.epm-cart-link {
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    position: relative;
    transition: var(--epm-transition);
}

.epm-cart-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.epm-cart-icon {
    font-size: 24px;
    color: var(--epm-primary);
    transition: var(--epm-transition);
    display: inline-block;
}

.epm-cart-link:hover .epm-cart-icon {
    transform: scale(1.1);
    color: var(--epm-primary);
}

.epm-cart-count {
    background: #e74c3c;
    color: var(--epm-light);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    animation: epm-bounce-in 0.3s ease;
}

.epm-cart-style-icon_text .epm-cart-count,
.epm-cart-style-button .epm-cart-count {
    position: relative;
    top: auto;
    right: auto;
    margin-left: 5px;
}

.epm-cart-text {
    color: inherit;
    font-weight: 500;
    text-decoration: none;
}

.epm-cart-total {
    font-weight: bold;
    color: var(--epm-primary);
    margin-left: 5px;
    white-space: nowrap;
}

.epm-cart-button {
    background: var(--epm-primary);
    color: var(--epm-dark);
    border: none;
    padding: 10px 18px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--epm-transition);
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
}

.epm-cart-button:hover {
    background: #c5a049;
    transform: translateY(-2px);
    box-shadow: var(--epm-shadow);
    color: var(--epm-dark);
}

/* ===================
   WIDGET DE USUARIO
   =================== */

.epm-user-widget {
    position: relative;
    display: inline-block;
}

.epm-user-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.epm-user-icon {
    font-size: 20px;
    color: var(--epm-gray);
}

.epm-login-link {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    transition: var(--epm-transition);
}

.epm-login-link:hover {
    color: var(--epm-primary);
}

.epm-login-button, 
.epm-user-button {
    background: var(--epm-primary);
    color: var(--epm-dark);
    border: none;
    padding: 10px 18px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--epm-transition);
    display: inline-block;
    font-family: inherit;
    font-size: 14px;
}

.epm-login-button:hover, 
.epm-user-button:hover {
    background: #c5a049;
    transform: translateY(-2px);
    box-shadow: var(--epm-shadow);
    color: var(--epm-dark);
}

/* Dropdown Styles */
.epm-user-dropdown {
    position: relative;
}

.epm-user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: var(--epm-transition);
    user-select: none;
}

.epm-user-trigger:hover {
    background: rgba(222, 177, 86, 0.1);
}

.epm-user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--epm-dark);
}

.epm-dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
    color: var(--epm-gray);
}

.epm-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: var(--epm-light);
    border: 1px solid var(--epm-border);
    border-radius: 8px;
    box-shadow: var(--epm-shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--epm-transition);
    z-index: 1000;
    overflow: hidden;
}

.epm-user-dropdown:hover .epm-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.epm-user-dropdown:hover .epm-dropdown-arrow {
    transform: rotate(180deg);
}

.epm-dropdown-item {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--epm-dark);
    transition: var(--epm-transition);
    font-size: 14px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.epm-dropdown-item:hover {
    background: #f8f8f8;
    color: var(--epm-dark);
}

.epm-dropdown-item.epm-logout {
    color: #e74c3c;
}

.epm-dropdown-item.emp-logout:hover {
    background: #fee;
    color: #c0392b;
}

.epm-dropdown-divider {
    height: 1px;
    background: var(--epm-border);
    margin: 8px 0;
}

/* Avatar Style */
.epm-user-avatar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.epm-user-avatar {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    border: 2px solid var(--epm-border);
    transition: var(--epm-transition);
}

.epm-user-avatar:hover {
    border-color: var(--epm-primary);
}

.epm-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.epm-user-links {
    display: flex;
    gap: 12px;
}

.epm-user-links a {
    font-size: 12px;
    text-decoration: none;
    color: var(--epm-gray);
    transition: var(--epm-transition);
    font-weight: 500;
}

.epm-user-links a:hover {
    color: var(--epm-primary);
}

/* Animaciones */
@keyframes epm-bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Estados de Loading */
.epm-cart-widget.loading .epm-cart-icon,
.epm-user-widget.loading .epm-user-icon {
    animation: epm-spin 1s linear infinite;
}

@keyframes epm-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .epm-dropdown-menu {
        right: auto;
        left: 0;
        min-width: 180px;
    }
    
    .epm-user-links {
        flex-direction: column;
        gap: 6px;
    }
    
    .epm-cart-button,
    .epm-login-button,
    .epm-user-button {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .epm-user-avatar-container {
        gap: 8px;
    }
    
    .epm-user-avatar {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .epm-cart-text,
    .epm-user-name {
        display: none;
    }
    
    .epm-cart-button {
        padding: 8px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
    
    .epm-cart-button .epm-cart-text {
        display: none;
    }
    
    .emp-dropdown-menu {
        font-size: 13px;
    }
}

/* Tema Oscuro */
@media (prefers-color-scheme: dark) {
    .epm-dropdown-menu {
        background: #2a2a2a;
        border-color: #444;
        color: var(--epm-light);
    }
    
    .epm-dropdown-item {
        color: var(--epm-light);
    }
    
    .epm-dropdown-item:hover {
        background: #3a3a3a;
    }
    
    .epm-user-trigger:hover {
        background: rgba(222, 177, 86, 0.2);
    }
}