/*
 * ASSET Copilot - Custom Styles
 *
 * This file contains custom CSS overrides and additions.
 * Colors can be easily changed by modifying the CSS variables below.
 */

/* =============================================================================
   Theme Variables (Easy to customize)
   ============================================================================= */

:root {
    /* Primary Colors - Emerald (Warm & Friendly) */
    --color-primary: #10B981;
    --color-primary-dark: #059669;
    --color-primary-light: #34D399;
    --color-primary-50: #ECFDF5;
    --color-primary-100: #D1FAE5;

    /* Secondary Colors - Warm Amber */
    --color-secondary: #F59E0B;
    --color-secondary-dark: #D97706;
    --color-secondary-light: #FBBF24;

    /* Accent - Teal */
    --color-accent: #14B8A6;

    /* Semantic Colors */
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;

    /* Warm Neutral Base (Stone palette instead of cold gray) */
    --color-neutral: #44403C;
    --color-neutral-light: #78716C;
    --color-base-50: #FAFAF9;
    --color-base-100: #FFFFFF;
    --color-base-200: #F5F5F4;
    --color-base-300: #E7E5E4;

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* =============================================================================
   Typography Enhancements
   ============================================================================= */

body {
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   Chat Components
   ============================================================================= */

/* Chat bubble hover effect */
.chat-bubble {
    transition: transform 0.15s ease;
}

/* Markdown content in chat */
.chat-bubble .prose {
    font-size: 0.875rem;
    line-height: 1.6;
}

.chat-bubble .prose pre {
    background-color: var(--color-base-200);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    overflow-x: auto;
}

.chat-bubble .prose code {
    background-color: var(--color-base-200);
    padding: 0.125rem 0.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.8em;
}

.chat-bubble .prose pre code {
    background-color: transparent;
    padding: 0;
}

/* Chat input auto-resize */
.chat-input textarea {
    field-sizing: content;
    min-height: 2.5rem;
}

/* =============================================================================
   Card Enhancements
   ============================================================================= */

/* Stat card hover */
.stat {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

/* Insight card bullet points */
.insight-bullet {
    position: relative;
    padding-left: 1rem;
}

.insight-bullet::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 0.375rem;
    height: 0.375rem;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0.5;
}

/* =============================================================================
   Sidebar Enhancements
   ============================================================================= */

/* Active menu item with left border indicator - Emerald gradient */
.nav-item-active {
    background: linear-gradient(135deg, var(--color-primary-50), var(--color-primary-100));
    color: var(--color-primary-dark);
    font-weight: 500;
    position: relative;
    border-radius: 0.5rem;
}

.nav-item-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background-color: var(--color-primary);
    border-radius: 0 4px 4px 0;
}

/* Legacy active menu item */
.menu a.active,
.menu li > a.active {
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
    font-weight: 500;
}

/* Menu item hover */
.menu a:hover {
    background-color: var(--color-base-200);
}

/* =============================================================================
   Sidebar Tooltips (for collapsed state)
   ============================================================================= */

.tooltip-sidebar {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem 0.75rem;
    background-color: var(--color-neutral);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 100;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

/* Tooltip arrow */
.tooltip-sidebar::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--color-neutral);
}

/* Show tooltip on hover */
.group:hover .tooltip-sidebar {
    opacity: 1;
    visibility: visible;
}

/* =============================================================================
   Table Enhancements
   ============================================================================= */

/* Sortable table header */
.table th.sortable {
    cursor: pointer;
    user-select: none;
}

.table th.sortable:hover {
    background-color: var(--color-base-200);
}

/* Table row hover */
.table tbody tr {
    transition: background-color 0.15s ease;
}

/* =============================================================================
   Chart Container
   ============================================================================= */

.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}

.chart-container canvas {
    max-width: 100%;
}

/* =============================================================================
   Loading States
   ============================================================================= */

/* Skeleton loading */
.skeleton {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* =============================================================================
   Transitions & Animations
   ============================================================================= */

/* Smooth transitions for interactive elements */
.btn,
.card,
.input,
.select,
.textarea {
    transition: all 0.2s ease;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Slide in from right (for chat messages) */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

/* Slide in from left (for AI responses) */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

/* =============================================================================
   Scrollbar Styling
   ============================================================================= */

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-base-200);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--color-base-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--color-neutral) 30%, transparent);
}

/* =============================================================================
   Focus States (Accessibility)
   ============================================================================= */

/* Enhanced focus ring */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    .no-print,
    .sidebar,
    .navbar,
    .btn {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* =============================================================================
   Warm & Friendly Theme Enhancements
   ============================================================================= */

/* Warm page background */
.bg-warm {
    background-color: var(--color-base-50);
}

/* Enhanced card styling with warm shadows */
.card {
    border: 1px solid var(--color-base-300);
    box-shadow: 0 1px 3px rgba(68, 64, 60, 0.06), 0 1px 2px rgba(68, 64, 60, 0.04);
}

.card:hover {
    box-shadow: 0 4px 6px rgba(68, 64, 60, 0.07), 0 2px 4px rgba(68, 64, 60, 0.05);
}

/* Primary button with subtle gradient */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-color: var(--color-primary-dark);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark), #047857);
}

/* Warm hover states */
.hover\:bg-warm:hover {
    background-color: var(--color-base-200);
}

/* Badge enhancements */
.badge-primary {
    background-color: var(--color-primary-100);
    color: var(--color-primary-dark);
    border-color: var(--color-primary-light);
}

/* Table header with warm background */
.table thead th {
    background-color: var(--color-base-200);
    color: var(--color-neutral);
}

/* Sidebar logo background */
.sidebar-logo {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

/* Stat card value color */
.stat-value-primary {
    color: var(--color-primary);
}

/* Avatar ring */
.avatar-ring-primary {
    ring-color: var(--color-primary-light);
}

/* =============================================================================
   PREMIUM UI - 2025 Design System
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Glassmorphism
   ----------------------------------------------------------------------------- */

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-dark {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* -----------------------------------------------------------------------------
   Gradient Utilities
   ----------------------------------------------------------------------------- */

.bg-gradient-emerald {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.bg-gradient-emerald-light {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
}

.bg-gradient-emerald-dark {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.bg-gradient-emerald-radial {
    background: radial-gradient(circle at top right, #34D399 0%, #10B981 50%, #059669 100%);
}

/* Text gradient */
.text-gradient-emerald {
    background: linear-gradient(135deg, #059669, #10B981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* -----------------------------------------------------------------------------
   Premium Shadows
   ----------------------------------------------------------------------------- */

.shadow-emerald {
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.25);
}

.shadow-emerald-lg {
    box-shadow: 0 10px 40px -10px rgba(16, 185, 129, 0.35);
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.shadow-glow-sm {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.shadow-soft {
    box-shadow: 0 2px 8px rgba(68, 64, 60, 0.08), 0 4px 16px rgba(68, 64, 60, 0.04);
}

.shadow-soft-lg {
    box-shadow: 0 4px 16px rgba(68, 64, 60, 0.1), 0 8px 32px rgba(68, 64, 60, 0.06);
}

/* -----------------------------------------------------------------------------
   Hero Stat Cards
   ----------------------------------------------------------------------------- */

.stat-hero {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px -10px rgba(16, 185, 129, 0.4);
}

.stat-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.stat-hero-amber {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    box-shadow: 0 10px 40px -10px rgba(245, 158, 11, 0.4);
}

.stat-hero-sky {
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    box-shadow: 0 10px 40px -10px rgba(14, 165, 233, 0.4);
}

.stat-hero-violet {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    box-shadow: 0 10px 40px -10px rgba(139, 92, 246, 0.4);
}

.stat-hero .stat-icon {
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-hero .stat-title {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-hero .stat-value {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-hero .stat-change {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

.stat-hero .stat-change-positive {
    color: #86EFAC;
}

/* -----------------------------------------------------------------------------
   Mini Stat Cards
   ----------------------------------------------------------------------------- */

.stat-mini {
    background: white;
    border: 1px solid #E7E5E4;
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.2s ease;
}

.stat-mini:hover {
    border-color: #D1FAE5;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
    transform: translateY(-2px);
}

.stat-mini .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #059669;
}

.stat-mini .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #064E3B;
}

.stat-mini .stat-title {
    font-size: 0.75rem;
    color: #78716C;
    font-weight: 500;
}

/* -----------------------------------------------------------------------------
   Enhanced Tables
   ----------------------------------------------------------------------------- */

.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    background: linear-gradient(135deg, #FAFAF9, #F5F5F4);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: #78716C;
    padding: 0.875rem 1rem;
    border-bottom: 2px solid #E7E5E4;
    text-align: left;
}

.table-modern thead th:first-child {
    border-top-left-radius: 0.5rem;
}

.table-modern thead th:last-child {
    border-top-right-radius: 0.5rem;
}

.table-modern tbody tr {
    transition: all 0.15s ease;
}

.table-modern tbody tr:hover {
    background: linear-gradient(90deg, #ECFDF5 0%, transparent 100%);
}

.table-modern tbody td {
    padding: 1rem;
    border-bottom: 1px solid #F5F5F4;
    color: #44403C;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges for tables */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-status::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

.badge-status-success {
    background: #ECFDF5;
    color: #059669;
}

.badge-status-warning {
    background: #FFFBEB;
    color: #D97706;
}

.badge-status-error {
    background: #FEF2F2;
    color: #DC2626;
}

.badge-status-info {
    background: #EFF6FF;
    color: #2563EB;
}

/* -----------------------------------------------------------------------------
   Hover Animations
   ----------------------------------------------------------------------------- */

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.hover-glow {
    transition: box-shadow 0.2s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* -----------------------------------------------------------------------------
   Progress Ring (Mini Chart)
   ----------------------------------------------------------------------------- */

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    stroke: #E7E5E4;
}

.progress-ring-fill {
    stroke: #10B981;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

/* -----------------------------------------------------------------------------
   Bento Grid Helpers
   ----------------------------------------------------------------------------- */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 640px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
}

/* -----------------------------------------------------------------------------
   Card Variants
   ----------------------------------------------------------------------------- */

.card-modern {
    background: white;
    border: 1px solid #E7E5E4;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(68, 64, 60, 0.06);
    transition: all 0.2s ease;
}

.card-modern:hover {
    box-shadow: 0 8px 24px rgba(68, 64, 60, 0.1);
}

.card-accent-left {
    border-left: 4px solid #10B981;
}

.card-accent-top {
    border-top: 4px solid #10B981;
}

/* -----------------------------------------------------------------------------
   Typography Helpers
   ----------------------------------------------------------------------------- */

.text-heading {
    color: #022C22;
    font-weight: 700;
}

.text-subheading {
    color: #064E3B;
    font-weight: 600;
}

.text-muted {
    color: #78716C;
}

.text-xs-upper {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
