/* Base Styles - Brand colors for landing page */
:root {
    --primary-color: #FF5722;
    --secondary-color: #4527A0;
    --accent-color: #FF9800;
    --text-color: #333333;
    --bg-color: #f5f5f5;
    --header-bg: #ffffff;
    --footer-bg: #333333;
    --nav-link-color: #333333;
    --nav-link-hover: #FF5722;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --input-border: #ddd;
    --input-focus: rgba(255, 87, 34, 0.2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.1);
    /* WCAG 1.4.12: Minimum line height for readability */
    --line-height-base: 1.6;
    /* WCAG 1.4.4: Support for text resizing up to 200% */
    --font-size-base: 1rem;
    /* WCAG 2.4.7: Focus indicator colors */
    --focus-color: #FF5722;
    --focus-outline: 3px;
    --focus-offset: 2px;
}

/* Landing page theme - maintains brand colors */
.theme-landing {
    --primary-color: #FF5722;
    --secondary-color: #4527A0;
    --accent-color: #FF9800;
    --text-color: #FFFFFF;
    --bg-color: #121212;
    --header-bg: rgba(0, 0, 0, 0.8);
    --footer-bg: #1a1a1a;
    --nav-link-color: #FFFFFF;
    --nav-link-hover: #FF9800;
    --card-bg: #1e1e1e;
    --border-color: #333333;
    --input-border: #444444;
    --input-focus: rgba(255, 152, 0, 0.3);
}

/* User page theme - customizable */
.theme-user {
    --primary-color: #FF5722;
    --secondary-color: #757575;
    --accent-color: #FF9800;
    --text-color: #333333;
    --bg-color: #f5f5f5;
    --header-bg: #ffffff;
    --footer-bg: #333333;
    --nav-link-color: #333333;
    --nav-link-hover: #FF5722;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --input-border: #ddd;
    --input-focus: rgba(255, 87, 34, 0.2);
}

/* Dark theme variant */
.theme-dark {
    --text-color: #e0e0e0;
    --bg-color: #121212;
    --header-bg: #1e1e1e;
    --footer-bg: #0a0a0a;
    --nav-link-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --border-color: #333333;
    --input-border: #444444;
}

/* Light theme variant */
.theme-light {
    --text-color: #333333;
    --bg-color: #f5f5f5;
    --header-bg: #ffffff;
    --footer-bg: #e0e0e0;
    --nav-link-color: #333333;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --input-border: #ddd;
}

/* Default theme - alias for system (backwards compatibility) */
.theme-default {
    --primary-color: #FF5722;
    --secondary-color: #757575;
    --accent-color: #FF9800;
    --text-color: #333333;
    --bg-color: #f5f5f5;
    --header-bg: #ffffff;
    --footer-bg: #333333;
    --nav-link-color: #333333;
    --nav-link-hover: #FF5722;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --input-border: #ddd;
    --input-focus: rgba(255, 87, 34, 0.2);
}

@media (prefers-color-scheme: dark) {
    .theme-default {
        --text-color: #e0e0e0;
        --bg-color: #121212;
        --header-bg: #1e1e1e;
        --footer-bg: #0a0a0a;
        --nav-link-color: #e0e0e0;
        --card-bg: #1e1e1e;
        --border-color: #333333;
        --input-border: #444444;
    }
}

/* High contrast theme */
.theme-high-contrast {
    --text-color: #000000;
    --bg-color: #ffffff;
    --header-bg: #ffffff;
    --footer-bg: #000000;
    --nav-link-color: #000000;
    --card-bg: #ffffff;
    --border-color: #000000;
    --input-border: #000000;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
.header {
    background-color: var(--header-bg);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--nav-link-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--nav-link-hover);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 120px);
    padding: 2rem 0;
}

/* Footer */
.footer {
    background-color: var(--footer-bg);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
}

/* Print styles */
@media print {
    body {
        background-color: white;
        color: black;
    }

    .no-print {
        display: none;
    }

    .print-only {
        display: block;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        gap: 1rem;
    }

    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Enhanced responsive breakpoints */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 720px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 540px;
    }
}

@media (max-width: 576px) {
    .container {
        max-width: 100%;
        padding: 0 0.5rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }
}

/* ============================================
   WCAG Accessibility Enhancements
   ============================================ */

/* WCAG 2.4.7: Skip Link - Visible on focus for keyboard users */
.skip-link {
    position: absolute;
    top: -9999px;
    left: -9999px;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0 0 4px 4px;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    outline: 3px solid white;
    outline-offset: 2px;
}

/* WCAG 2.4.7: Visible focus indicators for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: var(--focus-outline) solid var(--focus-color);
    outline-offset: var(--focus-offset);
}

/* WCAG 2.4.7: Focus styles for navigation links */
.nav-link:focus {
    outline: var(--focus-outline) solid var(--focus-color);
    outline-offset: var(--focus-offset);
    border-radius: 2px;
}

/* WCAG 2.4.7: Logo focus style */
.logo:focus {
    outline: var(--focus-outline) solid var(--focus-color);
    outline-offset: var(--focus-offset);
    border-radius: 4px;
}

/* WCAG 1.4.3: Screen reader only class (visually hidden but accessible) */
.sr-only,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* WCAG 1.4.12: Ensure text spacing is adjustable */
body {
    line-height: var(--line-height-base);
    letter-spacing: 0.01em;
    word-spacing: 0.05em;
}

/* WCAG 1.4.4: Text resize support - use relative units */
html {
    font-size: 100%; /* 16px base */
}

/* WCAG 1.4.4: Ensure text scales properly when user zooms */
@media screen and (min-width: 0) {
    body {
        font-size: var(--font-size-base);
    }
}

/* WCAG 2.1.1: Ensure touch targets are at least 44x44 pixels */
button,
.btn,
.nav-link,
.social-media-link,
.crypto-tab {
    min-height: 44px;
    min-width: 44px;
}

/* WCAG 1.4.1: Don't rely on color alone - add underline to links in content */
.main-content a:not(.btn):not(.nav-link):not(.logo):not(.listing-card):not(.social-media-link) {
    text-decoration: underline;
}

.main-content a:not(.btn):not(.nav-link):not(.logo):not(.listing-card):not(.social-media-link):hover {
    text-decoration-thickness: 2px;
}

/* WCAG 2.4.7: Focus styles for buttons */
.btn:focus {
    outline: var(--focus-outline) solid var(--focus-color);
    outline-offset: var(--focus-offset);
}

/* WCAG 1.4.11: Non-text contrast - ensure UI components have sufficient contrast */
.btn-primary {
    background-color: #D84315; /* Darker shade for better contrast */
    color: #ffffff;
}

.btn-secondary {
    background-color: #281575; /* Darker shade for better contrast */
    color: #ffffff;
}

/* WCAG 1.4.3: Footer text contrast - ensure minimum 4.5:1 ratio */
.footer {
    color: #e0e0e0; /* Lighter text for better contrast on dark background */
}

.footer a {
    color: #FF9800; /* Accent color with good contrast */
}

.footer a:hover,
.footer a:focus {
    color: #FFB74D;
    text-decoration: underline;
}

/* WCAG 2.4.7: High visibility focus for dark themes */
.theme-dark .skip-link:focus,
.theme-landing .skip-link:focus {
    outline: 3px solid #FF9800;
}

.theme-dark a:focus-visible,
.theme-dark button:focus-visible,
.theme-landing a:focus-visible,
.theme-landing button:focus-visible {
    outline-color: #FF9800;
}

/* WCAG 1.4.6: High contrast theme enhancements */
.theme-high-contrast a:focus-visible,
.theme-high-contrast button:focus-visible {
    outline: 4px solid #000000;
    outline-offset: 2px;
    background-color: #ffff00;
    color: #000000;
}

/* WCAG 2.2.2: Respect user preference for 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;
    }
}

/* WCAG 1.4.8: Respect user preference for color scheme */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e0e0e0;
        --bg-color: #121212;
        --header-bg: #1e1e1e;
        --card-bg: #1e1e1e;
        --border-color: #333333;
    }
}

/* WCAG 2.1.1: Ensure focusable elements show clear focus state */
[tabindex="0"]:focus {
    outline: var(--focus-outline) solid var(--focus-color);
    outline-offset: var(--focus-offset);
}

/* WCAG 1.4.10: Reflow - ensure content doesn't require horizontal scrolling */
@media (max-width: 320px) {
    body {
        min-width: 320px;
        overflow-x: hidden;
    }
    
    .container {
        padding: 0 0.5rem;
    }
}

/* WCAG 1.4.12: Ensure adequate paragraph spacing */
p {
    margin-bottom: 1rem;
}

/* WCAG 3.1.2: Language-specific styling (if needed for multilingual support) */
[lang="en"] {
    quotes: "“" "”" "‘" "’";
}

/* WCAG 1.3.2: Ensure proper reading order with flexbox/grid */
.main-content {
    display: flex;
    flex-direction: column;
}

/* WCAG 4.1.2: Ensure status messages are properly styled */
[role="status"],
[role="alert"] {
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

[role="alert"] {
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}

[role="status"] {
    background-color: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

/* WCAG 1.4.11: Focus indicator for crypto tabs */
.crypto-tab:focus {
    outline: var(--focus-outline) solid var(--focus-color);
    outline-offset: var(--focus-offset);
}

/* WCAG 2.4.7: Ensure copy button has visible focus */
.copy-btn:focus {
    outline: var(--focus-outline) solid var(--focus-color);
    outline-offset: var(--focus-offset);
}

/* WCAG 1.4.11: Ensure disabled elements are clearly distinguishable */
.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* WCAG 2.5.5: Ensure adequate size for interactive elements on touch devices */
@media (pointer: coarse) {
    button,
    .btn,
    .nav-link,
    .crypto-tab,
    .social-media-link {
        min-height: 48px;
        min-width: 48px;
        padding: 0.75rem 1rem;
    }
}