/* Parallel North CRM — Design System */

@font-face {
    font-family: 'Stolzl';
    src: url('/assets/fonts/stolzl-book.woff2') format('woff2'),
         url('/assets/fonts/stolzl-book.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --pn-dark:    #303030;
    --pn-light:   #f4f4f4;
    --pn-mid:     #6b6b6b;
    --pn-border:  #d8d8d8;
    --pn-white:   #ffffff;
    --pn-bg:        #f4f4f4;
    --pn-surface:   #ffffff;
    --pn-text:      #303030;
    --pn-text-soft: #6b6b6b;
    --pn-line:      #d8d8d8;
    --primary:      #303030;
    --primary-dark: #1a1a1a;
    --primary-light:#f4f4f4;
    --secondary:    #303030;
    --accent:       #f4f4f4;
    --accent-dark:  #303030;
}

html[data-theme="dark"] {
    --pn-bg:        #151515;
    --pn-surface:   #1e1e1e;
    --pn-text:      #f1f1f1;
    --pn-text-soft: #c0c0c0;
    --pn-line:      #343434;
    --pn-light:     #151515;
    --pn-dark:      #f1f1f1;
    --pn-mid:       #c0c0c0;
    --pn-border:    #343434;
    --primary:      #f1f1f1;
    --primary-dark: #d7d7d7;
    --primary-light:#1e1e1e;
    --accent:       #1e1e1e;
}

/* Font styles */
body {
    font-family: 'Stolzl', 'DM Sans', 'Inter', sans-serif;
    background-color: var(--pn-bg);
    color: var(--pn-text);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Stolzl', 'DM Sans', 'Inter', sans-serif;
    color: var(--pn-text);
    letter-spacing: -0.01em;
}

/* Sidebar styles */
.sidebar-link.active {
    background-color: rgba(48, 48, 48, 0.08);
    border-left: 3px solid var(--pn-dark);
}
  
.sidebar-link:hover:not(.active) {
    background-color: rgba(48, 48, 48, 0.05);
}

/* Mobile responsive sidebar */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    #sidebar.open {
        transform: translateX(0);
    }
}

/* Custom button styles */
.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-outline {
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-outline:hover {
    background-color: var(--primary);
    color: white;
}

/* Custom card styles */
.card {
    background-color: var(--pn-surface);
    border-radius: 2px;
    border: 1px solid var(--pn-line);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--pn-line);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--pn-line);
}

/* Form styles */
input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--pn-line);
    border-radius: 2px;
    transition: border-color 0.2s;
    background: var(--pn-surface);
    color: var(--pn-text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--pn-dark);
    box-shadow: 0 0 0 3px rgba(48, 48, 48, 0.1);
}

/* Keep checkboxes/radios at native size (global input width should not apply) */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #4b5563;
}

.form-group {
    margin-bottom: 1rem;
}

/* Alert messages */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
}

.alert-success {
    background-color: #e8f5e8;
    color: #1a3a1a;
    border: 1px solid #c3dcc3;
}

.alert-danger {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fef3c7;
}

.alert-info {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background-color: #e0e0e0;
    color: var(--pn-dark);
}

.badge-warning {
    background-color: #fffbeb;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background-color: #e0f2fe;
    color: #0369a1;
}

/* Custom table styles */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background-color: var(--pn-bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pn-text-soft);
    border-bottom: 1px solid var(--pn-line);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--pn-line);
}

.table tbody tr:hover {
    background-color: var(--pn-bg);
}

/* Metrics card */
.metric-card {
    background-color: var(--pn-surface);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    border: 1px solid var(--pn-line);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--pn-text-soft);
}

.metric-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background-color: var(--accent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Theme toggle controls */
.theme-toggle-btn,
.theme-toggle-floating {
    border: 1px solid var(--pn-line);
    background: var(--pn-surface);
    color: var(--pn-text);
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-floating {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 70;
}

/* Dark mode helpers for pages using inline light styles */
html[data-theme="dark"] .bg-gray-50 {
    background-color: var(--pn-bg) !important;
}

html[data-theme="dark"] [style*="background:#ffffff"] {
    background: var(--pn-surface) !important;
}

html[data-theme="dark"] [style*="background:#f4f4f4"] {
    background: var(--pn-bg) !important;
}

html[data-theme="dark"] [style*="border-color:#d8d8d8"],
html[data-theme="dark"] [style*="border:1px solid #d8d8d8"] {
    border-color: var(--pn-line) !important;
}

html[data-theme="dark"] [style*="color:#303030"] {
    color: var(--pn-text) !important;
}

html[data-theme="dark"] [style*="color:#6b6b6b"] {
    color: var(--pn-text-soft) !important;
}
/* Parallel North utility overrides — replaces Tailwind green classes */
.btn-submit,
.btn-pn {
    background-color: var(--pn-dark);
    color: var(--pn-white);
    font-family: 'Stolzl', 'DM Sans', sans-serif;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 2px;
    border: none;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn-submit:hover,
.btn-pn:hover {
    background-color: var(--pn-mid);
}

/* Sidebar brand wordmark */
.pn-wordmark {
    font-family: 'Stolzl', 'DM Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--pn-dark);
}

/* Override Tailwind background for main content area */
.bg-gray-50 {
    background-color: var(--pn-light) !important;
}

/* Dashboard metric card accent */
.metric-value {
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--pn-dark);
    font-family: 'Stolzl', 'DM Sans', sans-serif;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   Text utilities
   ========================================================================== */
.text-soft    { color: var(--pn-text-soft); }
.text-danger  { color: #b91c1c; }
.text-warning { color: #92400e; }
.text-success { color: #166534; }

/* ==========================================================================
   Link utilities
   ========================================================================== */
.link-dark { color: var(--pn-text); text-decoration: underline; }
.link-soft { color: var(--pn-text-soft); text-decoration: underline; }

/* ==========================================================================
   Buttons — dark & danger variants
   ========================================================================== */
.btn-dark {
    display: inline-block;
    background: var(--pn-dark);
    color: #ffffff;
    border: none;
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-dark:hover { background: var(--pn-mid); color: #ffffff; }

.btn-danger {
    display: inline-block;
    background: #b91c1c;
    color: #ffffff;
    border: none;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-danger:hover { background: #991b1b; }

.btn-secondary {
    background: var(--pn-surface);
    border: 1px solid var(--pn-line);
    color: var(--pn-text);
}

/* ==========================================================================
   Form helpers
   ========================================================================== */
/* Tiny uppercase label — e.g. "Company *" above inputs */
.form-label-sm {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pn-text-soft);
}

/* Override Tailwind .border class on inputs so colour/radius come from CSS vars */
input.form-input, select.form-input, textarea.form-input {
    border: 1px solid var(--pn-line) !important;
    border-radius: 2px !important;
}

.checkbox-dark { accent-color: var(--pn-dark); }

.hr-soft { border-color: #e8e8e8; }

/* ==========================================================================
   Status badges  (use: class="badge badge-{status}")
   ========================================================================== */
.badge-incomplete { background: #e8e8e8;  color: #303030; }
.badge-submitted  { background: #fffbeb;  color: #92400e; }
.badge-approved   { background: #f0fdf4;  color: #166534; }
.badge-rejected   { background: #fef2f2;  color: #991b1b; }

/* ==========================================================================
   Status banners (use: class="status-banner status-banner--{status}")
   ========================================================================== */
.status-banner {
    border-left: 4px solid transparent;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.status-banner p { font-size: 0.875rem; margin: 0; }
.status-banner p + p { margin-top: 0.25rem; }

.status-banner--approved  { background: #f0fdf4; border-left-color: #16a34a; }
.status-banner--approved  p { color: #166534; }
.status-banner--submitted { background: #fffbeb; border-left-color: #d97706; }
.status-banner--submitted p { color: #92400e; }
.status-banner--rejected  { background: #fef2f2; border-left-color: #dc2626; }
.status-banner--rejected  p { color: #991b1b; }
.status-banner--incomplete { background: var(--pn-bg); border-left-color: var(--pn-dark); }
.status-banner--incomplete .banner-title { color: var(--pn-text); }
.status-banner--incomplete .banner-body  { color: var(--pn-text-soft); }

/* ==========================================================================
   Dashboard metric value colours
   ========================================================================== */
.metric-amber { color: #92400e; }
.metric-green { color: #166534; }
.metric-red   { color: #991b1b; }

/* ==========================================================================
   Panel — square white card (design system card, no radius)
   ========================================================================== */
.panel        { background: var(--pn-surface); border: 1px solid var(--pn-line); }
.panel-table  { overflow: hidden; }
.text-nowrap  { white-space: nowrap; }

.panel-header {
    border-color: var(--pn-line);
    color: var(--pn-text-soft);
}

.panel-notice {
    background: var(--pn-bg);
    color: var(--pn-text);
}

/* ==========================================================================
   Auth pages (login, register)
   ========================================================================== */
.auth-bg   { background: var(--pn-bg); }
.auth-card { background: var(--pn-surface); border: 1px solid var(--pn-line); }
.auth-logo { max-width: 220px; height: auto; }

/* ==========================================================================
   Public / client-portal page shell
   ========================================================================== */
.page-public { background: var(--pn-bg); min-height: 100vh; }

.portal-header {
    background: var(--pn-surface);
    border-bottom: 1px solid var(--pn-line);
}

.portal-brand-label { color: var(--pn-text-soft); }
.portal-logo-link   { text-decoration: none; display: inline-block; vertical-align: middle; }

.portal-logo {
    max-width: 170px;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

/* ==========================================================================
   Onboarding step indicators
   ========================================================================== */
.step-icon {
    display: flex;
    height: 1.5rem;
    width: 1.5rem;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.75rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    background: var(--pn-text-soft);
}
.step-icon--done    { background: var(--pn-dark); }
.step-icon--pending {
    background: transparent;
    border: 1px solid var(--pn-line);
    color: var(--pn-text-soft);
}

.step-item { border-color: #e8e8e8; }

/* ==========================================================================
   Signature capture area
   ========================================================================== */
.sig-wrap     { border: 1px solid var(--pn-line); background: #fafafa; position: relative; }
.sig-preview  { background: #fafafa; }
.sig-image    { max-height: 120px; border: 1px solid var(--pn-line); }

/* ==========================================================================
   Review page — notice / decision boxes
   ========================================================================== */
.notice-approved {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.notice-erased {
    background: var(--pn-bg);
    border: 1px solid var(--pn-line);
    color: var(--pn-text-soft);
    margin-top: 1rem;
}

.danger-zone        { background: #fff7f7; border: 1px solid #fecaca; margin-top: 24px; }
.danger-zone-header { border-color: #fecaca !important; color: #b91c1c !important; }
.danger-zone-text   { color: #7f1d1d; }

/* ==========================================================================
   Table helpers
   ========================================================================== */
.table-head-row  { background: var(--pn-bg); }
.table-row-border { border-top: 1px solid #e8e8e8; }

/* ==========================================================================
   Machine icon box (client portal)
   ========================================================================== */
.machine-icon-box {
    height: 3rem;
    width: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pn-bg);
    border: 1px solid var(--pn-line);
    flex-shrink: 0;
    color: var(--pn-text);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer-text { color: var(--pn-text-soft); }

/* ==========================================================================
   FAB — floating action button
   ========================================================================== */
.fab { position: fixed; bottom: 24px; right: 24px; z-index: 1000; }

/* ==========================================================================
   Gallery
   ========================================================================== */
.gallery-item     { display: inline-block; margin: 10px; }
.gallery-item img, .gallery-img { max-width: 200px; }

/* ==========================================================================
   Privacy notice page
   ========================================================================== */
.privacy-bar { background: var(--pn-dark); padding: 18px 32px; }
.privacy-bar a {
    color: var(--pn-bg);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.privacy-bar-brand {
    float: right;
    color: #aaa;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.privacy-container { max-width: 760px; margin: 48px auto; padding: 0 24px; }
.privacy-meta      { font-size: 12px; color: var(--pn-text-soft); margin-bottom: 36px; }
.privacy-h2 {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 32px 0 10px;
    border-bottom: 1px solid var(--pn-line);
    padding-bottom: 6px;
}
.privacy-body { font-size: 14px; line-height: 1.7; color: #444; }
.privacy-back { display: inline-block; margin-top: 48px; font-size: 12px; color: var(--pn-text-soft); text-decoration: underline; }

/* ==========================================================================
   App Shell — Mobile header bar
   ========================================================================== */
.app-header-mobile {
    background: var(--pn-surface);
    border-bottom: 1px solid var(--pn-line);
}

.app-header-mobile .icon-btn {
    color: var(--pn-text);
}

/* ==========================================================================
   App Shell — Mobile nav overlay
   ========================================================================== */
.app-nav-mobile {
    background: var(--pn-surface);
}

.app-nav-mobile-logo {
    border-color: var(--pn-line);
}

.app-nav-mobile .nav-link-mobile {
    color: var(--pn-text-soft);
}

.app-nav-mobile .nav-link-mobile.is-active {
    color: var(--pn-text);
}

.app-nav-mobile-footer {
    border-color: var(--pn-line);
}

.app-nav-mobile-footer a {
    color: var(--pn-text-soft);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   App Shell — Desktop sidebar
   ========================================================================== */
.app-sidebar {
    background: var(--pn-surface);
    border-right: 1px solid var(--pn-line);
}

.app-sidebar-logo {
    border-color: var(--pn-line);
}

/* User strip */
.app-sidebar-user {
    border-color: var(--pn-line);
}

.user-avatar {
    background: var(--pn-dark);
    color: #ffffff;
}

.user-name {
    color: var(--pn-text);
}

.role-badge {
    background: #e8e8e8;
    color: var(--pn-dark);
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    text-transform: capitalize;
    display: inline-block;
}

html[data-theme="dark"] .role-badge {
    background: #2e2e2e;
}

/* Sidebar nav links */
.nav-link {
    color: var(--pn-text-soft);
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 2px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: var(--pn-bg);
    color: var(--pn-text);
}

.nav-link.is-active {
    background: var(--pn-bg);
    border-left: 3px solid var(--pn-dark);
    color: var(--pn-text);
    padding-left: calc(1rem - 3px); /* compensate for border width */
}

/* Sidebar footer */
.app-sidebar-footer {
    border-color: var(--pn-line);
}

.app-sidebar-footer a,
.app-sidebar-footer button {
    color: var(--pn-text-soft);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 2px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    transition: color 0.15s;
}

.app-sidebar-footer a:hover,
.app-sidebar-footer button:hover {
    color: var(--pn-text);
}