/* ===== ASSET MASTER STYLES ===== */

/* --- Mini Stat Cards --- */
.asm-mini-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.asm-mini-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: 1.1rem 1.25rem;
    transition: all 0.3s ease;
}

.asm-mini-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.asm-mini-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asm-mini-stat-icon svg {
    width: 22px;
    height: 22px;
}

.asm-mini-stat-icon.primary {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.asm-mini-stat-icon.success {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.asm-mini-stat-icon.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.asm-mini-stat-icon.info {
    background: var(--dash-cyan-light);
    color: var(--dash-cyan);
}

.asm-mini-stat-content {
    display: flex;
    flex-direction: column;
}

.asm-mini-stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dash-text);
    line-height: 1.2;
}

.asm-mini-stat-label {
    font-size: 0.72rem;
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* --- Toolbar --- */
.asm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.asm-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.asm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.asm-search-wrapper {
    position: relative;
}

.asm-search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--dash-text-muted);
}

.asm-search-wrapper input {
    padding: 0.6rem 0.85rem 0.6rem 2.4rem;
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    background: var(--dash-surface);
    color: var(--dash-text);
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    min-width: 300px;
    transition: all 0.3s ease;
}

.asm-search-wrapper input:focus {
    outline: none;
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

.asm-filter-select {
    padding: 0.6rem 2rem 0.6rem 0.85rem;
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    background: var(--dash-surface);
    color: var(--dash-text);
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: all 0.3s ease;
}

.asm-filter-select:focus {
    outline: none;
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

.asm-filter-select option {
    background: var(--dash-surface);
    color: var(--dash-text);
}

.asm-refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--dash-radius-sm);
    border: 1px solid var(--dash-border);
    background: var(--dash-surface);
    color: var(--dash-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.asm-refresh-btn svg {
    width: 18px;
    height: 18px;
}

.asm-refresh-btn:hover {
    border-color: var(--dash-primary);
    color: var(--dash-primary);
}

.asm-refresh-btn.spinning svg {
    animation: asm-spin 0.8s linear infinite;
}

@keyframes asm-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.asm-add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--dash-radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--dash-primary), var(--dash-primary-hover));
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px var(--dash-primary-glow);
}

.asm-add-btn svg {
    width: 16px;
    height: 16px;
}

.asm-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--dash-primary-glow);
}

/* --- Table --- */
.asm-panel {
    position: relative;
    overflow: hidden;
}

.asm-sort-header {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.asm-sort-header:hover {
    color: var(--dash-primary);
}

.asm-sort-header::after {
    content: '↕';
    margin-left: 4px;
    opacity: 0.3;
    font-size: 0.625rem;
}

.asm-sort-header.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--dash-primary);
}

.asm-sort-header.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--dash-primary);
}

.asm-name-cell {
    display: flex;
    flex-direction: column;
}

.asm-name-main {
    font-weight: 600;
    color: var(--dash-text);
    font-size: 0.85rem;
}

.asm-name-sub {
    font-size: 0.72rem;
    color: var(--dash-text-muted);
    margin-top: 1px;
}

.asm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.asm-badge.primary {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.asm-badge.violet {
    background: var(--dash-violet-light);
    color: var(--dash-violet);
}

.asm-badge.cyan {
    background: var(--dash-cyan-light);
    color: var(--dash-cyan);
}

.asm-badge.info {
    background: var(--dash-info-light);
    color: var(--dash-info);
}

.asm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.28rem 0.72rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.asm-status-badge.active {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.asm-status-badge.inactive {
    background: var(--dash-danger-light);
    color: var(--dash-danger);
}

.asm-status-badge.warning {
    background: var(--dash-warning-light);
    color: var(--dash-warning);
}

.asm-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.asm-cat-badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.asm-cat-badge.company {
    background: var(--dash-info-light);
    color: var(--dash-info);
}

.asm-cat-badge.thirdparty {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

/* --- Action Buttons --- */
.asm-row-actions {
    display: flex;
    gap: 0.4rem;
}

.asm-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--dash-border);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--dash-surface-2);
    color: var(--dash-text-secondary);
}

.asm-action-btn svg {
    width: 13px;
    height: 13px;
}

.asm-action-btn.edit:hover {
    background: var(--dash-primary-light);
    border-color: var(--dash-primary);
    color: var(--dash-primary);
}

/* --- Empty State --- */
.asm-empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.asm-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--dash-surface-2);
    color: var(--dash-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.asm-empty-icon svg {
    width: 32px;
    height: 32px;
}

.asm-empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dash-text);
    margin-bottom: 0.3rem;
}

.asm-empty-desc {
    font-size: 0.82rem;
    color: var(--dash-text-muted);
}

/* --- Pagination --- */
.asm-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--dash-border);
}

.asm-page-info {
    font-size: 0.78rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

.asm-pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.asm-page-btn {
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--dash-border);
    background: var(--dash-surface-2);
    color: var(--dash-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.asm-page-btn:hover:not(:disabled):not(.active) {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
    border-color: var(--dash-primary);
}

.asm-page-btn.active {
    background: var(--dash-primary);
    color: #fff;
    border-color: var(--dash-primary);
}

.asm-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.asm-page-dots {
    font-size: 0.78rem;
    color: var(--dash-text-muted);
    padding: 0 2px;
}

/* --- Loading --- */
.asm-loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(10, 10, 26, 0.7);
    backdrop-filter: blur(4px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border-radius: var(--dash-radius);
}

.asm-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--dash-primary);
    border-radius: 50%;
    animation: asm-spin 0.8s linear infinite;
}

.asm-loading-text {
    font-size: 0.82rem;
    color: var(--dash-text-secondary);
    font-weight: 500;
}

/* ========== MODAL ========== */
.asm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: asm-fadeIn 0.2s ease-out;
}

.asm-modal-overlay.active {
    display: flex;
}

@keyframes asm-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.asm-modal {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    width: 100%;
    max-width: 900px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
    animation: asm-slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes asm-slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.asm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--dash-border);
    flex-shrink: 0;
}

.asm-modal-header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.asm-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--dash-primary), var(--dash-violet));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px var(--dash-primary-glow);
}

.asm-modal-icon svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.asm-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--dash-text);
    margin: 0;
    line-height: 1.2;
}

.asm-modal-subtitle {
    font-size: 0.813rem;
    color: var(--dash-text-muted);
    margin: 2px 0 0;
}

.asm-modal-close {
    background: var(--dash-surface-2);
    border: 1px solid var(--dash-border);
    color: var(--dash-text-muted);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.asm-modal-close svg {
    width: 18px;
    height: 18px;
}

.asm-modal-close:hover {
    background: var(--dash-danger-light);
    border-color: var(--dash-danger);
    color: var(--dash-danger);
}

.asm-modal-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    flex: 1;
}

.asm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--dash-border);
    flex-shrink: 0;
}

/* --- Form --- */
.asm-form-section {
    margin-bottom: 1.75rem;
}

.asm-form-section:last-child {
    margin-bottom: 0;
}

.asm-form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.813rem;
    font-weight: 700;
    color: var(--dash-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--dash-border);
}

.asm-form-section-title svg {
    width: 16px;
    height: 16px;
}

.asm-form-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.asm-form-grid:last-child {
    margin-bottom: 0;
}

.asm-form-grid-1 {
    grid-template-columns: 1fr;
}

.asm-form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.asm-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.asm-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.asm-form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dash-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.asm-form-group input,
.asm-form-group select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    background: var(--dash-surface-2);
    color: var(--dash-text);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    width: 100%;
    outline: none;
}

.asm-form-group input:focus,
.asm-form-group select:focus {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

.asm-form-group input::placeholder {
    color: var(--dash-text-muted);
}

.asm-form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    cursor: pointer;
}

.asm-form-group select option {
    background: var(--dash-surface);
    color: var(--dash-text);
}

/* --- Buttons --- */
.asm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    border-radius: var(--dash-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.asm-btn svg {
    width: 16px;
    height: 16px;
}

.asm-btn-secondary {
    background: var(--dash-surface-2);
    color: var(--dash-text-secondary);
    border: 1px solid var(--dash-border);
}

.asm-btn-secondary:hover {
    background: var(--dash-surface-3);
    border-color: var(--dash-border-hover);
    color: var(--dash-text);
}

.asm-btn-primary {
    background: linear-gradient(135deg, var(--dash-primary), var(--dash-primary-hover));
    color: #fff;
    box-shadow: 0 4px 16px var(--dash-primary-glow);
}

.asm-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--dash-primary-glow);
}

.asm-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* --- Toast --- */
.asm-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--dash-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: asm-toastIn 0.35s ease-out;
    max-width: 420px;
}

.asm-toast.show {
    display: flex;
}

.asm-toast.success {
    background: linear-gradient(135deg, #065f46, #064e3b);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #a7f3d0;
}

.asm-toast.error {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

.asm-toast.info {
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
}

.asm-toast-icon {
    font-size: 1.125rem;
}

@keyframes asm-toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes asm-toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] .asm-loading-overlay {
    background: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .asm-toast.success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #065f46;
}

[data-theme="light"] .asm-toast.error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

[data-theme="light"] .asm-toast.info {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #1e40af;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .asm-mini-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .asm-form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .asm-mini-stats {
        grid-template-columns: 1fr;
    }

    .asm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .asm-toolbar-left,
    .asm-toolbar-right {
        flex-wrap: wrap;
    }

    .asm-search-wrapper input {
        min-width: 100%;
    }

    .asm-form-grid-2,
    .asm-form-grid-3 {
        grid-template-columns: 1fr;
    }

    .asm-modal {
        max-width: 100%;
        max-height: 95vh;
        margin: 0.5rem;
    }

    .asm-pagination-bar {
        flex-direction: column;
        gap: 0.75rem;
    }
}