/* Material Design 3 - CloudCrypt */

@import url('fonts.css');

:root {
    /* Material Design 3 Color Tokens - Seed Color: #0D47A1 */
    --md-sys-color-primary: #0D47A1;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #D3E4FF;
    --md-sys-color-on-primary-container: #001C38;

    --md-sys-color-secondary: #535F70;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #D7E3F8;
    --md-sys-color-on-secondary-container: #101C2B;

    --md-sys-color-tertiary: #006A60;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #9EF2E4;
    --md-sys-color-on-tertiary-container: #00201C;

    --md-sys-color-surface: #FDFBFF;
    --md-sys-color-on-surface: #1A1C1E;
    --md-sys-color-surface-variant: #DFE2EB;
    --md-sys-color-on-surface-variant: #43474E;

    --md-sys-color-background: #FDFBFF;
    --md-sys-color-on-background: #1A1C1E;

    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;

    --md-sys-color-warning: #F57C00;
    --md-sys-color-on-warning: #FFFFFF;
    --md-sys-color-warning-container: #FFE0B2;
    --md-sys-color-on-warning-container: #E65100;

    --md-sys-color-outline: #73777F;
    --md-sys-color-outline-variant: #C3C6CF;

    /* Elevations */
    --md-sys-elevation-1: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px 0 rgba(0, 0, 0, 0.3);

    /* Sidebar */
    --sidebar-width: 280px;
    --topbar-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
    min-height: 100vh;
}

/* Top App Bar */
.top-app-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: var(--md-sys-elevation-2);
    z-index: 100;
}

.top-app-bar .menu-icon {
    cursor: pointer;
    padding: 12px;
    margin-right: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.top-app-bar .menu-icon:hover {
    background-color: var(--md-sys-color-surface-variant);
}

.top-app-bar .title {
    font-size: 22px;
    font-weight: 400;
    flex: 1;
}

.top-app-bar .actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.top-app-bar .language-select {
    padding: 8px 12px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-1);
    overflow-y: auto;
    transition: transform 0.3s;
    z-index: 99;
    display: flex;
    flex-direction: column;
}

.sidebar.closed {
    transform: translateX(-100%);
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-footer {
    padding: 0;
    margin-top: auto;
}

/* Sidebar info section (logo, version, email) */
.sidebar-info {
    padding: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    text-align: center;
}

.sidebar-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 8px;
}

.sidebar-version {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
    font-weight: 500;
}

.sidebar-email {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    word-break: break-all;
    opacity: 0.8;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

.sidebar-item:hover {
    background-color: var(--md-sys-color-secondary-container);
}

.sidebar-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.sidebar-item .material-icons {
    margin-right: 12px;
}

/* Sidebar parent items with submenus */
.sidebar-parent {
    cursor: pointer;
    user-select: none;
}

.sidebar-parent .material-icons.expand-icon {
    margin-left: auto;
    margin-right: 0;
    transition: transform 0.2s;
}

.sidebar-parent.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Sidebar submenu */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: var(--md-sys-color-surface-variant);
}

.sidebar-submenu.expanded {
    max-height: 500px;
}

.sidebar-submenu-item {
    display: flex;
    align-items: center;
    padding: 10px 24px 10px 48px;
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

.sidebar-submenu-item:hover {
    background-color: var(--md-sys-color-secondary-container);
}

.sidebar-submenu-item.active {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 500;
}

.sidebar-submenu-item .material-icons {
    margin-right: 12px;
    font-size: 20px;
}

.sidebar-logout {
    color: var(--md-sys-color-error);
}

.sidebar-logout:hover {
    background-color: var(--md-sys-color-error-container);
}

/* Main Content */
.main-content {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 24px;
    transition: margin-left 0.3s;
}

.main-content.sidebar-closed {
    margin-left: 0;
}

/* No sidebar on public pages */
.public-layout .main-content {
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--topbar-height));
}

/* Material Design 3 Cards */
.md-card {
    background-color: var(--md-sys-color-surface);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--md-sys-elevation-1);
    transition: box-shadow 0.2s;
}

.md-card:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.md-card-header {
    margin-bottom: 24px;
}

.md-card-title {
    font-size: 24px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.md-card-subtitle {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Material Design 3 Buttons */
.md-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.1px;
}

.md-btn-filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.md-btn-filled:hover {
    box-shadow: var(--md-sys-elevation-1);
    background-color: #1557B0;
}

.md-btn-outlined {
    background-color: transparent;
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

.md-btn-outlined:hover {
    background-color: var(--md-sys-color-primary-container);
}

.md-btn-text {
    background-color: transparent;
    color: var(--md-sys-color-primary);
}

.md-btn-text:hover {
    background-color: var(--md-sys-color-primary-container);
}

.md-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.md-btn-block {
    width: 100%;
}

.md-btn-icon {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.md-btn-icon:hover {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* Material Design 3 Text Fields */
.md-text-field {
    position: relative;
    margin-bottom: 24px;
}

.md-text-field label {
    display: block;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
    font-weight: 500;
}

.md-text-field input,
.md-text-field textarea,
.md-text-field select {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    transition: border-color 0.2s;
}

.md-text-field input:focus,
.md-text-field textarea:focus,
.md-text-field select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
}

.md-text-field input.error {
    border-color: var(--md-sys-color-error);
}

.md-text-field .error-text {
    color: var(--md-sys-color-error);
    font-size: 12px;
    margin-top: 4px;
}

/* Material Design 3 Alerts */
.md-alert {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}

.md-alert-info {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.md-alert-error {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.md-alert-success {
    background-color: #C6F6D5;
    color: #0A4E23;
}

.md-alert-warning {
    background-color: #FFF8E1;
    color: #E65100;
    border-left: 4px solid #FF8F00;
}

/* Spinner */
.spinner {
    border: 3px solid var(--md-sys-color-outline-variant);
    border-top: 3px solid var(--md-sys-color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mt-4 {
    margin-top: 32px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mb-4 {
    margin-bottom: 32px;
}

/* Responsive */
@media (max-width: 768px) {

    /* In mobile, sidebar is hidden by default and shown when not .closed */
    .sidebar.closed {
        transform: translateX(-100%);
    }

    .sidebar:not(.closed) {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }
}

/* RTL Support */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .sidebar.closed {
    transform: translateX(100%);
}

/* ============================================
   Certificates Page
   ============================================ */

.certificates-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.loading-state,
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    gap: 16px;
}

.empty-state .material-icons,
.error-state .material-icons {
    font-size: 64px;
    color: var(--md-sys-color-on-surface-variant);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-sys-color-surface-variant);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.cert-card {
    background: var(--md-sys-color-surface-container);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.cert-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.cert-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.cert-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.cert-type-badge.signature {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.cert-type-badge.kem {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.cert-type-badge.webauthn {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.current-device-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.cert-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
}

.cert-status .material-icons {
    font-size: 20px;
}

.cert-status.valid {
    color: var(--md-sys-color-tertiary);
}

.cert-status.invalid,
.cert-status.revoked {
    color: var(--md-sys-color-error);
}

.cert-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.cert-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cert-info-label {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cert-info-value {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    font-family: 'Roboto Mono', monospace;
}

/* Certificate Details Dialog */
.cert-details-dialog {
    max-width: 700px;
    width: 90%;
    border: none;
    border-radius: 16px;
    padding: 0;
    background: var(--md-sys-color-surface);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin: auto;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    outline: none;
    /* Remove browser default focus outline */
}

.cert-details-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.dialog-header h2 {
    margin: 0;
    font-size: 20px;
}

.dialog-content {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.icon-button:hover {
    background-color: var(--md-sys-color-surface-variant);
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--md-sys-color-primary);
}

.detail-grid {
    display: grid;
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    word-break: break-all;
}

.detail-value.mono {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
}

.validation-error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
}

/* ============================================
   Devices Page
   ============================================ */

.devices-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

/* ============================================
   Settings Page - Minimal Additions
   ============================================ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.md-btn-danger {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.md-btn-danger:hover {
    box-shadow: var(--md-sys-color-elevation-1);
}

.settings-group {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.settings-group:last-child {
    border-bottom: none;
}

.settings-group-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    margin-bottom: 8px;
}

.settings-group-desc {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 20px;
}

.radio-list label {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-list label:hover {
    background: var(--md-sys-color-surface-variant);
}

.radio-list input[type="radio"] {
    margin: 2px 12px 0 0;
    cursor: pointer;
}

.radio-list-content {
    flex: 1;
}

.radio-list-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 2px;
}

.radio-list-desc {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Autocomplete Dropdown (v0.8.1+) */
.autocomplete-item {
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: background 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--md-sys-color-surface-container, #E8EAF6);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

#recipient-autocomplete::-webkit-scrollbar {
    width: 8px;
}

#recipient-autocomplete::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline);
    border-radius: 4px;
}

#recipient-autocomplete::-webkit-scrollbar-track {
    background: var(--md-sys-color-surface-variant);
}

/* ========================================== */
/* ADMIN PANEL STYLES (v0.9.0+) */
/* ========================================== */

/* Tabs Navigation */
.md-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--md-sys-color-outline-variant);
    margin-bottom: 24px;
    overflow-x: auto;
}

.md-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    white-space: nowrap;
}

.md-tab:hover {
    background-color: var(--md-sys-color-secondary-container);
}

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

.md-tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.md-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Stats Grid (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-2);
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    background-color: var(--md-sys-color-primary-container);
    transform: translateY(-4px);
    box-shadow: var(--md-sys-elevation-3);
}

.stat-card.clickable:active {
    transform: translateY(-2px);
}

.stat-card .material-icons {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    margin-bottom: 12px;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--md-sys-color-on-surface);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters-bar .md-text-field {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: var(--md-sys-color-surface-variant);
}

.admin-table th {
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    border-bottom: 2px solid var(--md-sys-color-outline);
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.admin-table tbody tr:hover {
    background-color: var(--md-sys-color-secondary-container);
}

/* Badges */
.badge-admin {
    display: inline-block;
    padding: 2px 8px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

.badge-success {
    display: inline-block;
    padding: 4px 8px;
    background: #4CAF50;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-warning {
    display: inline-block;
    padding: 4px 8px;
    background: #FF9800;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-error {
    display: inline-block;
    padding: 4px 8px;
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px;
}

.pagination button {
    min-width: 100px;
}

/* Backup Section */
.backup-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    padding: 16px;
}

.backup-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 12px;
    text-align: center;
}

.backup-option h3 {
    margin: 16px 0 8px 0;
    color: var(--md-sys-color-on-surface);
}

.backup-option p {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
}

.backup-option button {
    margin-top: 8px;
}

/* Status Messages */
.status-message {
    margin-top: 16px;
}

.alert-success {
    padding: 12px;
    background: #E8F5E9;
    border-left: 4px solid #4CAF50;
    border-radius: 4px;
    color: #1B5E20;
}

.alert-error {
    padding: 12px;
    background: var(--md-sys-color-error-container);
    border-left: 4px solid var(--md-sys-color-error);
    border-radius: 4px;
    color: var(--md-sys-color-on-error-container);
}

.alert-info {
    padding: 12px;
    background: #E3F2FD;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
    color: #0D47A1;
}

/* Config Items */
.config-item {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.config-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* Admin Modal Styles (overlay style like MFA Modal) */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s;
}

.admin-modal .md-card {
    box-shadow: var(--md-sys-elevation-3);
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Error button variant (filled - for CRITICAL actions) */
.md-btn-error {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.md-btn-error:hover {
    background-color: #A00000;
}

/* Warning button variant (filled - for DANGEROUS actions) */
.md-btn-warning {
    background-color: var(--md-sys-color-warning);
    color: var(--md-sys-color-on-warning);
}

.md-btn-warning:hover {
    background-color: #E65100;
}

/* Icon button spacing in tables */
.admin-table td .md-icon-btn {
    margin-right: 4px;
}

.admin-table td .md-icon-btn:last-child {
    margin-right: 0;
}

/* Icon button error variant (CRITICAL actions - irreversible) */
.md-icon-btn-error {
    color: var(--md-sys-color-error);
}

.md-icon-btn-error:hover {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* Icon button warning variant (DANGEROUS actions - high impact) */
.md-icon-btn-warning {
    color: var(--md-sys-color-warning);
}

.md-icon-btn-warning:hover {
    background-color: var(--md-sys-color-warning-container);
    color: var(--md-sys-color-on-warning-container);
}

/* Responsive */
@media (max-width: 768px) {
    .md-tabs {
        overflow-x: scroll;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filters-bar .md-text-field {
        width: 100%;
    }

    .backup-section {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 14px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px;
    }
}

/* Modal overlay for delete confirmation */
.md-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.md-modal {
    background: var(--md-sys-color-surface);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.2s ease-out;
}

.md-modal-header {
    padding: 24px 24px 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.md-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--md-sys-color-on-surface);
}

.md-modal-body {
    padding: 0 24px 24px 24px;
    color: var(--md-sys-color-on-surface-variant);
}

.md-warning-box {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    padding: 16px;
    border-radius: 12px;
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

.md-warning-box .material-icons {
    color: var(--md-sys-color-error);
    flex-shrink: 0;
}

.md-modal-actions {
    padding: 0 24px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

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

@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translate(-50%, 0);
        opacity: 1;
    }

    to {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
}

/* ===== Landing Page Styles (v0.12.0) ===== */
.landing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

.hero-section {
    text-align: center;
    padding: 80px 0 60px;
}

.hero-section h1 {
    font-size: 48px;
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--md-sys-color-on-surface);
}

.hero-section>p {
    font-size: 20px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
}

.md-btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

.existing-user {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

.existing-user a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
}

.existing-user a:hover {
    text-decoration: underline;
}

/* Features Section */
.features-section {
    padding: 60px 0;
}

.features-section>h2 {
    text-align: center;
    font-size: 32px;
    font-weight: 400;
    margin-bottom: 48px;
    color: var(--md-sys-color-on-surface);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.feature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
}

.feature-image-placeholder {
    width: 100%;
    height: auto;
    background: transparent;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.feature-image-placeholder img {
    width: 100%;
    height: auto;
    display: block;
}

.feature-image-placeholder .material-icons {
    font-size: 80px;
    color: var(--md-sys-color-primary);
}

.feature-card h3 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--md-sys-color-on-surface);
}

.feature-card p {
    font-size: 20px;
    line-height: 1.6;
    color: var(--md-sys-color-on-surface-variant);
}

/* Trust Section */
.trust-section {
    text-align: center;
    padding: 40px 24px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 12px;
    margin-top: 40px;
}

.trust-section h3 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--md-sys-color-on-surface);
}

.trust-section p {
    font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Enterprise Page */
.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 32px;
    }

    .hero-section>p {
        font-size: 16px;
    }

    .cta-buttons {
        flex-direction: column;
        width: 100%;
    }

    .cta-buttons .md-btn {
        width: 100%;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .landing-container {
        padding: 24px 16px;
    }

    .hero-section {
        padding: 40px 0 30px;
    }
}