/* StaffAI Custom Styles */
/* Enterprise Glassmorphism Design System */

/* ========================================
   Z-INDEX SCALE
   ======================================== */

:root {
    --z-dropdown: 30;
    --z-sidebar-overlay: 40;
    --z-sidebar: 50;
    --z-header: 50;
    --z-context-menu: 60;
}

/* ========================================
   FULL HEIGHT LAYOUT
   ======================================== */

html, body {
    height: 100%;
}

/* ========================================
   ALPINE.JS CLOAK (Prevent FOUC)
   ======================================== */

[x-cloak] {
    display: none !important;
}

/* ========================================
   GLASSMORPHISM UTILITIES
   ======================================== */

/* Glass Card - Standard */
.glass-card {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.dark .glass-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(51, 65, 85, 0.5);
}

/* Glass Card - Light */
.glass-card-light {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.dark .glass-card-light {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(51, 65, 85, 0.5);
}

/* Glass Card - Strong */
.glass-card-strong {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.dark .glass-card-strong {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(51, 65, 85, 0.5);
}

/* Glass Dropdown */
.glass-dropdown {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.dark .glass-dropdown {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(51, 65, 85, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* ========================================
   ACCESSIBILITY - REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   FOCUS RING STYLES (A11Y)
   ======================================== */

/* Visible focus ring for keyboard navigation */
*:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* Remove default focus outline when not using keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Custom focus ring for buttons */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
    border-radius: 0.375rem;
}

/* Focus ring for form inputs */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: 0;
    border-color: transparent;
}

/* ========================================
   HTMX LOADING INDICATOR
   ======================================== */

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: block;
}

.htmx-request.htmx-indicator {
    display: block;
}

/* ========================================
   SMOOTH TRANSITIONS
   ======================================== */

* {
    transition-property: background-color, border-color, color, box-shadow, opacity;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   CUSTOM SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ========================================
   MESSAGE ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#messages-container > div {
    animation: fadeIn 0.3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    #messages-container > div {
        animation: none;
    }
}

/* ========================================
   PROSE / MARKDOWN STYLES
   ======================================== */

/* AI Message Content - Markdown Styles */
.ai-message-content {
    line-height: 1.75;
}

.ai-message-content p {
    margin-bottom: 0.75em;
}

.ai-message-content p:last-child {
    margin-bottom: 0;
}

.ai-message-content h1,
.ai-message-content h2,
.ai-message-content h3,
.ai-message-content h4 {
    font-weight: 600;
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}

.ai-message-content h1 { font-size: 1.5em; }
.ai-message-content h2 { font-size: 1.25em; }
.ai-message-content h3 { font-size: 1.125em; }

.ai-message-content ul,
.ai-message-content ol {
    padding-left: 1.5em;
    margin-bottom: 0.75em;
}

.ai-message-content ul {
    list-style-type: disc;
}

.ai-message-content ol {
    list-style-type: decimal;
}

.ai-message-content li {
    margin-bottom: 0.25em;
}

.ai-message-content a {
    color: #22c55e;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-message-content a:hover {
    color: #16a34a;
}

.ai-message-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875em;
    padding: 0.125em 0.375em;
    background: #f1f5f9;
    border-radius: 0.25rem;
}

.ai-message-content pre {
    background: #f1f5f9;
    border-radius: 0.5rem;
    padding: 1em;
    overflow-x: auto;
    margin-bottom: 0.75em;
}

.ai-message-content pre code {
    padding: 0;
    background: transparent;
}

.ai-message-content blockquote {
    border-left: 3px solid #22c55e;
    padding-left: 1em;
    margin-left: 0;
    margin-bottom: 0.75em;
    color: #64748b;
    font-style: italic;
}

.ai-message-content hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1em 0;
}

.ai-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75em;
}

.ai-message-content th,
.ai-message-content td {
    border: 1px solid #e2e8f0;
    padding: 0.5em 0.75em;
    text-align: left;
}

.ai-message-content th {
    background: #f1f5f9;
    font-weight: 600;
}

/* Dark Mode */
.dark .prose {
    color: #e2e8f0;
}

.dark .prose strong {
    color: #f8fafc;
}

.dark .ai-message-content code {
    color: #f8fafc;
    background: #334155;
}

.dark .ai-message-content pre {
    background: #1e293b;
}

.dark .ai-message-content blockquote {
    color: #94a3b8;
}

.dark .ai-message-content hr {
    border-top-color: #334155;
}

.dark .ai-message-content th,
.dark .ai-message-content td {
    border-color: #334155;
}

.dark .ai-message-content th {
    background: #1e293b;
}

/* ========================================
   TYPOGRAPHY - HEADING FONT
   ======================================== */

.font-heading {
    font-family: 'Poppins', system-ui, sans-serif;
}

/* ========================================
   SKIP LINK (A11Y)
   ======================================== */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #22c55e;
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* ========================================
   HIGH CONTRAST MODE SUPPORT
   ======================================== */

@media (prefers-contrast: high) {
    .glass-card,
    .glass-card-light,
    .glass-card-strong,
    .glass-dropdown {
        background: white;
        border: 2px solid black;
    }

    .dark .glass-card,
    .dark .glass-card-light,
    .dark .glass-card-strong,
    .dark .glass-dropdown {
        background: black;
        border: 2px solid white;
    }
}
