/**
 * Forecasting Brand Theme
 * Based on Forecast.ing Brand Guidelines
 *
 * Colors (converted to oklch for DaisyUI 5):
 * - Warm Black: #24171B → oklch(18.5% 0.02 350)
 * - Charcoal: #312F2F → oklch(26% 0.005 0)
 * - Warm Grey: #526C70 → oklch(47% 0.03 200)
 * - Orange: #FF911A → oklch(76% 0.18 60)
 * - Coral: #FA5559 → oklch(64% 0.22 20)
 * - Paper White: #F3F7F0 → oklch(97% 0.01 130)
 *
 * Typography: Plus Jakarta Sans (Google Font)
 */

/* Import Plus Jakarta Sans from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

/* Apply brand colors when no theme is set or system theme is selected */
:root:not([data-theme]),
:root[data-theme="system"] {
    color-scheme: light dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme]),
    :root[data-theme="system"] {
        /* Base colors - White cards on neutral gray background */
        --color-base-100: oklch(100% 0 0);      /* Pure white for cards/surfaces */
        --color-base-200: oklch(96% 0 0);       /* Light neutral gray */
        --color-base-300: oklch(92% 0 0);       /* Slightly darker gray */
        --color-base-content: oklch(18.5% 0.02 350);  /* Warm Black #24171B */

        /* Primary - Warm Grey #526C70 */
        --color-primary: oklch(47% 0.03 200);
        --color-primary-content: oklch(100% 0 0);  /* White */

        /* Secondary - Coral #FA5559 */
        --color-secondary: oklch(64% 0.22 20);
        --color-secondary-content: oklch(100% 0 0);  /* White */

        /* Accent - Orange #FF911A */
        --color-accent: oklch(76% 0.18 60);
        --color-accent-content: oklch(18.5% 0.02 350);  /* Warm Black */

        /* Neutral - Charcoal #312F2F */
        --color-neutral: oklch(26% 0.005 0);
        --color-neutral-content: oklch(97% 0.01 130);  /* Paper White */

        /* Semantic colors */
        --color-info: oklch(55% 0.15 240);      /* Blue - for contrast */
        --color-info-content: oklch(100% 0 0);
        --color-success: oklch(65% 0.19 150);   /* Green - slightly darker for contrast */
        --color-success-content: oklch(100% 0 0);
        --color-warning: oklch(70% 0.18 60);    /* Orange - slightly darker */
        --color-warning-content: oklch(18.5% 0.02 350);
        --color-error: oklch(64% 0.22 20);      /* Coral */
        --color-error-content: oklch(100% 0 0);

        /* Layout variables */
        --root-bg: oklch(96% 0 0);                /* Light neutral gray for main background */
        --layout-sidebar-background: oklch(100% 0 0);  /* White sidebar */
        --layout-topbar-background: oklch(100% 0 0);   /* White topbar */
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]),
    :root[data-theme="system"] {
        /* Base colors - Warm Black foundation */
        --color-base-100: oklch(18.5% 0.02 350);  /* Warm Black #24171B */
        --color-base-200: oklch(26% 0.005 0);     /* Charcoal #312F2F */
        --color-base-300: oklch(32% 0.005 0);     /* Lighter charcoal */
        --color-base-content: oklch(97% 0.01 130);  /* Paper White */

        /* Primary - Warm Grey (lighter variant for dark mode) */
        --color-primary: oklch(55% 0.03 200);
        --color-primary-content: oklch(100% 0 0);

        /* Secondary - Coral (slightly lighter for dark mode) */
        --color-secondary: oklch(68% 0.20 20);
        --color-secondary-content: oklch(18.5% 0.02 350);

        /* Accent - Orange */
        --color-accent: oklch(76% 0.18 60);
        --color-accent-content: oklch(18.5% 0.02 350);

        /* Neutral */
        --color-neutral: oklch(47% 0.03 200);
        --color-neutral-content: oklch(97% 0.01 130);

        /* Semantic colors */
        --color-info: oklch(60% 0.15 240);      /* Blue */
        --color-info-content: oklch(100% 0 0);
        --color-success: oklch(70% 0.19 150);   /* Green */
        --color-success-content: oklch(18.5% 0.02 350);
        --color-warning: oklch(76% 0.18 60);    /* Orange */
        --color-warning-content: oklch(18.5% 0.02 350);
        --color-error: oklch(68% 0.20 20);      /* Coral */
        --color-error-content: oklch(100% 0 0);

        /* Layout variables */
        --root-bg: oklch(18.5% 0.02 350);
        --layout-sidebar-background: oklch(26% 0.005 0);
        --layout-topbar-background: oklch(26% 0.005 0);
    }
}

/* Forecasting Light Theme */
[data-theme="forecasting"],
[data-theme="forecasting-light"],
:root[data-theme="light"] {
    color-scheme: light;

    /* Base colors - White cards on neutral gray background */
    --color-base-100: oklch(100% 0 0);      /* Pure white for cards/surfaces */
    --color-base-200: oklch(96% 0 0);       /* Light neutral gray */
    --color-base-300: oklch(92% 0 0);       /* Slightly darker gray */
    --color-base-content: oklch(18.5% 0.02 350);  /* Warm Black #24171B */

    /* Primary - Warm Grey #526C70 */
    --color-primary: oklch(47% 0.03 200);
    --color-primary-content: oklch(100% 0 0);  /* White */

    /* Secondary - Coral #FA5559 */
    --color-secondary: oklch(64% 0.22 20);
    --color-secondary-content: oklch(100% 0 0);  /* White */

    /* Accent - Orange #FF911A */
    --color-accent: oklch(76% 0.18 60);
    --color-accent-content: oklch(18.5% 0.02 350);  /* Warm Black */

    /* Neutral - Charcoal #312F2F */
    --color-neutral: oklch(26% 0.005 0);
    --color-neutral-content: oklch(97% 0.01 130);  /* Paper White */

    /* Semantic colors */
    --color-info: oklch(55% 0.15 240);      /* Blue - for contrast */
    --color-info-content: oklch(100% 0 0);
    --color-success: oklch(65% 0.19 150);   /* Green - slightly darker for contrast */
    --color-success-content: oklch(100% 0 0);
    --color-warning: oklch(70% 0.18 60);    /* Orange - slightly darker */
    --color-warning-content: oklch(18.5% 0.02 350);
    --color-error: oklch(64% 0.22 20);      /* Coral */
    --color-error-content: oklch(100% 0 0);

    /* Layout variables */
    --root-bg: oklch(96% 0 0);                /* Light neutral gray for main background */
    --layout-sidebar-background: oklch(100% 0 0);  /* White sidebar */
    --layout-topbar-background: oklch(100% 0 0);   /* White topbar */

    /* Borders and shadows */
    --rounded-box: 0.5rem;
    --rounded-btn: 0.375rem;
    --rounded-badge: 1rem;
}

/* Forecasting Dark Theme */
[data-theme="forecasting-dark"],
:root[data-theme="dark"] {
    color-scheme: dark;

    /* Base colors - Warm Black foundation */
    --color-base-100: oklch(18.5% 0.02 350);  /* Warm Black #24171B */
    --color-base-200: oklch(26% 0.005 0);     /* Charcoal #312F2F */
    --color-base-300: oklch(32% 0.005 0);     /* Lighter charcoal */
    --color-base-content: oklch(97% 0.01 130);  /* Paper White */

    /* Primary - Warm Grey (lighter variant for dark mode) */
    --color-primary: oklch(55% 0.03 200);
    --color-primary-content: oklch(100% 0 0);

    /* Secondary - Coral (slightly lighter for dark mode) */
    --color-secondary: oklch(68% 0.20 20);
    --color-secondary-content: oklch(18.5% 0.02 350);

    /* Accent - Orange */
    --color-accent: oklch(76% 0.18 60);
    --color-accent-content: oklch(18.5% 0.02 350);

    /* Neutral */
    --color-neutral: oklch(47% 0.03 200);
    --color-neutral-content: oklch(97% 0.01 130);

    /* Semantic colors */
    --color-info: oklch(60% 0.15 240);      /* Blue */
    --color-info-content: oklch(100% 0 0);
    --color-success: oklch(70% 0.19 150);   /* Green */
    --color-success-content: oklch(18.5% 0.02 350);
    --color-warning: oklch(76% 0.18 60);    /* Orange */
    --color-warning-content: oklch(18.5% 0.02 350);
    --color-error: oklch(68% 0.20 20);      /* Coral */
    --color-error-content: oklch(100% 0 0);

    /* Layout variables */
    --root-bg: oklch(18.5% 0.02 350);
    --layout-sidebar-background: oklch(26% 0.005 0);
    --layout-topbar-background: oklch(26% 0.005 0);

    /* Borders and shadows */
    --rounded-box: 0.5rem;
    --rounded-btn: 0.375rem;
    --rounded-badge: 1rem;
}

/* Apply Plus Jakarta Sans font globally */
[data-theme^="forecasting"],
[data-theme^="forecasting"] *,
[data-theme="light"],
[data-theme="light"] *,
[data-theme="dark"],
[data-theme="dark"] *,
:root:not([data-theme]),
:root:not([data-theme]) *,
:root[data-theme="system"],
:root[data-theme="system"] * {
    font-family: "Plus Jakarta Sans", sans-serif !important;
}

/* Override root background to use brand colors */
[data-theme^="forecasting"],
[data-theme="light"],
[data-theme="dark"],
:root:not([data-theme]),
:root[data-theme="system"] {
    background-color: var(--root-bg) !important;
}

:root[data-theme^="forecasting"],
html[data-theme^="forecasting"],
[data-theme="light"],
[data-theme="dark"],
:root:not([data-theme]),
html:not([data-theme]),
:root[data-theme="system"],
html[data-theme="system"] {
    background-color: var(--root-bg) !important;
}

/* ============================================
   Performance Optimizations
   Prevent layout thrashing from transition-all
   ============================================ */

/* Sidebar transitions - use specific properties instead of 'all' */
#layout-sidebar {
    transition-property: margin-inline-start, transform !important;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
    transition-duration: 200ms !important;
    will-change: margin-inline-start;
}

/* Backdrop transition - only animate opacity/background */
#layout-sidebar-backdrop {
    transition-property: background-color, opacity !important;
    transition-duration: 150ms !important;
}

/* Menu items - only animate colors, not layout */
.sidebar-menu .menu-item,
.sidebar-menu a,
.menu-item {
    transition-property: background-color, color !important;
    transition-duration: 150ms !important;
}

/* Cards and interactive elements - specific properties */
.card {
    transition-property: border-color, box-shadow !important;
    transition-duration: 150ms !important;
}

/* Collapse/accordion - don't animate height with 'all' */
.collapse .collapse-content {
    transition-property: max-height, opacity !important;
}

/* Reduce default transition duration globally for snappier feel */
:root {
    --default-transition-duration: 150ms;
}
