/*
Theme Name: Noqstock Platform Theme
Theme URI: https://noqstock.com
Author: Noqstock
Author URI: https://noqstock.com
Description: Custom theme for the Noqstock platform dashboard.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: noqstock-platform-theme
*/

/* ==========================================================================
   DESIGN TOKENS - Colors (OKLCH)

   Dark Mode Guidelines:
   - Never use pure black, use ~90-94% black (6-10% lightness)
   - Surface layers need 4-6% lightness difference (double light mode)
   - Surfaces get LIGHTER as they elevate
   - Text: Headings 85-90%, Body 70-75%, Secondary 55-60%, Disabled 40-45%
   - Accent: Use 300-400 range for dark mode primary
   ========================================================================== */

:root {
    /*
     * Background - Layered Surfaces (4-6% lightness steps)
     * Each layer gets lighter as it elevates
     * Base: oklch(0.14 0.003 58) - subtle warm tint
     */
    --color-bg-base: oklch(0.14 0.003 58);       /* App background - darkest */
    --color-bg-surface: oklch(0.18 0.003 58);    /* Sidebar/frame (+4%) */
    --color-bg-muted: oklch(0.23 0.003 58);      /* Cards, panels (+4%) */
    --color-bg-elevated: oklch(0.23 0.003 58);   /* Modals, dropdowns (+4%) */
    --color-bg-interactive: oklch(0.20 0.003 58); /* Interactive backgrounds */
    --color-bg-hover: oklch(0.28 0.003 58);      /* Hover states (+4%) */

    /*
     * Text - 4 Levels (avoid pure white)
     * Subtle warm tint for cohesion
     */
    --color-text-primary: oklch(0.90 0.003 58);  /* Headings, important */
    --color-text-secondary: oklch(0.72 0.003 58); /* Body text */
    --color-text-muted: oklch(0.58 0.003 58);    /* Secondary info */
    --color-text-disabled: oklch(0.42 0.003 58); /* Disabled, meta */

    /*
     * Accent Ramp - Warm Orange/Brown
     * Dark mode uses 300-400 for primary, 400-500 for hover
     */
    --color-accent-100: oklch(94% 0.035 70);
    --color-accent-200: oklch(88% 0.055 65);
    --color-accent-300: oklch(80% 0.095 58);     /* Primary for dark mode */
    --color-accent-400: oklch(74% 0.115 55);     /* Hover for dark mode */
    --color-accent-500: oklch(64% 0.130 50);
    --color-accent-600: oklch(56% 0.130 45);
    --color-accent-700: oklch(48% 0.110 40);
    --color-accent-800: oklch(40% 0.090 35);
    --color-accent-900: oklch(34% 0.070 30);

    /* Accent shortcuts for common use */
    --color-accent: var(--color-accent-300);           /* Primary accent */
    --color-accent-hover: var(--color-accent-400);     /* Hover state */
    --color-accent-active: var(--color-accent-500);    /* Active/pressed */
    --color-accent-subtle: oklch(80% 0.095 58 / 0.12); /* Subtle backgrounds */
    --color-accent-rgb: 222, 188, 147;                 /* Fallback for rgba() */

    /*
     * Semantic Colors (OKLCH with matched perceptual brightness)
     * Same lightness + chroma, different hue for chart harmony
     */

    /* Success - Green */
    --color-success: oklch(72% 0.17 145);
    --color-success-bg: oklch(72% 0.17 145 / 0.12);
    --color-success-subtle: oklch(72% 0.17 145 / 0.12);
    --color-success-border: oklch(72% 0.17 145 / 0.30);

    /* Error - Red */
    --color-error: oklch(65% 0.20 25);
    --color-error-bg: oklch(65% 0.20 25 / 0.12);
    --color-error-subtle: oklch(65% 0.20 25 / 0.12);
    --color-error-border: oklch(65% 0.20 25 / 0.30);

    /* Warning - Orange/Yellow */
    --color-warning: oklch(78% 0.16 70);
    --color-warning-bg: oklch(78% 0.16 70 / 0.12);
    --color-warning-subtle: oklch(78% 0.16 70 / 0.12);
    --color-warning-border: oklch(78% 0.16 70 / 0.30);

    /* Info - Blue */
    --color-info: oklch(65% 0.16 250);
    --color-info-bg: oklch(65% 0.16 250 / 0.12);
    --color-info-subtle: oklch(65% 0.16 250 / 0.12);
    --color-info-border: oklch(65% 0.16 250 / 0.30);

    /*
     * Borders - 5-8% lighter than surface
     * Subtle warm tint to match backgrounds
     */
    --color-border: oklch(0.28 0.003 58);        /* Default border (+6% from muted) */
    --color-border-default: oklch(0.28 0.003 58); /* Same as border */
    --color-border-subtle: oklch(0.22 0.003 58); /* Subtle dividers (same as muted) */
    --color-border-strong: oklch(0.34 0.003 58); /* Emphasized borders */
    --color-border-focus: var(--color-accent);   /* Focus rings */

    /*
     * Overlay & Utility Colors
     */
    --color-overlay-lightest: oklch(100% 0 0 / 0.02); /* Barely visible white */
    --color-overlay-lighter: oklch(100% 0 0 / 0.03);  /* Subtle white highlight */
    --color-overlay-light: oklch(100% 0 0 / 0.05);    /* White highlight on dark surfaces */
    --color-overlay-dark: oklch(0% 0 0 / 0.5);        /* Dark overlay for modals */
    --color-overlay-darker: oklch(0% 0 0 / 0.7);      /* Darker overlay */

    /* Accent with various opacities */
    --color-accent-subtle-light: oklch(80% 0.095 58 / 0.05); /* Very subtle accent bg */
    --color-accent-subtle-medium: oklch(80% 0.095 58 / 0.08); /* Light accent bg */
    --color-accent-border: oklch(80% 0.095 58 / 0.30);        /* Accent border */

    /*
     * Focus & Interactive States
     */
    --color-focus-ring: oklch(80% 0.095 58 / 0.25);  /* Accent-based focus ring */
    --color-focus-ring-error: oklch(65% 0.20 25 / 0.25); /* Error focus ring */
}

/* ==========================================================================
   DESIGN TOKENS - Spacing
   ========================================================================== */

:root {
    --space-1: 0.25rem;   /* 4px  */
    --space-2: 0.5rem;    /* 8px  */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
}

/* ==========================================================================
   DESIGN TOKENS - Typography
   ========================================================================== */

:root {
    /* Font Families */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                        Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans',
                        'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono',
                        Consolas, 'Liberation Mono', Menlo, monospace;
    --font-mono: var(--font-family-mono);

    /* Font Sizes */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.5rem;     /* 24px */
    --font-size-2xl: 1.875rem;  /* 30px */

    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Line Heights */
    --line-height-tight: 1.2;
    --line-height-base: 1.5;
    --line-height-relaxed: 1.6;
}

/* ==========================================================================
   DESIGN TOKENS - Layout
   ========================================================================== */

:root {
    /* Content Widths */
    --content-narrow: 420px;
    --content-medium: 768px;
    --content-wide: 1024px;
    --content-full: 1280px;

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-header: 300;
    --z-overlay: 400;
    --z-modal: 500;
    --z-toast: 600;
    --z-tooltip: 700;

    /* Container Padding */
    --container-padding-mobile: var(--space-4);
    --container-padding-tablet: var(--space-6);
    --container-padding-desktop: var(--space-8);

    /* Breakpoints (for reference) */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

/* ==========================================================================
   DESIGN TOKENS - Components
   ========================================================================== */

:root {
    /* Button Heights */
    --button-height-sm: 36px;
    --button-height-md: 48px;
    --button-height-lg: 56px;

    /* Input Heights */
    --input-height-sm: 40px;
    --input-height-md: 48px;
    --input-height-lg: 56px;

    /* Touch Targets */
    --touch-target-min: 44px;

    /* Icon Sizes */
    --icon-xs: 16px;
    --icon-sm: 20px;
    --icon-md: 24px;
    --icon-lg: 32px;
    --icon-xl: 48px;
}

/* ==========================================================================
   DESIGN TOKENS - Effects
   ========================================================================== */

:root {
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms;
    --transition-normal: 200ms;
    --transition-slow: 300ms;
    --transition-colors: color var(--transition-fast) ease,
                         background-color var(--transition-fast) ease,
                         border-color var(--transition-fast) ease;
    --transition-all: all var(--transition-fast) ease;

    /* Easing */
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Opacity */
    --opacity-disabled: 0.6;
    --opacity-hover: 0.8;
    --opacity-subtle: 0.1;
    --opacity-overlay: 0.5;
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: var(--line-height-base);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    background-color: var(--color-bg-base);
    color: var(--color-text-primary);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast) var(--ease-out);
}

a:hover {
    color: var(--color-accent-hover);
}

h1, h2, h3 {
    text-wrap: balance;
}

/* ==========================================================================
   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;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --color-border: #ffffff;
    }

    .button {
        border: 2px solid currentColor;
    }

    .input {
        border-width: 2px;
    }
}

/* Focus Visibility */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: var(--space-2) var(--space-4);
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    z-index: var(--z-tooltip);
    transition: top var(--transition-fast) var(--ease-out);
}

.skip-link:focus {
    top: 0;
}

/* ==========================================================================
   UTILITY CLASSES - Grid
   ========================================================================== */

.grid {
    display: grid;
    gap: var(--space-4);
}

.grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid--auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Responsive Grid Collapse */
@media (max-width: 768px) {
    .grid--2,
    .grid--3,
    .grid--4 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   UTILITY CLASSES - Container
   ========================================================================== */

.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding-mobile);
    padding-right: var(--container-padding-mobile);
}

@media (min-width: 768px) {
    .container {
        padding-left: var(--container-padding-tablet);
        padding-right: var(--container-padding-tablet);
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: var(--container-padding-desktop);
        padding-right: var(--container-padding-desktop);
    }
}

.container--narrow {
    max-width: var(--content-narrow);
}

.container--medium {
    max-width: var(--content-medium);
}

.container--wide {
    max-width: var(--content-wide);
}

.container--full {
    max-width: var(--content-full);
}

/* ==========================================================================
   SITE HEADER
   ========================================================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    background: transparent;
    padding: var(--space-4) var(--space-8);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.site-header__logo {
    display: flex;
    align-items: center;
}

.site-header__logo-img {
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.site-header__logo-text {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

/* ==========================================================================
   SITE FOOTER
   ========================================================================== */

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    background: transparent;
    padding: var(--space-6) var(--space-8);
}

.site-footer__inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.site-footer__left {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

/* Language Dropdown */
.site-footer__language-switch {
    position: relative;
}

.site-footer__language-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast) var(--ease-out);
}

.site-footer__language-toggle:hover {
    color: var(--color-text-primary);
}

.site-footer__language-current {
    font-weight: var(--font-weight-medium);
}

.site-footer__language-icon {
    transition: transform var(--transition-fast) var(--ease-out);
}

.site-footer__language-switch.is-open .site-footer__language-icon {
    transform: rotate(180deg);
}

.site-footer__language-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin: 0 0 var(--space-2) 0;
    padding: 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(var(--space-2));
    transition: opacity var(--transition-fast) var(--ease-out),
                transform var(--transition-fast) var(--ease-out),
                visibility var(--transition-fast) var(--ease-out);
}

.site-footer__language-switch.is-open .site-footer__language-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.site-footer__language-menu li {
    margin: 0;
    padding: 0;
}

.site-footer__language-menu a {
    display: block;
    padding: var(--space-1) 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast) var(--ease-out);
}

.site-footer__language-menu a:hover {
    color: var(--color-text-primary);
}

/* Privacy Link */
.site-footer__privacy-link {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast) var(--ease-out);
}

.site-footer__privacy-link:hover {
    color: var(--color-text-primary);
}
