/* ============================================
   AssetExplorer — CSS Design System
   ============================================ */
:root {
    --ae-primary: #4f46e5;
    --ae-primary-light: #818cf8;
    --ae-primary-dark: #3730a3;
    --ae-success: #10b981;
    --ae-warning: #f59e0b;
    --ae-danger: #ef4444;
    --ae-info: #0ea5e9;
    --ae-bg: #f8fafc;
    --ae-card: #ffffff;
    --ae-border: #e2e8f0;
    --ae-text: #1e293b;
    --ae-muted: #64748b;
    --ae-radius: 14px;
}

/* === Layout === */
.section-tab {
    display: none;
}

.section-tab.active {
    display: block;
    animation: aeSlideIn 0.3s ease-out;
}

@keyframes aeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px)
    }

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

.content-pad {
    padding: 1.5rem 2rem 2rem;
}

/* === Hero Banner === */
.ae-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 50%, #4f46e5 100%);
    padding: 2rem 2rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.ae-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%);
    border-radius: 50%;
}

.ae-hero h2 {
    color: white;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 0.25rem;
    position: relative;
    z-index: 1;
}

.ae-hero p {
    color: #c7d2fe;
    font-size: 0.88rem;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--ae-card);
    border-radius: var(--ae-radius);
    padding: 1.25rem;
    border: 1.5px solid var(--ae-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--ae-primary-light);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--ae-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ae-text);
    line-height: 1.2;
}

.stat-trend {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 2px;
}

.stat-trend.up {
    color: var(--ae-success);
}

.stat-trend.down {
    color: var(--ae-danger);
}

/* === Cards === */
.ae-card {
    background: var(--ae-card);
    border-radius: var(--ae-radius);
    border: 1.5px solid var(--ae-border);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.ae-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--ae-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ae-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ae-text);
    margin: 0;
}

.ae-card-body {
    padding: 1.25rem 1.5rem;
}

.ae-card-body.no-pad {
    padding: 0;
}

/* === Tables === */
.ae-table {
    width: 100%;
    border-collapse: collapse;
}

.ae-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 2px solid var(--ae-border);
    font-size: 0.78rem;
    color: var(--ae-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
    white-space: nowrap;
}

.ae-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: var(--ae-text);
    vertical-align: middle;
}

.ae-table tr:hover td {
    background: #f8fafc;
}

.ae-table tr:last-child td {
    border-bottom: none;
}

/* === Status Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-in-use {
    background: #dbeafe;
    color: #1e40af;
}

.badge-maintenance {
    background: #fef3c7;
    color: #92400e;
}

.badge-retired {
    background: #fee2e2;
    color: #991b1b;
}

.badge-in-stock {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-disposed {
    background: #f1f5f9;
    color: #64748b;
}

.badge-compliant {
    background: #d1fae5;
    color: #065f46;
}

.badge-over {
    background: #fee2e2;
    color: #991b1b;
}

.badge-under {
    background: #fef3c7;
    color: #92400e;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge-expiring {
    background: #fef3c7;
    color: #92400e;
}

.badge-expired {
    background: #fee2e2;
    color: #991b1b;
}

.badge-valid {
    background: #d1fae5;
    color: #065f46;
}

.badge-high {
    background: #fee2e2;
    color: #991b1b;
}

.badge-medium {
    background: #fef3c7;
    color: #92400e;
}

.badge-low {
    background: #d1fae5;
    color: #065f46;
}

.badge-rarely {
    background: #fee2e2;
    color: #991b1b;
}

.badge-occasional {
    background: #fef3c7;
    color: #92400e;
}

.badge-frequent {
    background: #d1fae5;
    color: #065f46;
}

/* === Tag Chip === */
.tag-chip {
    background: #f1f5f9;
    padding: 0.15rem 0.5rem;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--ae-primary);
    font-family: monospace;
}

/* === Toolbar === */
.toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-search {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 0 0.75rem;
    border: 1.5px solid var(--ae-border);
    transition: border-color 0.2s;
}

.toolbar-search:focus-within {
    border-color: var(--ae-primary);
}

.toolbar-search i {
    color: var(--ae-muted);
    font-size: 0.85rem;
}

.toolbar-search input {
    border: none;
    background: none;
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
    outline: none;
    min-width: 200px;
    color: var(--ae-text);
}

.toolbar select {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1.5px solid var(--ae-border);
    font-size: 0.82rem;
    background: white;
    color: var(--ae-text);
    cursor: pointer;
}

/* === Buttons === */
.btn-ae {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-ae-primary {
    background: var(--ae-primary);
    color: white;
}

.btn-ae-primary:hover {
    background: var(--ae-primary-dark);
}

.btn-ae-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-ae-ghost {
    background: transparent;
    color: var(--ae-primary);
    border: 1.5px solid var(--ae-border);
}

.btn-ae-ghost:hover {
    background: #f1f5f9;
}

.btn-ae-danger {
    background: #fee2e2;
    color: #991b1b;
}

.btn-ae-danger:hover {
    background: #fecaca;
}

.btn-ae-success {
    background: #d1fae5;
    color: #065f46;
}

.btn-ae-success:hover {
    background: #a7f3d0;
}

.btn-ae-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1.5px solid var(--ae-border);
    background: white;
    color: var(--ae-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-ae-icon:hover {
    background: #f1f5f9;
    color: var(--ae-primary);
}

/* === Modals === */
.ae-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ae-modal.open {
    display: flex;
    animation: aeModalIn 0.25s ease-out;
}

@keyframes aeModalIn {
    from {
        opacity: 0;
        transform: scale(0.95)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

.ae-modal-content {
    background: white;
    border-radius: var(--ae-radius);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ae-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--ae-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ae-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--ae-text);
}

.ae-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: var(--ae-muted);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.ae-modal-close:hover {
    background: #fee2e2;
    color: #991b1b;
}

.ae-modal-body {
    padding: 1.5rem;
}

.ae-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--ae-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* === Forms === */
.ae-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ae-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ae-form-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ae-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ae-form-input {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1.5px solid var(--ae-border);
    font-size: 0.85rem;
    color: var(--ae-text);
    transition: border-color 0.2s;
    outline: none;
    background: white;
}

.ae-form-input:focus {
    border-color: var(--ae-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.ae-form-input::placeholder {
    color: #94a3b8;
}

/* === CMDB Relationship Map === */
.cmdb-map {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

.cmdb-node {
    background: white;
    border-radius: 10px;
    border: 1.5px solid var(--ae-border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    cursor: pointer;
}

.cmdb-node:hover {
    border-color: var(--ae-primary);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.cmdb-node-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.cmdb-node-info {
    flex: 1;
}

.cmdb-node-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ae-text);
}

.cmdb-node-sub {
    font-size: 0.72rem;
    color: var(--ae-muted);
}

.cmdb-connector {
    width: 2px;
    height: 20px;
    background: var(--ae-border);
    margin-left: 18px;
}

/* === Compliance Bar === */
.compliance-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.35rem;
}

.compliance-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.compliance-ok {
    background: linear-gradient(90deg, var(--ae-success), #34d399);
}

.compliance-warn {
    background: linear-gradient(90deg, var(--ae-warning), #fbbf24);
}

.compliance-danger {
    background: linear-gradient(90deg, var(--ae-danger), #f87171);
}

/* === Toast === */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    animation: toastIn 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.success {
    background: linear-gradient(135deg, #059669, #10b981);
}

.toast.error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.toast.warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.toast.info {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px)
    }

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

/* === Loading === */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--ae-muted);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--ae-primary);
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ae-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: #cbd5e1;
}

/* === Quick Actions === */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem;
    border-radius: 12px;
    border: 1.5px solid var(--ae-border);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.quick-action:hover {
    border-color: var(--ae-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.quick-action i {
    font-size: 1.5rem;
}

.quick-action span {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ae-text);
}

/* === Tabs inline === */
.ae-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--ae-border);
    margin-bottom: 1rem;
}

.ae-tab {
    padding: 0.6rem 1.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ae-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.ae-tab.active {
    color: var(--ae-primary);
    border-bottom-color: var(--ae-primary);
}

.ae-tab:hover {
    color: var(--ae-text);
}

/* === Mobile Header === */
.mobile-header {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--ae-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ae-text);
}

/* === Responsive === */
@media(max-width:1024px) {
    .mobile-header {
        display: flex;
    }
}

@media(max-width:768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .ae-form-row {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ae-modal-content {
        max-width: 100%;
        margin: 0.5rem;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .content-pad {
        padding: 1rem;
    }

    .ae-hero {
        padding: 1.5rem 1rem;
    }

    .ae-hero h2 {
        font-size: 1.3rem;
    }
}

@media(max-width:480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}