/* ============================================
   APIpulse — Shared Styles
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #1f1f35;
    --text-primary: #e8e8ed;
    --text-secondary: #9494a8;
    --text-muted: #6b6b80;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --green: #22c55e;
    --orange: #f59e0b;
    --red: #ef4444;
    --border: #2a2a3e;
    --nav-bg: rgba(10, 10, 15, 0.85);
    --radius: 12px;
    --max-width: 1200px;
}
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f3f5;
    --text-primary: #1a1a2e;
    --text-secondary: #495057;
    --text-muted: #868e96;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.1);
    --green: #22c55e;
    --orange: #f59e0b;
    --red: #ef4444;
    --border: #e9ecef;
    --nav-bg: rgba(255, 255, 255, 0.85);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* Navigation */
nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--nav-bg); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); padding: 0 24px;
}
.nav-inner {
    max-width: var(--max-width); margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.logo {
    font-size: 20px; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { color: var(--text-secondary); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--text-primary); }
.nav-cta {
    background: var(--accent); color: white !important; padding: 8px 20px;
    border-radius: 8px; font-size: 14px; font-weight: 600;
}
.nav-cta:hover { background: var(--accent-hover); }
.theme-toggle {
    background: none; border: none; font-size: 18px; cursor: pointer;
    padding: 4px 8px; border-radius: 6px; transition: background 0.2s;
}
.theme-toggle:hover { background: var(--bg-card); }

/* Buttons */
.btn-primary {
    background: var(--accent); color: white; padding: 14px 32px;
    border-radius: 10px; font-size: 16px; font-weight: 600;
    border: none; cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); color: white; }
.btn-secondary {
    background: var(--bg-card); color: var(--text-primary); padding: 14px 32px;
    border-radius: 10px; font-size: 16px; font-weight: 600;
    border: 1px solid var(--border); cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg-card-hover); transform: translateY(-1px); }

/* Footer */
footer {
    padding: 40px 24px; border-top: 1px solid var(--border);
    text-align: center; color: var(--text-muted); font-size: 13px;
}
footer a { color: var(--text-secondary); }

/* Back to Top */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px;
    background: var(--accent); color: white; border: none; border-radius: 50%;
    font-size: 20px; cursor: pointer; opacity: 0; pointer-events: none;
    transition: opacity 0.3s, transform 0.3s; z-index: 99;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-2px); }

/* Accessibility */
.skip-link {
    position: absolute; top: -40px; left: 0; background: var(--accent);
    color: white; padding: 8px 16px; z-index: 200; font-size: 14px;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Loading State */
.calculating { opacity: 0.6; pointer-events: none; }
.calculating .result-value { animation: pulse 0.5s ease-in-out; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Keyboard Shortcuts */
.keyboard-hint {
    text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-secondary);
    opacity: 0.7; transition: opacity 0.2s;
}
.keyboard-hint:hover { opacity: 1; }
.keyboard-hint kbd, .shortcuts-content kbd {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 4px; padding: 2px 6px; font-size: 11px; font-family: inherit;
    margin: 0 2px;
}
.shortcuts-modal {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
}
.shortcuts-modal.active { display: flex; }
.shortcuts-content {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 32px; max-width: 400px; width: 90%;
}
.shortcuts-content h3 { font-size: 18px; margin-bottom: 16px; }
.shortcut-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border);
}
.shortcut-row:last-child { border-bottom: none; }
.shortcut-desc { font-size: 14px; color: var(--text-secondary); }

/* Active nav link */
.nav-links a.active { color: var(--accent); font-weight: 600; }

/* Hamburger Menu */
.hamburger {
    display: none; background: none; border: none; cursor: pointer;
    padding: 8px; z-index: 110; position: relative;
}
.hamburger span {
    display: block; width: 22px; height: 2px; background: var(--text-primary);
    margin: 5px 0; transition: all 0.3s; border-radius: 2px;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Responsive — Shared */
@media (max-width: 768px) {
    .hamburger { display: block; }
    .nav-links {
        display: none; position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
        background: var(--bg-primary); flex-direction: column; padding: 24px;
        gap: 0; overflow-y: auto; z-index: 100;
    }
    .nav-links.open { display: flex; }
    .nav-links a {
        padding: 14px 0; font-size: 16px; border-bottom: 1px solid var(--border);
        width: 100%;
    }
    .nav-cta {
        margin-top: 16px; text-align: center; display: block;
        padding: 14px 20px !important; border-bottom: none !important;
    }
    .theme-toggle {
        margin-top: 16px; text-align: center; font-size: 24px;
        padding: 12px; width: 100%; border: 1px solid var(--border); border-radius: 8px;
    }
}

/* Breadcrumb */
.breadcrumb {
    display: flex; align-items: center; gap: 8px; margin-bottom: 24px;
    font-size: 13px; color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .separator { color: var(--border); }
.breadcrumb .current { color: var(--text-secondary); }
