/* CSS Custom Properties for phpMyGTD */

:root {
  /* ===== Breakpoints (for reference in JS) ===== */
  --breakpoint-mobile: 480px;
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1024px;

  /* ===== Spacing Scale ===== */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */

  /* ===== Typography ===== */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-md: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.5rem;    /* 24px */
  --font-size-2xl: 2rem;     /* 32px */
  --line-height: 1.5;

  /* ===== Touch Targets ===== */
  --touch-target-min: 44px;

  /* ===== Border Radius ===== */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* ===== Shadows ===== */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);

  /* ===== Transitions ===== */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* ===== Z-Index Scale ===== */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;

  /* ===== Header Height (for sticky positioning below header) ===== */
  --header-height: 57px;

  /* ===== Task State Colors (iOS-style) ===== */
  --color-overdue: #ff3b30;
  --color-due-today: #ff9500;
  --color-tomorrow: #ffcc00;
  --color-context: #34c759;
  --color-project: #007aff;
  --color-note-icon: #8e8e93;

  /* ===== Light Theme (default) ===== */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f5f5f7;
  --color-bg-tertiary: #e5e5ea;
  --color-bg-input: #ffffff;
  --color-bg-hover: #f2f2f7;

  --color-text-primary: #000000;
  --color-text-secondary: #8e8e93;
  --color-text-muted: #aeaeb2;
  --color-text-inverse: #ffffff;

  --color-border: #c6c6c8;
  --color-border-focus: #007aff;

  --color-link: #007aff;
  --color-link-visited: #5856d6;

  /* iOS-style blue primary button */
  --color-button-primary: #007aff;
  --color-button-primary-hover: #0056b3;
  --color-button-danger: #ff3b30;
  --color-button-danger-hover: #d63029;

  --color-counter-bg: #cc0000;
  --color-counter-text: #ffffff;

  --color-row-dark: #f8f8f8;
  --color-row-light: #ffffff;
  --color-row-dependent: #fff0f0;
  --color-row-completed: #f0f0f0;
}

/* ===== Dark Theme (iOS-style) ===== */
[data-theme="dark"] {
  --color-bg-primary: #000000;
  --color-bg-secondary: #1c1c1e;
  --color-bg-tertiary: #2c2c2e;
  --color-bg-input: #1c1c1e;
  --color-bg-hover: #2c2c2e;

  --color-text-primary: #ffffff;
  --color-text-secondary: #8e8e93;
  --color-text-muted: #636366;
  --color-text-inverse: #000000;

  --color-border: #38383a;
  --color-border-focus: #0a84ff;

  --color-link: #0a84ff;
  --color-link-visited: #5e5ce6;

  --color-button-primary: #0a84ff;
  --color-button-primary-hover: #409cff;
  --color-button-danger: #ff453a;
  --color-button-danger-hover: #ff6961;

  --color-counter-bg: #ff453a;
  --color-counter-text: #ffffff;

  --color-row-dark: #1c1c1e;
  --color-row-light: #000000;
  --color-row-dependent: #3a1c1c;
  --color-row-completed: #1c1c1e;
}

/* ===== System Preference Detection ===== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg-primary: #000000;
    --color-bg-secondary: #1c1c1e;
    --color-bg-tertiary: #2c2c2e;
    --color-bg-input: #1c1c1e;
    --color-bg-hover: #2c2c2e;

    --color-text-primary: #ffffff;
    --color-text-secondary: #8e8e93;
    --color-text-muted: #636366;
    --color-text-inverse: #000000;

    --color-border: #38383a;
    --color-border-focus: #0a84ff;

    --color-link: #0a84ff;
    --color-link-visited: #5e5ce6;

    --color-button-primary: #0a84ff;
    --color-button-primary-hover: #409cff;
    --color-button-danger: #ff453a;
    --color-button-danger-hover: #ff6961;

    --color-counter-bg: #ff453a;
    --color-counter-text: #ffffff;

    --color-row-dark: #1c1c1e;
    --color-row-light: #000000;
    --color-row-dependent: #3a1c1c;
    --color-row-completed: #1c1c1e;
  }
}
