:root {
    /* Enhanced shadow system with more depth levels */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);

    /* Subtle border shadows - the "Linear look" */
    --border-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
    --border-shadow-hover: 0 0 0 1px rgba(0, 0, 0, 0.08);
    --border-shadow-subtle: 0 1px 0 rgba(0, 0, 0, 0.05);

    /* Animation timing functions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border radius scale */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
}

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* ============================================
   TABULAR FIGURES FOR DATA
   Numbers align vertically in tables and KPIs
   ============================================ */

.table td,
.kpi-value,
.data-value,
[data-numeric],
.numeric {
    font-variant-numeric: tabular-nums;
}

/* ============================================
   MONOSPACE FOR CODES & IDs
   Device IDs, transaction refs, etc.
   ============================================ */

.code,
.transaction-id,
.reference-id,
code,
kbd,
samp,
pre {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
    font-size: 0.875em;
    letter-spacing: -0.01em;
}

.code {
    padding: 0.125rem 0.375rem;
    background: var(--code-bg);
    border-radius: var(--radius-sm);
    color: var(--text-dark);
}

/* ============================================
   ENHANCED FOCUS STATES
   Modern, accessible focus indicators
   ============================================ */

/* Remove default outline globally, we'll add custom focus states */
*:focus {
    outline: none;
}

/* Custom focus-visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Button focus states */
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color), var(--shadow-sm);
}

/* Link focus states */
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Interactive elements with background change on focus */
.nav-item:focus-visible,
.dropdown-item:focus-visible {
    outline: none;
    background-color: var(--hover-bg);
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

/* Table row focus */
.table tbody tr:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

/* Card focus when interactive */
.clickable-row:focus-visible,
.kpi-card:focus-visible {
    outline: none;
    box-shadow: var(--shadow-md), 0 0 0 3px var(--focus-ring-color);
}

/* ============================================
   STATUS INDICATOR DOTS
   Elegant status indicators with pulse animation
   ============================================ */

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Active/Online - with pulse */
.status-dot.active::before,
.status-dot.online::before {
    background: var(--success-color);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: statusPulse 2s ease-in-out infinite;
}

/* Inactive/Offline */
.status-dot.inactive::before,
.status-dot.offline::before {
    background: var(--text-light);
    opacity: 0.5;
}

/* Warning */
.status-dot.warning::before {
    background: var(--warning-color);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    animation: statusPulse 2s ease-in-out infinite;
}

/* Error */
.status-dot.error::before {
    background: var(--error-color);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    animation: statusPulse 1.5s ease-in-out infinite;
}

/* Pending/Processing */
.status-dot.pending::before,
.status-dot.processing::before {
    background: var(--info-color);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    animation: statusPulse 1.5s ease-in-out infinite;
}

@keyframes statusPulse {
    0% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 0 4px transparent;
        opacity: 0.8;
    }
    100% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 1;
    }
}

/* Standalone dot (no text) */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.active,
.status-indicator.online {
    background: var(--success-color);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-indicator.inactive,
.status-indicator.offline {
    background: var(--text-light);
    opacity: 0.4;
}

.status-indicator.warning {
    background: var(--warning-color);
}

.status-indicator.error {
    background: var(--error-color);
}

/* ============================================
   AUTHENTICATION STYLES
   ============================================ */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg,
            rgba(var(--primary-rgb), 0.08) 0%,
            transparent 50%,
            rgba(var(--primary-rgb), 0.05) 100%),
        var(--background-color);
    padding: var(--space-4);
}

.auth-container .content-card {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
    user-select: none;
}

.auth-logo {
    height: 72px;
    width: auto;
    margin-bottom: var(--space-4);
    display: block;
    margin-left: auto;
    margin-right: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.auth-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 var(--space-2) 0;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--text-light);
    margin: 0;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.auth-subtitle::before,
.auth-subtitle::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-form .form-group {
    margin-bottom: var(--space-5);
}

.auth-form label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: var(--space-2);
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.auth-form .form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--input-bg);
    color: var(--text-dark);
    transition: all 0.2s var(--ease-in-out);
}

.auth-form .form-control:hover {
    border-color: var(--text-light);
}

.auth-form .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--focus-ring-color);
}

.auth-form .form-control:disabled {
    background-color: var(--disabled-bg);
    cursor: not-allowed;
    opacity: 0.7;
}

.auth-form textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.auth-toggle {
    text-align: center;
    margin-top: var(--space-6);
    color: var(--text-light);
    font-size: 0.875rem;
}

.auth-toggle a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s var(--ease-in-out);
}

.auth-toggle a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

.auth-help {
    text-align: center;
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.8125rem;
}

.auth-help a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-help a:hover {
    text-decoration: underline;
}

/* ============================================
   APP LAYOUT - Card-based sidebar design
   ============================================ */

.app-layout {
    min-height: 100vh;
    background:
        linear-gradient(135deg,
            rgba(var(--primary-rgb), 0.08) 0%,
            transparent 50%,
            rgba(var(--primary-rgb), 0.05) 100%),
        var(--background-color);
    display: flex;
    flex-direction: column;
}

/* Top Bar - Full width */
.top-bar {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 0 var(--space-6);
    margin: var(--space-5) var(--space-5) 0 var(--space-5);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    position: relative;
}

.top-bar-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.title-separator {
    color: var(--text-light);
    font-weight: 300;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.page-subtitle {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-light);
    line-height: 1.3;
}

.top-bar-left {
    display: flex;
    align-items: center;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-info {
    text-align: right;
}

/* Top Bar Action Icons */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s var(--ease-in-out);
}

.icon-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-dark);
}

.icon-btn.logout:hover {
    background-color: var(--error-color);
    color: white;
}

/* Theme Picker */
.theme-picker {
    position: relative;
    margin-right: calc(-1 * var(--space-2));
}

.theme-popover {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-1);
    z-index: 1000;
    animation: dropdownSlideIn 0.2s var(--ease-out-expo);
    min-width: 140px;
}

.theme-option {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 0.875rem;
    text-align: left;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s var(--ease-in-out);
}

.theme-option:hover {
    background-color: var(--hover-bg);
}

.theme-option.active {
    background-color: var(--primary-color);
    color: white;
}

/* System Status Indicator */
.status-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 36px;
    margin-right: var(--space-5);
}

.status-popover {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: dropdownSlideIn 0.2s var(--ease-out-expo);
    min-width: 320px;
    max-width: 420px;
    padding: 0 var(--space-3);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
}

.status-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-dark);
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

.status-badge.health-operational {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success-color, #22c55e);
}

.status-badge.health-degraded {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color, #f59e0b);
}

.status-badge.health-outage {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color, #ef4444);
}

.status-badge.health-unknown {
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--text-light);
}

.status-divider {
    height: 1px;
    background-color: var(--border-color);
}

.status-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.status-table th {
    padding: var(--space-2);
    font-weight: 500;
    color: var(--text-light);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.status-table td {
    padding: var(--space-2);
    text-align: center;
}

.status-table td.service-name {
    text-align: left;
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
}

.status-table .status-cell {
    font-size: 0.875rem;
}

.status-table .health-operational {
    color: var(--success-color, #22c55e);
}

.status-table .health-degraded {
    color: var(--warning-color, #f59e0b);
}

.status-table .health-outage {
    color: var(--danger-color, #ef4444);
}

.status-table .health-unknown {
    color: var(--text-light);
}

.status-table .not-deployed {
    color: var(--border-color);
}


.status-table tbody tr:hover {
    background-color: var(--hover-bg);
}

.status-footer {
    padding: var(--space-2) var(--space-4) var(--space-3);
    display: flex;
    justify-content: flex-end;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
    color: var(--text-light);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s var(--ease-in-out);
}

.refresh-btn:hover:not(:disabled) {
    background-color: var(--hover-bg);
    color: var(--text-dark);
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.company-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.3;
}

.user-email {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* Brand Logo in Top Bar */
.brand-logo {
    display: flex;
    align-items: center;
    margin-right: var(--space-4);
}

.brand-logo img {
    height: 28px;
    width: auto;
}

/* Main Area - Contains sidebar card and content */
.main-area {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: var(--space-5);
    padding: var(--space-5);
    overflow: hidden;
}

/* Sidebar Card */
.sidebar-card {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: fit-content;
    max-height: calc(100vh - 56px - var(--space-5) - var(--space-5));
}

.sidebar-card .sidebar-nav {
    flex: 1;
    padding: var(--space-3);
    overflow-y: auto;
}

.sidebar-card .nav-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    margin: 1px 0;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.2s var(--ease-out-quart);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 450;
    border-radius: var(--radius-sm);
}

.sidebar-card .nav-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.sidebar-card .nav-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

.sidebar-card .nav-item i {
    width: 1.25rem;
    margin-right: 0.625rem;
    font-size: 0.875rem;
    opacity: 0.7;
}

.sidebar-card .nav-item:hover i,
.sidebar-card .nav-item.active i {
    opacity: 1;
}

.sidebar-card .nav-separator {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-2) 0;
}


/* Content Area */
.content-area {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding-bottom: var(--space-8);
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.75rem 1.375rem;
    font-size: 0.875rem;
    font-weight: 550;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    position: relative;
    transform: translateZ(0);
    transition: all 0.2s var(--ease-out-quart);
    letter-spacing: 0.01em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb, 34, 142, 232), 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:focus,
.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px var(--focus-ring-color);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-dark);
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--hover-bg);
    border-color: var(--text-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 100%;
    font-weight: 450;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--sidebar-text-hover);
    border-color: rgba(255, 255, 255, 0.25);
}

.w-100 {
    width: 100%;
}

/* ============================================
   ALERT STYLES
   ============================================ */

.alert {
    padding: 1rem 1.25rem;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 450;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-danger {
    background-color: var(--alert-error-bg);
    color: var(--alert-error-text);
    border-color: var(--alert-error-border);
}

.alert-success {
    background-color: var(--alert-success-bg);
    color: var(--alert-success-text);
    border-color: var(--alert-success-border);
}

.alert-success.login-success {
    padding: var(--space-6);
    margin: var(--space-6) 0;
    font-size: 0.9375rem;
    text-align: center;
    border-radius: var(--radius-lg);
    background-color: #D1FAE5;
    border-color: #34D399;
    color: #065F46;
}

.alert-info {
    background-color: var(--alert-info-bg);
    color: var(--alert-info-text);
    border-color: var(--alert-info-border);
    padding: var(--space-6);
    margin: var(--space-6) 0;
    font-size: 0.9375rem;
    text-align: center;
    border-radius: var(--radius-lg);
}

/* ============================================
   FORM STYLES
   ============================================ */

.validation-message {
    color: var(--error-color);
    font-size: 0.8125rem;
    margin-top: var(--space-1);
    font-weight: 450;
}

.invalid {
    border-color: var(--error-color) !important;
}

.valid.modified:not([type=checkbox]) {
    border-color: var(--success-color) !important;
}

/* Form control base styles */
.form-control {
    background-color: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-dark);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s var(--ease-in-out);
    width: 100%;
}

.form-control:hover {
    border-color: var(--text-light);
}

.form-control:focus,
.form-control:focus-visible {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring-color), var(--shadow-sm);
}

.form-control::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* Select styles */
select.form-control,
.form-select {
    background-color: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-dark);
    border-radius: var(--radius-md);
    padding: 0.5rem 2.25rem 0.5rem 0.875rem;
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23718096' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 0.875rem;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner-border {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: middle;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.65s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.me-2 {
    margin-right: var(--space-2);
}

.text-muted {
    color: var(--text-light);
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--error-color);
}

/* ============================================
   BLAZOR ERROR UI
   ============================================ */

#blazor-error-ui {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 2px solid #f59e0b;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--radius-md);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ============================================
   LOADING PROGRESS
   ============================================ */

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-color, #e0e0e0);
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary-color, #228EE8);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.1s ease-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ============================================
   CONTENT CARD STYLES
   ============================================ */

.content-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    position: relative;
    letter-spacing: -0.01em;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: var(--radius-full);
}


/* ============================================
   TABLE STYLES
   ============================================ */

.table-responsive {
    border: none;
    border-radius: 0;
}

.table {
    border-collapse: separate;
    border-spacing: 0;
    border: none;
}

.table thead th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    border-bottom: 2px solid var(--border-color);
    padding: var(--space-2) var(--space-3);
}

.table tbody tr {
    transition: all 0.15s var(--ease-in-out);
}

.table tbody tr:hover {
    background-color: var(--table-row-hover);
}

.table tbody td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

/* Clickable row styles */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: var(--hover-bg);
}

/* Better table header visibility for dark themes */
[data-theme*="Dark"] .table thead th {
    background-color: rgba(255, 255, 255, 0.06);
    border-bottom: 2px solid rgba(255, 255, 255, 0.12);
    color: var(--text-light);
}

/* ============================================
   MODAL STYLES (with Glassmorphism)
   ============================================ */

.modal-content {
    background: rgba(var(--surface-rgb, 255, 255, 255), 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Slide-up animation for modals */
.modal.show .modal-dialog {
    transform: translateY(0);
    opacity: 1;
}

.modal-dialog {
    transform: translateY(24px);
    opacity: 0;
    transition: all 0.35s var(--ease-out-expo);
}

.modal-dialog.modal-wide {
    max-width: 900px;
}

.modal-header {
    background: var(--surface-color);
    padding: var(--space-6) var(--space-6) var(--space-4) var(--space-6);
    border-bottom: none;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 650;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    margin: 0;
    padding-bottom: var(--space-3);
    position: relative;
    width: 100%;
}

.modal-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: var(--radius-full);
}

.modal-body {
    padding: var(--space-6);
    background: var(--surface-color);
}

.modal-header + .modal-body {
    padding-top: var(--space-4);
}

.modal-footer {
    background: var(--surface-color);
    padding: var(--space-4) var(--space-6);
    border-top: none;
    gap: var(--space-3);
}

.modal-footer .btn-sm,
.content-card .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.modal-separator {
    height: 1px;
    background: var(--border-color);
    margin-top: var(--space-4);
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
}

/* ============================================
   NAV PILLS & TABS
   ============================================ */

.step-wizard {
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
}

.nav-pills .nav-link {
    transition: all 0.2s var(--ease-out-quart);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
}

.nav-pills .nav-link:hover {
    background-color: var(--hover-bg);
}

.nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    box-shadow: 0 2px 8px rgba(var(--primary-rgb, 34, 142, 232), 0.3);
}

/* ============================================
   DROPDOWN STYLES (with Glassmorphism)
   ============================================ */

.dropdown-menu {
    background: rgba(var(--surface-rgb, 255, 255, 255), 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: var(--space-2);
    animation: dropdownSlideIn 0.2s var(--ease-out-expo);
}

.dropdown-item {
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.15s var(--ease-in-out);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--hover-bg);
    color: var(--text-dark);
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   BADGE STYLES
   ============================================ */

.badge {
    font-size: 0.75rem;
    font-weight: 550;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    transition: all 0.2s var(--ease-in-out);
}

.badge:hover {
    transform: translateY(-1px);
}

/* ============================================
   INPUT GROUP
   ============================================ */

.input-group {
    position: relative;
}

.input-group:focus-within {
    border-radius: var(--radius-md);
}

.input-group .form-control {
    border-radius: var(--radius-md);
}

.input-group .form-control:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .form-control:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group-text {
    background-color: var(--hover-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    gap: var(--space-1);
}

.pagination .page-link {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
    transition: all 0.2s var(--ease-out-quart);
}

.pagination .page-link:hover {
    background-color: var(--hover-bg);
    border-color: var(--text-light);
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb, 34, 142, 232), 0.3);
}

/* ============================================
   SCROLLBAR HIDING
   ============================================ */

html, body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

/* ============================================
   LINK STYLES
   ============================================ */

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s var(--ease-in-out);
}

a:hover {
    color: var(--link-hover);
}

/* ============================================
   DIVIDERS
   ============================================ */

hr {
    border: none;
    border-top: 1px solid var(--divider-color);
    margin: var(--space-6) 0;
}

/* ============================================
   AUTOCOMPLETE FIX
   ============================================ */

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-background-clip: text;
    -webkit-text-fill-color: var(--text-dark);
    transition: background-color 5000s ease-in-out 0s;
    box-shadow: inset 0 0 20px 20px var(--input-bg);
}

/* ============================================
   BOOTSTRAP THEME OVERRIDES
   ============================================ */

[data-theme="dark"] .text-muted { color: var(--text-light) !important; }
[data-theme="dark"] .text-danger { color: #FCA5A5 !important; }
[data-theme="dark"] .bg-light { background-color: var(--surface-color) !important; }
[data-theme="dark"] .bg-white { background-color: var(--surface-color) !important; }

[data-theme="blue"] .text-muted { color: var(--text-light) !important; }
[data-theme="restaurant"] .text-muted { color: var(--text-light) !important; }
[data-theme="contrast"] .text-muted { color: var(--text-light) !important; }

.nav-text {
    white-space: nowrap;
}

/* Top bar left section */
.top-bar-left {
    display: flex;
    align-items: center;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: rgba(var(--surface-rgb, 255, 255, 255), 0.9);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    min-width: 320px;
    max-width: 420px;
    pointer-events: auto;
    transform: translateX(0);
    opacity: 1;
    transition: all 0.3s var(--ease-out-expo);
}

.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast.show {
    animation: toastSlideIn 0.3s var(--ease-out-expo);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: #ECFDF5;
    color: var(--success-color);
}

.toast.error .toast-icon {
    background: #FEF2F2;
    color: var(--error-color);
}

.toast.warning .toast-icon {
    background: #FFFBEB;
    color: var(--warning-color);
}

.toast.info .toast-icon {
    background: #EFF6FF;
    color: var(--info-color);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-light);
    line-height: 1.4;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s var(--ease-in-out);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--hover-bg);
    color: var(--text-dark);
}

/* ============================================
   TABLE ROW ACTIONS (Hover Reveal)
   ============================================ */

.table-actions {
    opacity: 0;
    transition: opacity 0.15s var(--ease-in-out);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

.table tbody tr:hover .table-actions {
    opacity: 1;
}

.table-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--hover-bg);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s var(--ease-in-out);
}

.table-action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.table-action-btn.danger:hover {
    background: var(--error-color);
}

/* Always show on mobile */
@media (max-width: 768px) {
    .table-actions {
        opacity: 1;
    }
}

/* ============================================
   KPI CARDS
   ============================================ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.kpi-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm), var(--border-shadow);
    border: none;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--kpi-color, var(--primary-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease-out-expo);
}

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

.kpi-card:hover::before {
    transform: scaleX(1);
}

.kpi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--kpi-bg, var(--hover-bg));
    color: var(--kpi-color, var(--primary-color));
    font-size: 1.125rem;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
}

.kpi-trend.up {
    background: #ECFDF5;
    color: var(--success-color);
}

.kpi-trend.down {
    background: #FEF2F2;
    color: var(--error-color);
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: var(--space-1);
}

/* KPI color variants */
.kpi-card.primary { --kpi-color: var(--primary-color); --kpi-bg: #EFF6FF; }
.kpi-card.success { --kpi-color: var(--success-color); --kpi-bg: #ECFDF5; }
.kpi-card.warning { --kpi-color: var(--warning-color); --kpi-bg: #FFFBEB; }
.kpi-card.error { --kpi-color: var(--error-color); --kpi-bg: #FEF2F2; }

/* ============================================
   ACTIVITY FEED
   ============================================ */

.activity-feed {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.activity-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s var(--ease-in-out);
}

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

.activity-item:hover {
    background: var(--hover-bg);
}

.activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--hover-bg);
    color: var(--text-light);
    flex-shrink: 0;
}

.activity-icon.success {
    background: #ECFDF5;
    color: var(--success-color);
}

.activity-icon.error {
    background: #FEF2F2;
    color: var(--error-color);
}

.activity-icon.warning {
    background: #FFFBEB;
    color: var(--warning-color);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.875rem;
    color: var(--text-dark);
    line-height: 1.4;
}

.activity-text strong {
    font-weight: 600;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 1200px) {
    .content-area {
        padding: var(--space-6);
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .sidebar-collapsed .sidebar {
        width: 72px;
    }

    .sidebar-collapsed .main-content {
        margin-left: 72px;
    }

    .top-bar {
        padding: var(--space-4) var(--space-6);
    }

    .toast-container {
        right: var(--space-4);
        left: var(--space-4);
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
    }

    .sidebar-collapsed .sidebar {
        width: 64px;
    }

    .sidebar-collapsed .main-content {
        margin-left: 64px;
    }

    .content-area {
        padding: var(--space-4);
    }

    .page-title {
        font-size: 1.375rem;
    }

    .company-name {
        font-size: 0.875rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   REUSABLE COMPONENT STYLES
   ============================================ */

/* --------------------------------------------
   Search & Filter Controls
   -------------------------------------------- */

.search-controls,
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    max-width: 400px;
}

.filter-dropdown {
    min-width: 200px;
}

.date-picker {
    width: 180px;
}

/* --------------------------------------------
   Clickable Table Rows
   -------------------------------------------- */

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: var(--table-row-hover);
}

/* --------------------------------------------
   Section Header
   -------------------------------------------- */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* --------------------------------------------
   Placeholder Content
   -------------------------------------------- */

.placeholder-content {
    text-align: center;
    padding: 3rem;
}

/* --------------------------------------------
   JSON Editor
   Used by: Integrations, Settings
   -------------------------------------------- */

.json-editor-wrapper {
    position: relative;
    display: grid;
    min-height: 200px;
}

.json-editor {
    background: transparent;
    color: transparent;
    caret-color: var(--text-dark);
    grid-area: 1 / 1;
    z-index: 2;
    resize: none;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.375rem 0.75rem;
    border: 1px solid transparent;
    min-height: 200px;
    height: auto;
}

.json-editor:focus {
    background: transparent;
    color: transparent;
    outline: none;
    box-shadow: none;
}

.json-preview {
    grid-area: 1 / 1;
    padding: 0.375rem 0.75rem;
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background-color: var(--input-bg);
    min-height: 200px;
    z-index: 1;
}

.json-preview .json-key {
    color: #0969da;
    font-weight: 600;
}

.json-preview .json-string {
    color: #0a3069;
}

.json-preview .json-number {
    color: #0550ae;
}

.json-preview .json-boolean {
    color: #cf222e;
    font-weight: 600;
}

.json-preview .json-null {
    color: #6e7781;
    font-weight: 600;
}

.json-preview .json-punctuation {
    color: #24292f;
}

.json-preview.json-error {
    color: #cf222e;
    white-space: pre-wrap;
}

.json-editor:focus + .json-preview {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem var(--focus-ring-color);
}

/* Smaller variant for Settings page */
.json-editor-wrapper.small {
    min-height: 100px;
}

.json-editor-wrapper.small .json-editor,
.json-editor-wrapper.small .json-preview {
    min-height: 100px;
}

/* --------------------------------------------
   Help Tooltips
   Used by: OrderConfig, DeviceProfiles, StsTokens
   -------------------------------------------- */

.help-icon {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.help-tooltip {
    visibility: hidden;
    width: 250px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1050;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
    font-weight: normal;
    line-height: 1.4;
}

.help-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.help-icon:hover .help-tooltip {
    visibility: visible;
    opacity: 1;
}

/* Show tooltip when hovering over form-check container */
.form-check-with-tooltip {
    position: relative;
}

.form-check-with-tooltip:hover .help-tooltip {
    visibility: visible;
    opacity: 1;
}

.form-check-with-tooltip label,
.form-check-with-tooltip .form-label {
    position: relative;
}

/* --------------------------------------------
   RVC Checkbox Group
   Used by: OrderConfig, DeviceProfiles
   -------------------------------------------- */

.rvc-checkbox-group {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
}

.rvc-checkbox-group .form-check {
    margin-bottom: 0.25rem;
}

.rvc-checkbox-group .form-check:last-child {
    margin-bottom: 0;
}

/* --------------------------------------------
   Section Navigation Tabs
   Used by: DeviceProfiles
   -------------------------------------------- */

.section-nav {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.section-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.section-tab:hover {
    color: var(--primary-color);
}

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

.section-content {
    min-height: 300px;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------
   Device Status Indicators
   Used by: Devices
   -------------------------------------------- */

.profile-status-green {
    color: var(--success-color);
}

.profile-status-yellow {
    color: var(--warning-color);
}

.profile-status-red {
    color: var(--error-color);
}

.reassign-icon {
    cursor: pointer;
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.reassign-icon:hover {
    color: var(--text-dark);
}

.battery-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.charging-icon {
    color: var(--success-color);
    font-size: 0.875rem;
}

/* --------------------------------------------
   Sortable Table Headers
   Used by: Devices
   -------------------------------------------- */

.sort-header {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sort-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.sort-arrow {
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

/* --------------------------------------------
   Activity Entry Badges
   Used by: Activity
   -------------------------------------------- */

.entry-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    background-color: var(--text-light);
    color: white;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.entry-badge.pos {
    background-color: var(--primary-color);
}

.entry-badge.sts {
    background-color: var(--info-color);
}

.entry-badge.softpay {
    background-color: var(--success-color);
}

.entry-badge.viva {
    background-color: #fd7e14;
}

.entry-badge.loyalty {
    background-color: #e91e8c;
}

.entry-badge.receipt {
    background-color: #6f42c1;
}

/* --------------------------------------------
   Activity Entry List
   Used by: Activity
   -------------------------------------------- */

.entry-list {
    max-height: 400px;
    overflow-y: auto;
}

.entry-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--surface-color);
    cursor: pointer;
}

.entry-header:hover {
    background-color: var(--hover-bg);
}

.entry-content {
    padding: 0.5rem;
    background-color: var(--background-color);
    max-height: 300px;
    overflow: auto;
}

.entry-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.8rem;
}

.time-badge {
    font-size: 0.75rem;
    color: var(--text-light);
}

.load-more-container {
    text-align: center;
    margin-top: 1rem;
}

/* --------------------------------------------
   Company Buttons
   Used by: UserConfiguration
   -------------------------------------------- */

.company-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.company-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--hover-bg);
    color: var(--text-dark);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.company-button:hover {
    background-color: var(--table-row-hover);
    border-color: var(--text-light);
}

.company-button-selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.company-button-selected:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.company-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* --------------------------------------------
   Billing Page Components
   Used by: Billing
   -------------------------------------------- */

.metric-box {
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.metric-box h3 {
    font-size: 2rem;
    font-weight: bold;
    margin: 0.5rem 0;
    color: var(--text-dark);
}

.metric-box p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

.monthly-total {
    background-color: var(--alert-info-bg);
    border: 1px solid var(--alert-info-border);
    color: var(--alert-info-text);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.monthly-total h4 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
}

.status-paid {
    color: var(--success-color);
}

.status-pending {
    color: var(--warning-color);
}

.status-overdue {
    color: var(--error-color);
}

/* --------------------------------------------
   Billing Overview Page
   Used by: BillingOverview
   -------------------------------------------- */

.progress-container {
    background-color: var(--hover-bg);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 2rem;
}

.progress-label {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-light);
}

.progress {
    height: 30px;
    background-color: var(--disabled-bg);
}

.progress-bar {
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.stat-detail {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* --------------------------------------------
   Downloads / Releases
   -------------------------------------------- */

.release-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--hover-bg);
    border-bottom: 1px solid var(--border-color);
}

.release-version {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.release-version h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
}

.release-type-stable {
    background-color: var(--success-color);
}

.release-type-beta {
    background-color: var(--warning-color);
    color: #000;
}

.release-type-alpha {
    background-color: var(--error-color);
}

.release-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.release-date {
    color: var(--text-light);
    font-size: 0.875rem;
}

.release-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.release-section h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.release-list {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.release-list li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.download-link,
.qr-code-link {
    color: var(--primary-color);
    font-size: 1.1rem;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
}

.download-link:hover,
.qr-code-link:hover {
    background-color: var(--hover-bg);
    color: var(--primary-hover);
}

.qr-code-link {
    margin-left: 4px;
}

.search-highlight {
    background-color: #fff59d;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* --------------------------------------------
   QR Modal
   Used by: Downloads
   -------------------------------------------- */

.qr-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 0;
    z-index: 1050;
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    width: 350px;
}

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

.qr-modal .modal-header h5 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.qr-modal .close-button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-modal .close-button:hover {
    color: var(--text-dark);
}

.qr-modal .modal-body {
    padding: 1.5rem;
    text-align: center;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.qr-url {
    font-size: 0.875rem;
    color: var(--text-light);
    word-break: break-all;
    margin: 0;
}

.version-label {
    margin-top: 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
}

/* --------------------------------------------
   Device Profile Custom Button
   Used by: DeviceProfiles
   -------------------------------------------- */

.btn-outline-custom {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: transparent;
}

.btn-outline-custom:hover {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.device-icon {
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.device-icon:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
    transform: scale(1.1);
}

/* --------------------------------------------
   Form Section
   -------------------------------------------- */

.form-section {
    margin-bottom: 1.5rem;
}

/* --------------------------------------------
   Responsive Adjustments
   -------------------------------------------- */

@media (max-width: 768px) {
    .search-controls,
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .date-picker {
        width: 100%;
    }

    .release-header {
        flex-direction: column;
        gap: 1rem;
    }

    .release-content {
        grid-template-columns: 1fr;
    }
}
