/**
 * ROI Theme Admin Dashboard - Improved Version
 * Basado en improved-panel.css del Design System
 */

/* ================================================
   CSS VARIABLES - DESIGN SYSTEM
   ================================================ */

:root {
    /* Navy Colors */
    --roi-navy-dark: #0E2337;
    --roi-navy-primary: #1e3a5f;
    --roi-navy-light: #2c5282;

    /* Orange Colors */
    --roi-orange-primary: #FF8600;
    --roi-orange-hover: #FF6B35;
    --roi-orange-light: #FFB800;

    /* Neutral Colors */
    --roi-neutral-50: #f8f9fa;
    --roi-neutral-100: #e9ecef;
    --roi-neutral-600: #495057;
    --roi-neutral-700: #6c757d;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.15);
    --shadow-orange: 0 6px 20px rgba(255, 134, 0, 0.15);

    /* Transitions */
    --transition-base: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================
   WORDPRESS ADMIN OVERRIDES
   ================================================ */

/* Sobrescribir max-width de .card de WordPress */
.wrap.roi-admin-panel .card {
    max-width: none !important;
}

/* Fix para switches de Bootstrap */
.wrap.roi-admin-panel .form-switch .form-check-input {
    all: unset !important;
    width: 2em !important;
    height: 1em !important;
    margin-left: -2.5em !important;
    margin-right: 0.5em !important;
    background-color: #dee2e6 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='white'/%3e%3c/svg%3e") !important;
    background-position: left center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
    border: 1px solid rgba(0, 0, 0, 0.25) !important;
    border-radius: 2em !important;
    transition: background-position 0.15s ease-in-out !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

.wrap.roi-admin-panel .form-switch .form-check-input:checked {
    background-color: #0d6efd !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='white'/%3e%3c/svg%3e") !important;
    background-position: right center !important;
    border-color: #0d6efd !important;
}

.wrap.roi-admin-panel .form-switch .form-check-input::before,
.wrap.roi-admin-panel .form-switch .form-check-input::after {
    display: none !important;
    content: none !important;
}

.wrap.roi-admin-panel .form-switch .form-check-input:focus {
    outline: 0 !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.wrap.roi-admin-panel .form-check {
    display: flex !important;
    align-items: center !important;
}

.wrap.roi-admin-panel .form-check-label {
    display: inline-flex !important;
    align-items: center !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
}

/* ================================================
   TABS NAVIGATION (Legacy)
   ================================================ */

.nav-tabs-admin {
    border-bottom: 2px solid #e9ecef;
}

.nav-tabs-admin .nav-item {
    margin-right: 0.1rem;
}

.nav-tabs-admin .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.3rem 0.3rem;
    font-weight: 600;
    font-size: 0.83rem;
    transition: all 0.3s ease;
}

.nav-tabs-admin .nav-link i.bi {
    margin-right: 0.2rem !important;
    font-size: 0.7rem;
}

.nav-tabs-admin .nav-link:hover {
    color: #FF8600;
    border-bottom-color: #FFB800;
}

.nav-tabs-admin .nav-link.active {
    color: #FF8600;
    border-bottom-color: #FF8600;
    background-color: transparent;
}

/* Tab Content */
.tab-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   HEADER MEJORADO
   ================================================ */

.roi-home-header {
    position: relative;
    padding: 2.5rem 2rem;
    background: var(--roi-navy-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: none;
    margin-bottom: 2.5rem;
}

/* Patrón de fondo sutil */
.roi-home-header__pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 134, 0, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(44, 82, 130, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.roi-home-header__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.roi-home-header__icon-wrapper {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--roi-orange-primary), var(--roi-orange-light));
    border-radius: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(255, 134, 0, 0.3);
}

.roi-home-header__icon {
    font-size: 2rem;
    color: white;
}

.roi-home-header__text {
    flex: 1;
}

.roi-home-header__title {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.roi-home-header__subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 400;
}

/* ================================================
   GRID DE GRUPOS
   ================================================ */

.roi-groups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

@media (max-width: 991px) {
    .roi-groups-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ================================================
   GROUP CARDS MEJORADOS
   ================================================ */

.roi-group-card {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--roi-neutral-100);
    transition: var(--transition-base);
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Efecto glow en hover */
.roi-group-card__glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 0 0 1px var(--roi-orange-primary);
}

.roi-group-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--roi-orange-primary);
}

.roi-group-card:hover .roi-group-card__glow {
    opacity: 0.3;
}

/* Header del grupo */
.roi-group-card__header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--roi-neutral-50);
}

.roi-group-card__icon-wrapper {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 134, 0, 0.1);
    border-radius: 12px;
    flex-shrink: 0;
    transition: var(--transition-base);
}

.roi-group-card:hover .roi-group-card__icon-wrapper {
    background: rgba(255, 134, 0, 0.15);
    transform: scale(1.05);
}

.roi-group-card__icon {
    font-size: 1.75rem;
    color: var(--roi-orange-primary);
}

.roi-group-card__header-text {
    flex: 1;
}

.roi-group-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.35rem 0;
    color: var(--roi-navy-primary);
    line-height: 1.3;
}

.roi-group-card__description {
    font-size: 0.9rem;
    margin: 0;
    color: var(--roi-neutral-700);
    line-height: 1.5;
}

/* ================================================
   COMPONENTS GRID
   ================================================ */

.roi-components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

/* ================================================
   MINI CARDS MEJORADOS
   ================================================ */

.roi-component-minicard {
    position: relative;
    background: white;
    border: 1px solid var(--roi-neutral-100);
    border-radius: 10px;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    text-align: center;
    overflow: hidden;
}

.roi-component-minicard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--roi-orange-primary), var(--roi-orange-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.roi-component-minicard:hover::before {
    transform: scaleX(1);
}

.roi-component-minicard:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-orange);
    border-color: var(--roi-orange-primary);
}

.roi-component-minicard:active {
    transform: translateY(-2px) scale(0.98);
}

.roi-component-minicard:focus {
    outline: 2px solid var(--roi-orange-primary);
    outline-offset: 3px;
}

/* Icono del mini card */
.roi-component-minicard__icon-bg {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 134, 0, 0.08);
    border-radius: 10px;
    transition: var(--transition-base);
}

.roi-component-minicard:hover .roi-component-minicard__icon-bg {
    background: rgba(255, 134, 0, 0.15);
    transform: scale(1.1) rotate(5deg);
}

.roi-component-minicard__icon {
    font-size: 1.5rem;
    color: var(--roi-orange-primary);
}

.roi-component-minicard__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--roi-navy-dark);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.roi-component-minicard:hover .roi-component-minicard__label {
    color: var(--roi-orange-primary);
}

/* ================================================
   BREADCRUMB
   ================================================ */

.roi-breadcrumb {
    padding: 1rem 1.5rem;
    background: var(--roi-neutral-50);
    border-radius: 8px;
    border-left: 4px solid var(--roi-orange-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.roi-breadcrumb__nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.roi-breadcrumb__separator {
    color: var(--roi-neutral-700);
}

.roi-breadcrumb__group {
    color: var(--roi-neutral-700);
    font-size: 0.9rem;
}

.roi-breadcrumb__current {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--roi-navy-primary);
}

/* Botón Volver */
.roi-back-to-home {
    border-color: var(--roi-navy-primary);
    color: var(--roi-navy-primary);
}

.roi-back-to-home:hover {
    background-color: var(--roi-navy-primary);
    border-color: var(--roi-navy-primary);
    color: white;
}

/* ================================================
   COMPONENT FORM CONTAINER
   ================================================ */

.roi-component-form-container {
    animation: fadeIn 0.3s ease-in;
}

/* ================================================
   ANIMATIONS
   ================================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#roi-home-view,
#roi-component-view {
    animation: fadeIn 0.4s ease-in;
}

/* ================================================
   UTILITY CLASSES
   ================================================ */

.roi-hidden {
    display: none !important;
}

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 991px) {
    .roi-group-card {
        padding: 1.5rem;
    }

    .roi-home-header {
        padding: 2rem 1.5rem;
    }

    .roi-home-header__icon-wrapper {
        width: 56px;
        height: 56px;
    }

    .roi-home-header__icon {
        font-size: 1.75rem;
    }

    .roi-home-header__title {
        font-size: 1.5rem;
    }

    .nav-tabs-admin {
        flex-wrap: wrap;
    }

    .nav-tabs-admin .nav-link {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .roi-home-header__content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .roi-components-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .roi-component-minicard {
        padding: 1rem 0.75rem;
    }

    .roi-component-minicard__icon-bg {
        width: 40px;
        height: 40px;
    }

    .roi-component-minicard__icon {
        font-size: 1.25rem;
    }

    .roi-group-card__icon-wrapper {
        width: 44px;
        height: 44px;
    }

    .roi-group-card__icon {
        font-size: 1.5rem;
    }

    .nav-tabs-admin {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .nav-tabs-admin .nav-item {
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    .roi-groups-grid {
        gap: 1rem;
    }

    .roi-home-header {
        padding: 1.5rem 1rem;
    }

    .roi-home-header__title {
        font-size: 1.3rem;
    }

    .roi-home-header__subtitle {
        font-size: 0.875rem;
    }

    .roi-group-card {
        padding: 1.25rem;
    }

    .roi-group-card__title {
        font-size: 1.1rem;
    }

    .roi-components-grid {
        grid-template-columns: 1fr;
    }

    .roi-component-minicard {
        flex-direction: row;
        text-align: left;
        padding: 1rem;
    }
}
