/**
 * PrijsProfeet Shared Styles
 *
 * Core brand styles for all PrijsProfeet pages.
 * Mobile-first with breakpoints: 480px, 600px, 768px
 */

/* ==========================================================================
   CSS Variables - Theme
   ========================================================================== */

:root {
    /* Brand colors */
    --pp-accent: #667eea;
    --pp-accent-hover: #5a6fd6;
    --pp-accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Light theme (default) */
    --pp-bg-primary: #ffffff;
    --pp-bg-secondary: #f9f9f9;
    --pp-bg-card: #f9f9f9;
    --pp-text-primary: #333333;
    --pp-text-secondary: #666666;
    --pp-text-muted: #888888;
    --pp-border: #e0e0e0;
    --pp-shadow: rgba(0, 0, 0, 0.1);

    /* Spacing */
    --pp-space-xs: 4px;
    --pp-space-sm: 8px;
    --pp-space-md: 16px;
    --pp-space-lg: 24px;
    --pp-space-xl: 32px;

    /* Border radius */
    --pp-radius-sm: 8px;
    --pp-radius-md: 12px;
    --pp-radius-lg: 16px;
    --pp-radius-full: 9999px;

    /* Typography */
    --pp-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --pp-font-size-xs: 0.75rem;
    --pp-font-size-sm: 0.875rem;
    --pp-font-size-md: 1rem;
    --pp-font-size-lg: 1.25rem;
    --pp-font-size-xl: 1.5rem;
    --pp-font-size-2xl: 2rem;
}

/* Dark theme */
html.theme-dark,
@media (prefers-color-scheme: dark) {
    html:not(.theme-light) {
        --pp-bg-primary: #1a1a2e;
        --pp-bg-secondary: #16213e;
        --pp-bg-card: #1f2940;
        --pp-text-primary: #e8e8e8;
        --pp-text-secondary: #b0b0b0;
        --pp-text-muted: #808080;
        --pp-border: #2d3a4f;
        --pp-shadow: rgba(0, 0, 0, 0.3);
    }
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

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

html {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: var(--pp-font-family);
    background: var(--pp-accent-gradient);
    color: var(--pp-text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding: 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

/* Dark theme body background */
html.theme-dark body,
@media (prefers-color-scheme: dark) {
    html:not(.theme-light) body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
}

/* Accessibility */
:focus-visible {
    outline: 3px solid var(--pp-accent);
    outline-offset: 2px;
}

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

.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;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.pp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--pp-space-md);
}

.pp-main {
    padding: var(--pp-space-md);
    padding-bottom: calc(var(--pp-space-xl) + 70px); /* Space for bottom nav on mobile/tablet */
    background: var(--pp-bg-primary);
    border-radius: var(--pp-radius-lg) var(--pp-radius-lg) 0 0;
    min-height: calc(100vh - 80px);
}

@media (min-width: 769px) {
    .pp-main {
        padding-bottom: var(--pp-space-xl);
    }
}

/* ==========================================================================
   Header (same as homepage)
   ========================================================================== */

.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    color: white;
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    margin: 0 -20px 40px -20px;
}

.header-content {
    grid-column: 2;
    text-align: center;
    transition: opacity 0.2s;
}

.header-content:hover {
    opacity: 0.85;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header-tagline {
    font-size: 1.2em;
    opacity: 0.95;
}

.header-nav {
    display: none;
}

@media (min-width: 768px) {
    .header-nav {
        display: flex;
        align-items: flex-end;
        gap: 8px;
        position: absolute;
        right: 160px;
        bottom: 16px;
    }
}

.header-nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.15);
    transition: background 0.2s;
    font-size: 0.85em;
}

.header-nav-link:hover {
    background: rgba(255,255,255,0.25);
}

.header-nav-link.active {
    background: rgba(255,255,255,0.3);
}

.header-actions {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-toggle {
    position: relative;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s, transform 0.2s;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.list-toggle:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.05);
}

.settings-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.settings-toggle:hover {
    background: rgba(255,255,255,0.35);
}

/* Tablet/Mobile header */
@media (max-width: 768px) {
    .header-nav {
        display: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .header {
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        margin: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }

    .header h1 {
        font-size: 1.5em;
        margin-bottom: 0;
    }

    .header-tagline {
        display: none;
    }

    .pp-main {
        padding-top: 70px;
        border-radius: 0;
    }
}

/* ==========================================================================
   Bottom Navigation (Mobile)
   ========================================================================== */

.pp-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .pp-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--pp-bg-primary);
        border-top: 1px solid var(--pp-border);
        padding: 12px 0 8px 0;
        padding-bottom: max(16px, calc(8px + env(safe-area-inset-bottom)));
        z-index: 100;
        justify-content: space-around;
        box-shadow: 0 -2px 10px var(--pp-shadow);
    }

    .pp-bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: var(--pp-space-sm) var(--pp-space-md);
        background: none;
        border: none;
        color: var(--pp-text-muted);
        font-size: var(--pp-font-size-xs);
        cursor: pointer;
        text-decoration: none;
        transition: color 0.2s;
        min-height: 44px;
        min-width: 60px;
    }

    .pp-bottom-nav-item.active {
        color: var(--pp-accent);
    }

    .pp-bottom-nav-item:active {
        transform: scale(0.95);
    }

    .pp-bottom-nav-icon {
        font-size: 1.4em;
    }

    .pp-bottom-nav-icon svg {
        width: 24px;
        height: 24px;
    }
}

/* Dark theme bottom nav */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    html:not(.theme-light) .pp-bottom-nav {
        background: var(--pp-bg-primary);
        border-top-color: var(--pp-border);
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.pp-footer {
    background: #1a1a2e;
    color: white;
    padding: var(--pp-space-xl) var(--pp-space-md);
    margin-top: var(--pp-space-xl);
}

.pp-footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.pp-footer-note {
    font-size: var(--pp-font-size-sm);
    margin-bottom: var(--pp-space-sm);
}

.pp-footer-disclaimer {
    font-size: var(--pp-font-size-xs);
    opacity: 0.7;
    margin-bottom: var(--pp-space-md);
}

.pp-footer-links {
    font-size: var(--pp-font-size-sm);
}

.pp-footer-sep {
    opacity: 0.5;
    margin: 0 var(--pp-space-sm);
}

.pp-footer a {
    color: #4facfe;
    text-decoration: none;
    transition: opacity 0.2s;
}

.pp-footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .pp-footer {
        margin-bottom: 70px; /* Space for bottom nav */
    }
}

/* ==========================================================================
   Cards
   ========================================================================== */

.pp-card {
    background: var(--pp-bg-card);
    border-radius: var(--pp-radius-md);
    box-shadow: 0 2px 8px var(--pp-shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--pp-shadow);
}

.pp-card a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.pp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--pp-space-sm);
    padding: var(--pp-space-sm) var(--pp-space-md);
    border: none;
    border-radius: var(--pp-radius-sm);
    font-size: var(--pp-font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    text-decoration: none;
}

.pp-btn:active {
    transform: scale(0.98);
}

.pp-btn-primary {
    background: var(--pp-accent);
    color: white;
}

.pp-btn-primary:hover {
    background: var(--pp-accent-hover);
}

.pp-btn-secondary {
    background: var(--pp-bg-card);
    color: var(--pp-text-primary);
    border: 1px solid var(--pp-border);
}

.pp-btn-secondary:hover {
    background: var(--pp-bg-secondary);
}

.pp-btn svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Page Hero
   ========================================================================== */

.pp-hero {
    text-align: center;
    padding: var(--pp-space-xl) var(--pp-space-md);
}

.pp-hero h1 {
    font-size: var(--pp-font-size-2xl);
    margin-bottom: var(--pp-space-sm);
    color: var(--pp-text-primary);
}

.pp-hero p {
    color: var(--pp-text-secondary);
    font-size: var(--pp-font-size-md);
}

@media (max-width: 480px) {
    .pp-hero {
        padding: var(--pp-space-lg) var(--pp-space-md);
    }

    .pp-hero h1 {
        font-size: var(--pp-font-size-xl);
    }
}

/* ==========================================================================
   Grid Layouts
   ========================================================================== */

.pp-grid {
    display: grid;
    gap: var(--pp-space-md);
}

.pp-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.pp-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.pp-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.pp-grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (max-width: 768px) {
    .pp-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .pp-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .pp-grid-2,
    .pp-grid-3,
    .pp-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--pp-space-sm);
    }
}

/* ==========================================================================
   Loading & Spinners
   ========================================================================== */

.pp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--pp-border);
    border-top-color: var(--pp-accent);
    border-radius: 50%;
    animation: pp-spin 1s linear infinite;
}

@keyframes pp-spin {
    to { transform: rotate(360deg); }
}

.pp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--pp-space-xl);
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.pp-empty {
    text-align: center;
    padding: var(--pp-space-xl) var(--pp-space-md);
    color: var(--pp-text-muted);
}

.pp-empty-icon {
    font-size: 3rem;
    margin-bottom: var(--pp-space-md);
    opacity: 0.5;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.pp-progress {
    height: 4px;
    background: var(--pp-border);
    border-radius: 2px;
    overflow: hidden;
}

.pp-progress-fill {
    height: 100%;
    background: var(--pp-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.pp-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.pp-modal-overlay.active {
    display: flex;
}

.pp-modal-close {
    position: fixed;
    top: var(--pp-space-md);
    right: var(--pp-space-md);
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.pp-modal-close svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.pp-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--pp-space-sm);
    font-size: var(--pp-font-size-sm);
    color: var(--pp-text-muted);
    padding: var(--pp-space-md) 0;
}

.pp-breadcrumb a {
    color: var(--pp-text-secondary);
    text-decoration: none;
}

.pp-breadcrumb a:hover {
    color: var(--pp-accent);
}

.pp-breadcrumb-sep {
    opacity: 0.5;
}

/* ==========================================================================
   Back Link
   ========================================================================== */

.pp-back {
    display: inline-flex;
    align-items: center;
    gap: var(--pp-space-sm);
    color: var(--pp-text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--pp-space-sm) 0;
}

.pp-back:hover {
    color: var(--pp-accent);
}

.pp-back svg {
    width: 20px;
    height: 20px;
}
