/* PortMenu V2 - Reusable Component Styles */

/* ===== Fluent UI Web Component Overrides ===== */
fluent-card {
    border: none !important;
    --card-border: none;
    --elevation-shadow-card-rest: none;
    --elevation-shadow-card-hover: none;
    --elevation-shadow-card-focus: none;
    --elevation-shadow-card-active: none;
}

/* ===== CommandBar / Toolbar ===== */
.command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--color-surface-base);
    border-bottom: var(--border-width-thin) solid var(--color-border-subtle);
    margin-bottom: var(--spacing-md);
}

.command-bar-start {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
}

.command-bar-end {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.command-bar fluent-search {
    min-width: 300px;
}

@media (max-width: 768px) {
    .command-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .command-bar-start,
    .command-bar-end {
        flex-direction: column;
        align-items: stretch;
    }
    
    .command-bar fluent-search {
        min-width: auto;
        width: 100%;
    }
}

/* ===== Fluent Data Grid Enhancements ===== */
.fluent-grid-container {
    background: var(--color-surface-base);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-2);
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: auto;
}

.fluent-data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-family-base);
}

.fluent-data-table thead {
    background: var(--color-neutral-200);
    border-bottom: 2px solid var(--color-border-default);
    position: sticky;
    top: 0;
    z-index: 10;
}

.fluent-data-table th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-14);
    color: var(--color-neutral-950);
    white-space: nowrap;
}

.fluent-data-table tbody tr {
    border-bottom: 1px solid var(--color-border-subtle);
    transition: background-color 0.15s ease;
}

.fluent-data-table tbody tr:hover {
    background: var(--color-neutral-100);
}

.fluent-data-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-14);
    line-height: 1.5;
    vertical-align: middle;
}

/* Column-specific styles */
.grid-cell-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-xs);
    white-space: nowrap;
}

.grid-cell-roles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: center;
}

.grid-cell-status {
    display: flex;
    align-items: center;
}

.grid-cell-lastlogin {
    color: var(--color-neutral-800);
    white-space: nowrap;
}

.grid-cell-lastlogin-never {
    color: var(--color-neutral-600);
    font-style: italic;
}

/* ===== Icon Button & Context Menu ===== */
.icon-button {
    --button-padding: 4px;
    font-size: 16px;
    min-width: 28px;
    min-height: 28px;
}

.context-menu-container {
    position: relative;
    display: inline-block;
}

.context-menu {
    position: fixed;
    margin-top: var(--spacing-xs);
    background: var(--color-surface-base);
    border: var(--border-width-thin) solid var(--color-border-default);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-8);
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.context-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-14);
    color: var(--color-neutral-950);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: background 0.15s ease;
}

.context-menu-item:hover {
    background: var(--color-neutral-100);
}

.context-menu-item:active {
    background: var(--color-neutral-200);
}

.context-menu-item.danger {
    color: var(--color-error-base);
}

.context-menu-item.danger:hover {
    background: var(--color-error-light);
}

.context-menu-divider {
    height: var(--border-width-thin);
    background: var(--color-border-subtle);
    margin: var(--spacing-xs) 0;
}

/* ===== Enhanced Badge Styles ===== */
fluent-badge.status-active {
    --badge-fill-success: var(--color-success-light);
    --badge-color-success: var(--color-success-hover);
    background: var(--color-success-light);
    color: var(--color-success-hover);
    font-weight: var(--font-weight-medium);
}

fluent-badge.status-inactive {
    --badge-fill-neutral: var(--color-neutral-300);
    --badge-color-neutral: var(--color-neutral-900);
    background: var(--color-neutral-300);
    color: var(--color-neutral-900);
    font-weight: var(--font-weight-medium);
}

fluent-badge.status-locked {
    background: var(--color-error-light);
    color: var(--color-error-hover);
    font-weight: var(--font-weight-medium);
}

fluent-badge.role-badge {
    background: var(--color-neutral-200);
    color: var(--color-neutral-950);
    font-weight: var(--font-weight-regular);
}

/* ===== Empty State Component ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-3xl) var(--spacing-md);
    text-align: center;
    color: var(--color-neutral-800);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
    color: var(--color-neutral-950);
}

.empty-state-description {
    font-size: var(--font-size-14);
    margin-bottom: var(--spacing-lg);
    max-width: 400px;
}

/* ===== Spool File Status ===== */
.spool-file-status {
    margin-top: 1.5rem;
    border: 1px solid var(--neutral-stroke-rest, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
}

.spool-file-status__title {
    font-size: var(--font-size-14, 14px);
    font-weight: 600;
    padding: .6rem 1rem;
    margin: 0;
    background: var(--neutral-fill-secondary-rest, #f5f5f5);
    border-bottom: 1px solid var(--neutral-stroke-rest, #e0e0e0);
}

.spool-file-status__fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .25rem 1.5rem;
    padding: .75rem 1rem;
    margin: 0;
}

.spool-file-status__row {
    display: flex;
    flex-direction: column;
}

.spool-file-status__row dt {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--neutral-foreground-hint, #767676);
}

.spool-file-status__row dd {
    font-size: 13px;
    font-family: 'Courier New', monospace;
    margin: 0;
    color: var(--neutral-foreground-rest, #242424);
}

.spool-file-status__preview {
    border-top: 1px solid var(--neutral-stroke-rest, #e0e0e0);
}

.spool-file-status__preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4rem 1rem;
    background: var(--neutral-fill-secondary-rest, #f5f5f5);
    border-bottom: 1px solid var(--neutral-stroke-rest, #e0e0e0);
    font-size: 12px;
    font-weight: 600;
    color: var(--neutral-foreground-rest, #242424);
}

.spool-file-status__download-link {
    font-size: 12px;
    font-weight: 400;
    color: var(--accent-foreground-rest, #0078d4);
    text-decoration: none;
}

.spool-file-status__download-link:hover {
    text-decoration: underline;
}

.spool-file-status__iframe {
    display: block;
    width: 100%;
    height: 820px;
    border: none;
    background: #fff;
}

.spool-file-status__iframe--fullpage {
    height: calc(100vh - 160px);
    min-height: 600px;
}

.spool-file-status--fullpage {
    margin-top: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
}

.spool-file-status--fullpage .spool-file-status__preview {
    border-top: none;
}
