/* ═══════════════════════════════════════════════════════════════
   ENTERPRISE COMPONENTS — Premium UI Library
   Modals, Drawers, Tooltips, Dropdowns, Tabs, Accordions, Steppers
   ═══════════════════════════════════════════════════════════════ */

/* ─────────── PREMIUM MODAL ─────────── */
.e-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.85);
    -webkit-backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    backdrop-filter: blur(var(--blur-md));
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-5);
    animation: e-fadeIn 0.25s var(--ease-smooth);
}

.e-modal {
    background: linear-gradient(180deg, rgba(30,41,59,0.95), rgba(15,23,42,0.98));
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--r-2xl);
    padding: var(--sp-8);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--sh-2xl), inset 0 1px 0 rgba(255,255,255,0.05);
    animation: e-modalIn 0.35s var(--ease-spring);
    position: relative;
    z-index: var(--z-modal);
}

.e-modal-lg { max-width: 640px; }
.e-modal-xl { max-width: 900px; }
.e-modal-full { max-width: 90vw; }

.e-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.e-modal-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-extrabold);
    color: var(--c-neutral-100);
    letter-spacing: var(--ls-tight);
    margin: 0;
}

.e-modal-subtitle {
    font-size: var(--fs-sm);
    color: var(--c-neutral-400);
    margin: var(--sp-1) 0 0;
}

.e-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.1);
    border: none;
    color: var(--c-neutral-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-fast);
    flex-shrink: 0;
}

.e-modal-close:hover {
    background: var(--c-danger);
    color: white;
    transform: rotate(90deg);
}

.e-modal-body {
    margin-bottom: var(--sp-6);
}

.e-modal-footer {
    display: flex;
    gap: var(--sp-3);
    justify-content: flex-end;
    padding-top: var(--sp-5);
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

@keyframes e-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes e-modalIn {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─────────── PREMIUM DRAWER ─────────── */
.e-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.85);
    -webkit-backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    backdrop-filter: blur(var(--blur-md));
    z-index: var(--z-modal-backdrop);
    animation: e-fadeIn 0.25s var(--ease-smooth);
}

.e-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: linear-gradient(180deg, #0F172A, #050810);
    border: 1px solid rgba(148, 163, 184, 0.15);
    display: flex;
    flex-direction: column;
    z-index: var(--z-modal);
    box-shadow: var(--sh-2xl);
}

.e-drawer-right {
    right: 0;
    animation: e-slideInRight 0.4s var(--ease-smooth);
}

.e-drawer-left {
    left: 0;
    animation: e-slideInLeft 0.4s var(--ease-smooth);
}

.e-drawer-header {
    padding: var(--sp-6);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-shrink: 0;
}

.e-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-6);
}

.e-drawer-footer {
    padding: var(--sp-5) var(--sp-6);
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    gap: var(--sp-3);
    justify-content: flex-end;
    flex-shrink: 0;
}

@keyframes e-slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes e-slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* ─────────── PREMIUM TOOLTIP ─────────── */
.e-tooltip {
    position: relative;
    display: inline-block;
}

.e-tooltip-content {
    position: absolute;
    background: linear-gradient(135deg, #1E293B, #0F172A);
    color: var(--c-neutral-100);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    white-space: nowrap;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--sh-lg);
    z-index: var(--z-tooltip);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: all var(--t-fast);
    max-width: 280px;
}

.e-tooltip:hover .e-tooltip-content {
    opacity: 1;
    transform: translateY(0);
}

.e-tooltip-top .e-tooltip-content {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
}

.e-tooltip-top:hover .e-tooltip-content {
    transform: translateX(-50%) translateY(0);
}

.e-tooltip-bottom .e-tooltip-content {
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
}

.e-tooltip-bottom:hover .e-tooltip-content {
    transform: translateX(-50%) translateY(0);
}

.e-tooltip-left .e-tooltip-content {
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
}

.e-tooltip-left:hover .e-tooltip-content {
    transform: translateY(-50%) translateX(0);
}

.e-tooltip-right .e-tooltip-content {
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
}

.e-tooltip-right:hover .e-tooltip-content {
    transform: translateY(-50%) translateX(0);
}

/* ─────────── PREMIUM DROPDOWN ─────────── */
.e-dropdown {
    position: relative;
    display: inline-block;
}

.e-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: linear-gradient(180deg, rgba(30,41,59,0.98), rgba(15,23,42,0.98));
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--r-lg);
    padding: var(--sp-2);
    box-shadow: var(--sh-xl);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--t-fast);
    -webkit-backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    backdrop-filter: blur(var(--blur-lg));
}

.e-dropdown.open .e-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.e-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2-5) var(--sp-3);
    border-radius: var(--r-md);
    color: var(--c-neutral-300);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--t-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.e-dropdown-item:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--c-primary-300);
    padding-left: var(--sp-4);
}

.e-dropdown-item.danger {
    color: #F87171;
}
.e-dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #FCA5A5;
}

.e-dropdown-divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.1);
    margin: var(--sp-2) 0;
}

/* ─────────── PREMIUM TABS ─────────── */
.e-tabs {
    display: flex;
    gap: var(--sp-1);
    padding: var(--sp-1-5);
    background: rgba(30, 41, 59, 0.5);
    border-radius: var(--r-lg);
    border: 1px solid rgba(148, 163, 184, 0.1);
    position: relative;
    overflow-x: auto;
    scrollbar-width: none;
}

.e-tabs::-webkit-scrollbar { display: none; }

.e-tab {
    padding: var(--sp-2-5) var(--sp-5);
    border-radius: var(--r-md);
    color: var(--c-neutral-400);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    cursor: pointer;
    transition: all var(--t-fast);
    white-space: nowrap;
    background: transparent;
    border: none;
    font-family: inherit;
    position: relative;
}

.e-tab:hover {
    color: var(--c-neutral-200);
    background: rgba(148, 163, 184, 0.08);
}

.e-tab.active {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

/* ─────────── PREMIUM ACCORDION ─────────── */
.e-accordion {
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: rgba(30, 41, 59, 0.4);
}

.e-accordion-item {
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.e-accordion-item:last-child { border-bottom: none; }

.e-accordion-header {
    padding: var(--sp-4) var(--sp-5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    transition: all var(--t-fast);
    color: var(--c-neutral-200);
    font-weight: var(--fw-bold);
    font-size: var(--fs-sm);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.e-accordion-header:hover {
    background: rgba(16, 185, 129, 0.05);
    color: var(--c-primary-300);
}

.e-accordion-icon {
    transition: transform var(--t-base);
    flex-shrink: 0;
}

.e-accordion-item.open .e-accordion-icon {
    transform: rotate(180deg);
}

.e-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--t-slow);
    color: var(--c-neutral-400);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
}

.e-accordion-item.open .e-accordion-content {
    max-height: 1000px;
}

.e-accordion-content-inner {
    padding: 0 var(--sp-5) var(--sp-5);
}

/* ─────────── PREMIUM STEPPER ─────────── */
.e-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: var(--sp-8);
}

.e-step {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}

.e-step:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    background: rgba(148, 163, 184, 0.15);
    margin: 0 var(--sp-2);
    transition: background var(--t-base);
}

.e-step.completed:not(:last-child)::after {
    background: var(--c-primary-500);
}

.e-step-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.1);
    border: 2px solid rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--fw-bold);
    font-size: var(--fs-sm);
    color: var(--c-neutral-500);
    flex-shrink: 0;
    transition: all var(--t-base);
}

.e-step.active .e-step-marker {
    background: var(--grad-primary);
    border-color: var(--c-primary-400);
    color: white;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.15);
}

.e-step.completed .e-step-marker {
    background: var(--c-primary-600);
    border-color: var(--c-primary-500);
    color: white;
}

.e-step-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--c-neutral-500);
    margin-left: var(--sp-3);
    white-space: nowrap;
}

.e-step.active .e-step-label {
    color: var(--c-primary-300);
}

/* ─────────── PREMIUM ALERT ─────────── */
.e-alert {
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--r-md);
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
    margin-bottom: var(--sp-4);
}

.e-alert-info {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--c-info);
    color: #93C5FD;
}
.e-alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--c-success);
    color: #6EE7B7;
}
.e-alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--c-warning);
    color: #FCD34D;
}
.e-alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--c-danger);
    color: #FCA5A5;
}

/* ─────────── PREMIUM PROGRESS BAR ─────────── */
.e-progress {
    height: 8px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: var(--r-full);
    overflow: hidden;
    position: relative;
}

.e-progress-bar {
    height: 100%;
    background: var(--grad-primary);
    border-radius: var(--r-full);
    transition: width var(--t-slow);
    position: relative;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.e-progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: e-progressShine 2s infinite;
}

@keyframes e-progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ─────────── PREMIUM TOAST (Upgrade) ─────────── */
.e-toast {
    background: linear-gradient(135deg, rgba(30,41,59,0.98), rgba(15,23,42,0.98));
    color: var(--c-neutral-100);
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--r-lg);
    border: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: var(--sh-2xl);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 300px;
    max-width: 420px;
    -webkit-backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    backdrop-filter: blur(var(--blur-lg));
    animation: e-toastIn 0.4s var(--ease-spring);
    position: relative;
    overflow: hidden;
}

.e-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--c-primary-500);
}

.e-toast-success::before { background: var(--c-success); }
.e-toast-error::before { background: var(--c-danger); }
.e-toast-warning::before { background: var(--c-warning); }
.e-toast-info::before { background: var(--c-info); }

@keyframes e-toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─────────── RESPONSIVE ─────────── */
@media (max-width: 640px) {
    .e-modal {
        padding: var(--sp-5);
        border-radius: var(--r-xl);
        max-width: calc(100vw - var(--sp-5) * 2);
    }
    .e-drawer {
        max-width: 100%;
    }
    .e-modal-footer {
        flex-direction: column;
    }
    .e-modal-footer .e-btn {
        width: 100%;
    }
}
