/* =============================================================================
   PJCS Waterproofing — Custom Styles
   Design System: Corporate Clean (aligned with pjcsinternational.com)
   ============================================================================= */

/* CSS Custom Properties (Design Tokens) */
:root {
    --background: #FFFFFF;
    --foreground: #1a1a1a;
    --primary: #2e7673;
    --primary-dark: #215552;
    --primary-light: #e8f0ef;
    --muted: #f7f8f8;
    --muted-foreground: #6b7280;
    --border: #d1d5db;
    --border-light: #e5e7eb;
    
    /* Typography */
    --font-display: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* =============================================================================
   Base Resets
   ============================================================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 12rem;
}

body {
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle rounding for corporate look */
button, input, select, textarea, 
.btn {
    border-radius: 6px !important;
}

/* =============================================================================
   Focus States (Accessibility)
   ============================================================================= */

/* Remove default focus, use custom */
*:focus {
    outline: none;
}

/* Buttons and primary interactive elements */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

/* Inputs */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 118, 115, 0.15);
}

/* =============================================================================
   Typography Utilities
   ============================================================================= */

.font-display {
    font-family: var(--font-display);
}

.font-body {
    font-family: var(--font-body);
}

.font-mono {
    font-family: var(--font-mono);
}

/* =============================================================================
   Wizard Option Cards
   ============================================================================= */

.wizard-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--background);
    cursor: pointer;
    transition: all 150ms;
    min-height: 120px;
    text-align: center;
    border-radius: 8px !important;
}

.wizard-option:hover,
.wizard-option:focus-visible {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--foreground);
}

.wizard-option:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.wizard-option.selected {
    background: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.wizard-option-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.wizard-option-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

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

.result-card {
    border: 1px solid var(--border);
    background: var(--background);
    transition: all 150ms;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.result-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(46, 118, 115, 0.12);
}

.result-card:hover .result-card-secondary {
    color: var(--muted-foreground);
}

.result-card:hover .result-card-tag {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.result-card-score {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 500;
    line-height: 1;
}

.result-card-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.result-card-secondary {
    color: var(--muted-foreground);
    transition: color 100ms;
}

.result-card-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-family: var(--font-mono);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 150ms;
    border-radius: 4px !important;
}

.result-card-reasons {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.result-card:hover .result-card-reasons {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.result-card-reason {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.result-card-reason::before {
    content: '✓';
    font-weight: bold;
}

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

.category-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: var(--background);
    min-height: 140px;
    cursor: pointer;
    transition: all 150ms;
    text-decoration: none;
    border-radius: 8px !important;
}

.category-card:hover {
    background: var(--background);
    color: var(--foreground);
}

.category-card-name {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.category-card-count {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

/* =============================================================================
   Loading Animation
   ============================================================================= */

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* =============================================================================
   Utility Classes
   ============================================================================= */

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

.hidden {
    display: none !important;
}

/* =============================================================================
   Scrollbar Styling
   ============================================================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    header, footer, #wizard {
        display: none;
    }
    
    body {
        font-size: 12pt;
    }
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */

.toast-container {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--background);
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    animation: toast-in 0.1s ease-out;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.toast.toast-error {
    background: var(--foreground);
    color: var(--background);
}

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

.toast-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-family: var(--font-body);
    font-size: 0.875rem;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.1s;
}

.toast-close:hover {
    opacity: 1;
}

.toast.toast-error .toast-close {
    color: var(--background);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-out {
    animation: toast-out 0.1s ease-in forwards;
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(1rem);
    }
}

/* =============================================================================
   Error Banner (inline)
   ============================================================================= */

.error-banner {
    padding: 1.5rem;
    border: 2px solid var(--foreground);
    background: var(--muted);
    text-align: center;
}

.error-banner-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.error-banner-message {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

.error-banner-retry {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--foreground);
    background: var(--foreground);
    color: var(--background);
    cursor: pointer;
    transition: all 0.1s;
}

.error-banner-retry:hover {
    background: var(--background);
    color: var(--foreground);
}

/* =============================================================================
   Language Selector
   ============================================================================= */

[data-language-selector] [data-lang] {
    position: relative;
}

[data-language-selector] [data-lang].active {
    background: var(--primary);
    color: var(--background);
    font-weight: 600;
}

[data-language-selector] [data-lang].active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary);
}

/* =============================================================================
   Catalog v2 — Sidebar Navigation
   ============================================================================= */

.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: var(--muted-foreground) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-light);
}

/* =============================================================================
   Catalog v2 — Family Navigation Tabs
   ============================================================================= */

.family-tab {
    transition: background 100ms, color 100ms;
}

.family-tabs-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.family-tabs-scroll::-webkit-scrollbar {
    display: none;
}

/* Category quick-jump chips */
.category-chip {
    transition: background 100ms, color 100ms;
}

/* =============================================================================
   Catalog v2 — Product Detail Slide-out Panel
   ============================================================================= */

.detail-slide-in {
    animation: slideInRight 0.15s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* =============================================================================
   Catalog v2 — Family Tabs (scrollbar hidden)
   ============================================================================= */

/* =============================================================================
   Catalog v2 — Family Headers
   ============================================================================= */

.family-header {
    /* Ensure header doesn't overlap other sticky elements */
    z-index: 5;
}

/* =============================================================================
   Catalog v2 — Line clamp for descriptions
   ============================================================================= */

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
