/* ============================================================================
   Daybreak - canonical token set (PR 8 Phase A.1)
   Mirrors the admin theme's DOCS/theme-standards/01_TOKENS.md contract so the
   customer portal and the admin share one palette.

   Scoping is dual to bridge legacy + new systems during the migration:

     :root[data-theme="dark"]  +  body.dark          -> dark values
     :root[data-theme="light"] +  body:not(.dark)    -> light values

   Default is LIGHT (customer-portal convention). Admin defaults to dark; we
   keep daybreak's existing light-first default so customers don't see a
   surprise dark page on first load until their theme preference is read.

   Daybreak's pre-existing variable names (--accent-color, --text-primary,
   --card-color, --bg-color, --error-color) stay aliased to canonical tokens
   at the bottom so the existing CSS in style.css / custom.css / variables.css
   continues to render without per-rule edits.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   Light defaults (no data-theme attribute, no .dark on body)
   --------------------------------------------------------------------------- */
:root,
:root[data-theme="light"] {
    /* Brand */
    --primary-color:   #00E58D;
    --primary-700:     #00B872;
    --primary-300:     #6ee7b7;
    --primary-tint:    rgba(0, 229, 141, 0.10);
    --primary-focus:   rgba(0, 229, 141, 0.20);
    --primary-glow:    rgba(0, 229, 141, 0.55);

    /* Semantic */
    --secondary-color: #26c6da;
    --success-color:   #4caf50;
    --danger-color:    #f44336;
    --warning-color:   #ffb74d;
    --info-color:      #64b5f6;

    --success-tint:    rgba(76, 175, 80, 0.10);
    --danger-tint:     rgba(244, 67, 54, 0.10);
    --warning-tint:    rgba(255, 183, 77, 0.10);
    --info-tint:       rgba(100, 181, 246, 0.10);

    /* Surfaces (light defaults) */
    --bg-body:         #f5f5f5;
    --bg-card:         #ffffff;
    --bg-sidebar:      #ffffff;
    --bg-header:       #ffffff;
    --bg-elevated:     #fafafa;
    --background-white:#ffffff;

    /* Borders */
    --border-color:    #e0e0e0;
    --border-soft:     #ececec;

    /* Text */
    --text-main:       #333333;
    --text-heading:    #1a1a1a;
    --text-muted:      #6c757d;

    /* Inputs */
    --input-bg:        #ffffff;
    --input-border:    #e0e0e0;
    --input-focus:     var(--primary-color);
    --input-placeholder: rgba(51, 51, 51, 0.42);

    /* Geometry */
    --radius-sm:       6px;
    --radius-md:       10px;
    --radius-lg:       12px;
    --radius-xl:       14px;
    --radius-full:     999px;

    --header-height:           70px;
    --header-height-mobile:    60px;
    --sidebar-width:           260px;
    --sidebar-collapsed-width: 70px;

    /* Motion */
    --transition-speed: 0.2s;
    --transition-slow:  0.35s;
    --ease-standard:    cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-soft:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-overshoot:   cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Shadows (light - softer values) */
    --shadow-sm:       0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-soft:     0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover:    0 8px 25px rgba(0, 0, 0, 0.08);
    --shadow-elev:     0 12px 32px rgba(0, 0, 0, 0.15);
    /* Legacy daybreak names (kept so existing CSS using --shadow-md works) */
    --shadow-md:       var(--shadow-soft);
    --shadow-lg:       var(--shadow-hover);

    color-scheme: light;
}

/* ---------------------------------------------------------------------------
   Dark theme - triggered by data-theme="dark" OR legacy body.dark
   --------------------------------------------------------------------------- */
:root[data-theme="dark"],
body.dark {
    /* Surfaces (dark) */
    --bg-body:         #101012;
    --bg-card:         #1E1E21;
    --bg-sidebar:      #1E1E21;
    --bg-header:       #1E1E21;
    --bg-elevated:     #25252a;
    --background-white:#1e293b;

    /* Borders */
    --border-color:    #334155;
    --border-soft:     #2a2f3a;

    /* Text */
    --text-main:       #f1f5f9;
    --text-heading:    #ffffff;
    --text-muted:      #94a3b8;

    /* Inputs */
    --input-bg:        #0f172a;
    --input-border:    #334155;
    --input-placeholder: rgba(241, 245, 249, 0.42);

    /* Shadows (dark - stronger values) */
    --shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-soft:     0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-hover:    0 8px 25px rgba(0, 0, 0, 0.45);
    --shadow-elev:     0 12px 32px rgba(0, 0, 0, 0.50);
    --shadow-md:       var(--shadow-soft);
    --shadow-lg:       var(--shadow-hover);

    color-scheme: dark;
}

/* ---------------------------------------------------------------------------
   Daybreak legacy aliases (PR 8 Phase A.1)

   The existing daybreak / inexxus-25 CSS uses different names for the same
   roles. Alias them to canonical tokens so legacy rules in style.css,
   custom.css, variables.css continue to paint correctly without per-rule
   edits. See DOCS/theme-standards/01_TOKENS.md "Alias tokens" section for
   the pattern.

   Scoping under :root makes the aliases available everywhere; the right-hand
   value resolves to whichever (--data-theme | --body.dark) is active.
   --------------------------------------------------------------------------- */
:root {
    /* Surface aliases */
    --bg-color:        var(--bg-body);
    --card-color:      var(--bg-card);
    --card-bg:         var(--bg-card);
    --border-light:    var(--border-soft);
    --section-bg:      var(--bg-elevated);
    --footer-bg:       var(--bg-elevated);
    --dropdown-bg:     var(--bg-card);

    /* Text aliases */
    --text-primary:    var(--text-main);
    --text-secondary:  var(--text-muted);

    /* Brand aliases - daybreak called the primary accent "accent" */
    --accent-color:    var(--primary-color);
    --accent-color-dark: var(--primary-700);
    --accent-hover:    var(--primary-700);

    /* Error -> danger (different name, same meaning) */
    --error-color:     var(--danger-color);

    /* Button text on the brand-colored button (legacy daybreak token) */
    --btn-principal-text: #ffffff;

    /* Input variants */
    --input-focus-bg:  var(--input-bg);
}

/* Daybreak's home-page gradient backdrop - tokens that don't have admin
   equivalents but exist for visual flair in customer-portal pages. */
:root,
:root[data-theme="light"] {
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end:   #e2e8f0;
}
:root[data-theme="dark"],
body.dark {
    --bg-gradient-start: #101012;
    --bg-gradient-end:   #1a1a1f;
}
