/* Fluent UI overrides */
:root {
    --border-radius: 5px;
    --layer-corner-radius: 5px;
    --control-corner-radius: 5px;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--body-font), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    height: 100%;
}

/* Auth layout */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--neutral-layer-2);
}

.auth-card {
    width: 400px;
    padding: 40px;
    background: var(--neutral-layer-1);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: var(--border-radius);
}

.auth-card.wide {
    width: 800px;
}

.auth-card h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
}

.auth-card .subtitle {
    color: var(--neutral-foreground-hint);
    margin-bottom: 24px;
    font-size: 14px;
}

.auth-card .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.auth-card .logo img {
    height: 42px;
}

.auth-card .logo span {
    font-size: 20px;
    font-weight: 700;
    color: rgb(255, 80, 0);
}

.auth-card .field {
    margin-bottom: 16px;
}

/* Floating label input - label sits on top border */
.float-field {
    position: relative;
    margin-bottom: 20px;
}

.float-field input,
.float-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    outline: none;
    box-sizing: border-box;
}

.float-field input:-webkit-autofill,
.float-field input:-webkit-autofill:hover,
.float-field input:-webkit-autofill:focus,
.float-field input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--neutral-layer-1) inset !important;
    -webkit-text-fill-color: var(--neutral-foreground-rest) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.float-field label {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--neutral-foreground-hint);
    background: var(--neutral-layer-1);
    padding: 0 4px;
    border-radius: 5px;
    transition: all 0.15s ease;
    pointer-events: none;
}

.float-field input:focus + label,
.float-field input:not(:placeholder-shown) + label,
.float-field input:-webkit-autofill + label,
.float-field textarea:focus + label,
.float-field textarea:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--accent-foreground-rest);
}

.float-field input:focus,
.float-field textarea:focus {
    border-color: var(--accent-foreground-rest);
    box-shadow: 0 0 0 1px var(--accent-foreground-rest);
}

.float-field.password-field {
    position: relative;
}

.float-field .password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--neutral-foreground-hint);
    display: flex;
    align-items: center;
}

.float-field .password-toggle:hover {
    color: var(--neutral-foreground-rest);
}

.auth-card .actions {
    margin-top: 24px;
}

.auth-card .links {
    margin-top: 16px;
    font-size: 13px;
    text-align: center;
}

.auth-card .links a {
    color: var(--accent-foreground-rest);
    text-decoration: none;
}

.auth-card .error-message {
    color: var(--error);
    font-size: 13px;
    margin-bottom: 12px;
}

.auth-card .success-message {
    color: #0e700e;
    font-size: 13px;
    margin-bottom: 12px;
    background: #dff6dd;
    padding: 10px 14px;
    border-radius: var(--border-radius);
}

.auth-card .privacy-box {
    color: #573a08;
    padding: 12px 16px;
    box-shadow: 0 0 0 1px #c9ba9b inset;
    background-color: #FFFAF3;
    border-radius: var(--border-radius);
    margin-top: 20px;
    font-size: 13px;
}

.auth-card .privacy-box a {
    color: rgb(255, 80, 0);
    text-decoration: none;
}

.auth-card .p5-container {
    margin-top: 24px;
}

.auth-card .p5-container iframe {
    width: 100%;
    height: 140px;
    border: none;
    border-radius: var(--border-radius);
}

.auth-card .p5-hint {
    color: rgba(0, 0, 0, 0.15);
    text-align: center;
    font-size: 12px;
    margin-top: 4px;
}

/* Main layout */
.lk-layout {
    display: flex;
    height: 100vh;
}

.lk-sidebar {
    width: 250px;
    background: rgba(1, 1, 6, 0.95);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

/* Brand bar */
.lk-sidebar-brand {
    min-height: 3.5rem;
    background: linear-gradient(180deg, #6b1a1a 0%, #0a0010 100%);
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.lk-brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    color: white;
    font-size: 1.1rem;
}

.lk-brand-link:hover {
    opacity: 0.9;
    color: rgb(255, 80, 0);
}

.lk-brand-logo {
    height: 42px;
}

/* Scrollable nav */
.lk-nav-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.lk-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.lk-nav-divider {
    margin: 0.5rem 1rem;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.lk-nav-section {
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.25rem 1rem 0.25rem;
}

.lk-nav-item {
    padding: 0;
}

.lk-nav-link {
    color: rgba(255, 255, 255, 0.7);
    background: none;
    border: none;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: 2.5rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    text-decoration: none;
    border-radius: 0;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.lk-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
}

.lk-nav-link.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    border-left-color: rgb(255, 80, 0);
}

svg.lk-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lk-nav-link.active svg.lk-nav-icon {
    opacity: 1;
    color: rgb(255, 80, 0);
}

/* User info at bottom */
.lk-nav-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.lk-user-info {
    margin-bottom: 0.75rem;
}

.lk-user-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.lk-user-email {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.lk-logout-link {
    display: block;
    text-align: center;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    transition: all 0.15s;
}

.lk-logout-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.lk-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    background: #f8f9fb;
    position: relative;
}

.lk-page {
    max-width: 960px;
}

@media (max-width: 768px) {
    .lk-layout {
        flex-direction: column;
    }

    .lk-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .lk-nav-scroll {
        max-height: 50vh;
    }

    .lk-content {
        padding: 16px;
    }
}

.lk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.lk-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: #1a1a2e;
}

/* License card */
.license-card {
    border: 1px solid #eaedf0;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.license-card .license-type {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
}

.license-card .license-features {
    color: var(--neutral-foreground-hint);
    font-size: 13px;
    margin-bottom: 8px;
}

.license-card .license-dates {
    font-size: 13px;
    color: var(--neutral-foreground-hint);
}

.license-card .license-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 600;
}

.license-card .license-status.active {
    background: #dff6dd;
    color: #0e700e;
}

.license-card .license-status.expired {
    background: #fde7e9;
    color: #c50f1f;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--neutral-foreground-hint);
}

.empty-state h3 {
    margin-bottom: 8px;
}

/* Submit button */
.btn-accent {
    width: 100%;
    padding: 10px;
    background: var(--accent-fill-rest, #0078d4);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-accent:hover {
    background: var(--accent-fill-hover, #106ebe);
}

/* Admin action links */
.admin-action-link {
    display: block;
    padding: 10px 16px;
    border: 1px solid #eaedf0;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--accent-foreground-rest);
    font-size: 13px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.admin-action-link:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border-color: #d0d5dd;
}

/* Validation */
.validation-message {
    color: var(--error);
    font-size: 12px;
    margin-top: 4px;
}

/* Error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Admin */
.admin-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 140px;
    padding: 20px;
    background: #fff;
    border: 1px solid #eaedf0;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.admin-table th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid #eaedf0;
    font-weight: 600;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #fafbfc;
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f1f3;
}

.admin-table tr:hover td {
    background: #f8f9fb;
}



/* License status badges (standalone, for admin tables) */
.license-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 600;
}

.license-status.active {
    background: #dff6dd;
    color: #0e700e;
}

.license-status.expired {
    background: #fde7e9;
    color: #c50f1f;
}

.license-status.revoked {
    background: #fff0e0;
    color: #8a4b00;
}

/* Audit log action badges */
.audit-action {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--border-radius);
    font-size: 11px;
    font-weight: 600;
    font-family: monospace;
}

.audit-success {
    background: #dff6dd;
    color: #0e700e;
}

.audit-danger {
    background: #fde7e9;
    color: #c50f1f;
}

.audit-warning {
    background: #fff0e0;
    color: #8a4b00;
}

.audit-neutral {
    background: #f0f0f0;
    color: #555;
}
