/* Shared Design System for Tools */
/* This should be included by all tool stylesheets for consistency */
/* Cyberpunk-inspired theme with teal accents and enhanced typography */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Core spacing */
    --gap: 24px;
    --content-gap: 20px;
    --radius: 8px;
    
    /* Light theme - Cyberpunk inspired */
    --color-bg: 255 255 255;
    --color-bg-secondary: 249 249 249;
    --color-text: 0 0 0;
    --color-text-secondary: 75 85 99;
    --color-text-muted: 107 114 128;
    --color-border: 229 229 229;
    --color-hover: 247 247 247;
    
    /* Legacy color mappings for backwards compatibility */
    --theme: rgb(var(--color-bg));
    --entry: rgb(var(--color-bg));
    --primary: rgb(var(--color-text));
    --secondary: rgb(var(--color-text-secondary));
    --tertiary: rgb(var(--color-text-muted));
    --content: rgb(var(--color-text));
    --border: rgb(var(--color-border));
    --muted-foreground: rgb(var(--color-text-muted));
    --accent: rgb(var(--color-hover));
    --accent-foreground: rgb(var(--color-text));
    
    /* Cyberpunk accent colors */
    --cyberpunk-teal: #10a37f;
    --cyberpunk-teal-dark: #13c989;
    --cyberpunk-teal-light: rgb(16 163 127 / 0.1);
    
    /* Action colors - cyberpunk enhanced */
    --success: var(--cyberpunk-teal);
    --success-foreground: #ffffff;
    --warning: #f59e0b;
    --warning-foreground: #ffffff;
    --destructive: #ef4444;
    --destructive-foreground: #ffffff;
    
    /* Shadows - consistent elevation system */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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 scale */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Font families */
    --font-system: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

body.dark {
    /* Dark theme - Enhanced cyberpunk */
    --color-bg: 33 33 33;
    --color-bg-secondary: 44 44 44;
    --color-text: 255 255 255;
    --color-text-secondary: 209 213 219;
    --color-text-muted: 156 163 175;
    --color-border: 68 68 68;
    --color-hover: 55 55 55;
    
    /* Legacy mappings */
    --theme: rgb(var(--color-bg));
    --entry: rgb(var(--color-bg-secondary));
    --primary: rgb(var(--color-text));
    --secondary: rgb(var(--color-text-secondary));
    --tertiary: rgb(var(--color-text-muted));
    --content: rgb(var(--color-text));
    --border: rgb(var(--color-border));
    --muted-foreground: rgb(var(--color-text-muted));
    --accent: rgb(var(--color-hover));
    --accent-foreground: rgb(var(--color-text));
}

body.sepia {
    /* Sepia theme - Reading optimized */
    --color-bg: 251 248 241;
    --color-bg-secondary: 247 243 234;
    --color-text: 62 51 41;
    --color-text-secondary: 92 77 61;
    --color-text-muted: 122 102 82;
    --color-border: 226 218 203;
    --color-hover: 241 235 223;
    
    /* Legacy mappings */
    --theme: rgb(var(--color-bg));
    --entry: rgb(var(--color-bg));
    --primary: rgb(var(--color-text));
    --secondary: rgb(var(--color-text-secondary));
    --tertiary: rgb(var(--color-text-muted));
    --content: rgb(var(--color-text));
    --border: rgb(var(--color-border));
    --muted-foreground: rgb(var(--color-text-muted));
    --accent: rgb(var(--color-hover));
    --accent-foreground: rgb(var(--color-text));
}

/* Base reset and typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', var(--font-system);
    background: var(--theme);
    color: var(--primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Shared button component styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    outline: none;
    cursor: pointer;
    border: none;
    
    /* Default size - can be overridden */
    height: 2.5rem;
    padding: 0.625rem 1rem;
    min-width: 80px;
    
    /* Default variant - outline */
    background: var(--entry);
    color: var(--primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.btn:hover:not(:disabled) {
    background: var(--accent);
    color: var(--accent-foreground);
    box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
    outline: 2px solid var(--cyberpunk-teal);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgb(16 163 127 / 0.1);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: var(--shadow-xs);
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* Button variants */
.btn-primary {
    background: var(--cyberpunk-teal);
    color: var(--success-foreground);
    border-color: var(--cyberpunk-teal);
}

.btn-primary:hover:not(:disabled) {
    background: var(--cyberpunk-teal-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--success);
    color: var(--success-foreground);
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: var(--cyberpunk-teal-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: var(--warning);
    color: var(--warning-foreground);
    border-color: var(--warning);
}

.btn-warning:hover:not(:disabled) {
    background: rgb(245 158 11 / 0.9);
}

.btn-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
    border-color: var(--destructive);
}

.btn-destructive:hover:not(:disabled) {
    background: rgb(239 68 68 / 0.9);
}

/* Shared input styles */
.input {
    display: flex;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--theme);
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-base);
    color: var(--primary);
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.25;
    height: 2.5rem;
}

.input:focus {
    outline: none;
    border-color: var(--cyberpunk-teal);
    box-shadow: 0 0 0 3px rgb(16 163 127 / 0.1);
}

.input::placeholder {
    color: var(--muted-foreground);
}

.input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Shared container styles */
.container {
    background: var(--entry);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* Shared header styles */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.15s ease;
    padding: 0.5rem 0;
}

.back-link:hover {
    color: var(--primary);
    text-decoration: none;
}

/* Theme toggle - consistent across tools */
.theme-toggle {
    position: fixed;
    top: var(--gap);
    right: var(--gap);
    background: var(--entry);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    cursor: pointer;
    color: var(--primary);
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    font-size: 1.125rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-xs);
}

.theme-toggle:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--cyberpunk-teal);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgb(16 163 127 / 0.1);
}

/* Enhanced accessibility features */
*:focus-visible {
    outline: 2px solid var(--cyberpunk-teal);
    outline-offset: 2px;
    border-radius: 0.375rem;
}

/* Custom focus styles for form elements */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--cyberpunk-teal);
    outline-offset: 2px;
    border-color: var(--cyberpunk-teal);
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    :root {
        --color-border: 0 0 0;
        --color-text-muted: 64 64 64;
    }
    
    body.dark {
        --color-border: 255 255 255;
        --color-text-muted: 192 192 192;
    }
    
    *:focus-visible {
        outline-width: 3px;
        outline-color: currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Responsive breakpoints */
@media (max-width: 768px) {
    :root {
        --gap: 16px;
    }
    
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    :root {
        --gap: 12px;
    }
    
    .btn {
        height: 2.75rem;
        padding: 0.75rem 1rem;
        font-size: var(--font-size-sm);
    }
}