/* =============================================
   Dashboard Theme - CSS Custom Properties
   (Ported from figma_code/styles/theme.css)
   ============================================= */

:root {
    --font-size: 16px;
    --background: #ffffff;
    --foreground: #0a0a0f;
    --card: #ffffff;
    --card-foreground: #0a0a0f;
    --primary: #030213;
    --primary-foreground: #ffffff;
    --secondary: #f1f1f5;
    --secondary-foreground: #030213;
    --muted: #ececf0;
    --muted-foreground: #717182;
    --accent: #e9ebef;
    --accent-foreground: #030213;
    --destructive: #d4183d;
    --destructive-foreground: #ffffff;
    --border: rgba(0, 0, 0, 0.1);
    --input-background: #f3f3f5;
    --ring: #a8a8b3;
    --radius: 0.625rem;
    --sidebar: #fafafa;
    --sidebar-foreground: #0a0a0f;
    --sidebar-primary: #030213;
    --sidebar-primary-foreground: #fafafa;
    --sidebar-accent: #f5f5f7;
    --sidebar-accent-foreground: #303030;
    --sidebar-border: #e8e8ec;
    --sidebar-ring: #a8a8b3;
}

.dark {
    --background: #0d0d12;
    --foreground: #f8f8fc;
    --card: #0d0d12;
    --card-foreground: #f8f8fc;
    --primary: #f8f8fc;
    --primary-foreground: #1a1a26;
    --secondary: #1f1f2e;
    --secondary-foreground: #f8f8fc;
    --muted: #1f1f2e;
    --muted-foreground: #8888a8;
    --accent: #1f1f2e;
    --accent-foreground: #f8f8fc;
    --destructive: #4a1020;
    --destructive-foreground: #e05070;
    --border: #1f1f2e;
    --input-background: #1f1f2e;
    --ring: #5a5a7a;
    --sidebar: #141420;
    --sidebar-foreground: #f8f8fc;
    --sidebar-primary: #5a7aff;
    --sidebar-primary-foreground: #f8f8fc;
    --sidebar-accent: #1f1f2e;
    --sidebar-accent-foreground: #f8f8fc;
    --sidebar-border: #1f1f2e;
    --sidebar-ring: #5a5a7a;
}

/* =============================================
   Base Styles
   ============================================= */

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-size);
    background-color: var(--background);
    color: var(--foreground);
    height: 100%;
    margin: 0;
    padding: 0;
}

* {
    box-sizing: border-box;
}

/* =============================================
   Blazor Error UI
   ============================================= */

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* =============================================
   Toast Notifications
   ============================================= */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toast-slide-in 0.2s ease-out;
    max-width: 24rem;
}

.toast-success {
    background: #166534;
    color: #dcfce7;
    border: 1px solid #15803d;
}

.toast-error {
    background: #991b1b;
    color: #fee2e2;
    border: 1px solid #b91c1c;
}

.toast-info {
    background: #1e40af;
    color: #dbeafe;
    border: 1px solid #1d4ed8;
}

@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* =============================================
   Quick Settings Panel (slide-out)
   ============================================= */

.quick-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.quick-settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 20rem;
    background: var(--card);
    border-left: 1px solid var(--border);
    z-index: 1001;
    overflow-y: auto;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    animation: slide-in-right 0.2s ease-out;
}

@keyframes slide-in-right {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* =============================================
   Confirm Dialog
   ============================================= */

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 28rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* =============================================
   Shared form input utility
   ============================================= */

.input-field {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--input-background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--foreground);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-field:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.input-field.border-red-500:focus {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

/* =============================================
   Widget drag states
   ============================================= */

.widget-dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.widget-drag-over {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.05);
}

/* =============================================
   Scrollbar styling (dark mode friendly)
   ============================================= */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: 3px;
    opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
    opacity: 1;
}
