/**
 * Shared modern styles for public track + customer portal pages.
 * Brand accent comes from body.{business} and style.{business}.css
 */

:root {
    --customer-surface: #ffffff;
    --customer-surface-muted: #f4f6f9;
    --customer-border: #e2e8f0;
    --customer-text: #334155;
    --customer-text-muted: #64748b;
    --customer-heading: #1e293b;
    --customer-radius: 12px;
    --customer-radius-sm: 8px;
    --customer-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    --customer-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --customer-accent: #28a745;
    --customer-accent-hover: #218838;
    --customer-accent-text: #ffffff;
    --customer-focus-ring: rgba(40, 167, 69, 0.35);
}

body.crendon {
    --customer-accent: #ef4232;
    --customer-accent-hover: #d43324;
    --customer-focus-ring: rgba(239, 66, 50, 0.35);
}

body.wyckham {
    --customer-accent: #e6b800;
    --customer-accent-hover: #cc9f00;
    --customer-accent-text: #1a1a1a;
    --customer-focus-ring: rgba(230, 184, 0, 0.45);
}

body.davidsmith {
    --customer-accent: #2d6a4f;
    --customer-accent-hover: #245a42;
    --customer-focus-ring: rgba(45, 106, 79, 0.35);
}

body.timberframes,
body.timbersolutions {
    --customer-accent: #5c4d3c;
    --customer-accent-hover: #4a3e30;
    --customer-focus-ring: rgba(92, 77, 60, 0.35);
}

/* Main content shell — reset inherited white text from frontend.css body */
.customer-page {
    margin-top: 1rem;
    margin-bottom: 2rem;
    color: var(--customer-text);
}

.customer-page .customer-card,
.customer-page .customer-card__body,
.customer-page .customer-card__header {
    color: var(--customer-text);
}

.customer-card {
    background: var(--customer-surface);
    border-radius: var(--customer-radius);
    box-shadow: var(--customer-shadow);
    border: 1px solid var(--customer-border);
    overflow: hidden;
}

.customer-card__header {
    padding: 1.5rem 1.75rem 0.75rem;
    border-bottom: 1px solid var(--customer-border);
    background: linear-gradient(180deg, var(--customer-surface-muted) 0%, var(--customer-surface) 100%);
}

.customer-card__body {
    padding: 1.5rem 1.75rem;
}

.customer-card__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--customer-heading);
    letter-spacing: -0.02em;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.customer-card__subtitle {
    font-size: 1rem;
    color: var(--customer-text-muted);
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
}

.customer-card__title--sm {
    font-size: 1.15rem;
}

.customer-section-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--customer-heading);
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--customer-accent);
    display: inline-block;
}

/* Section titles sitting directly on the brand-coloured page background */
.customer-page > .customer-section-title,
.customer-section-title--on-brand {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.9);
}

.customer-card__header .customer-section-title {
    color: var(--customer-heading);
    border-bottom-color: var(--customer-accent);
}

/* Alerts */
.customer-alerts .alert {
    border-radius: var(--customer-radius-sm);
    border: none;
    box-shadow: var(--customer-shadow-sm);
    font-size: 0.95rem;
}

/* Forms */
.customer-form .form-control {
    border: 1px solid var(--customer-border);
    border-radius: var(--customer-radius-sm);
    padding: 0.65rem 1rem;
    font-size: 1rem;
    color: var(--customer-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.customer-form .form-control:focus {
    border-color: var(--customer-accent);
    box-shadow: 0 0 0 3px var(--customer-focus-ring);
}

.customer-form .form-control-lg {
    padding: 0.75rem 1rem;
}

.customer-form label {
    font-weight: 600;
    color: var(--customer-heading);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.customer-form .custom-checkbox label {
    font-weight: 500;
    color: var(--customer-text);
    cursor: pointer;
}

.customer-btn-primary {
    background-color: var(--customer-accent);
    border-color: var(--customer-accent);
    color: var(--customer-accent-text);
    font-weight: 600;
    border-radius: var(--customer-radius-sm);
    padding: 0.75rem 1.5rem;
    font-size: 1.05rem;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.customer-btn-primary:hover,
.customer-btn-primary:focus {
    background-color: var(--customer-accent-hover);
    border-color: var(--customer-accent-hover);
    color: var(--customer-accent-text);
    transform: translateY(-1px);
}

.customer-btn-outline {
    border-radius: var(--customer-radius-sm);
    font-weight: 500;
    border: 1px solid var(--customer-border);
    color: var(--customer-text);
    background: var(--customer-surface);
}

.customer-btn-outline:hover {
    background: var(--customer-surface-muted);
    color: var(--customer-heading);
}

/* Override bootstrap success buttons in customer context */
.customer-page .btn-success {
    background-color: var(--customer-accent);
    border-color: var(--customer-accent);
    color: var(--customer-accent-text);
}

.customer-page .btn-success:hover {
    background-color: var(--customer-accent-hover);
    border-color: var(--customer-accent-hover);
    color: var(--customer-accent-text);
}

/* Toolbar (portal) */
.customer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--customer-surface);
    border-radius: var(--customer-radius);
    box-shadow: var(--customer-shadow-sm);
    border: 1px solid var(--customer-border);
    margin-bottom: 1.5rem;
}

.customer-toolbar__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--customer-heading);
    margin: 0;
}

.customer-toolbar__meta {
    font-size: 0.9rem;
    color: var(--customer-text-muted);
}

/* Order tables */
.customer-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--customer-radius-sm);
    border: 1px solid var(--customer-border);
}

.customer-table {
    width: 100%;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--customer-text);
}

.customer-table thead th {
    background: var(--customer-surface-muted);
    color: var(--customer-heading);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--customer-border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.customer-table tbody td {
    padding: 1rem;
    vertical-align: top;
    border-color: var(--customer-border);
}

.customer-table tbody tr:hover {
    background-color: rgba(241, 245, 249, 0.6);
}

.customer-table .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.65em;
}

.customer-delivery-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--customer-heading);
    margin-top: 0.5rem;
}

/* Dashboard order groups */
.customer-order-group {
    background: var(--customer-surface);
    border: 1px solid var(--customer-border);
    border-radius: var(--customer-radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: var(--customer-shadow-sm);
    transition: box-shadow 0.2s ease;
}

.customer-order-group:hover {
    box-shadow: var(--customer-shadow);
}

.customer-order-group__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--customer-surface-muted);
    border-bottom: 1px solid var(--customer-border);
}

.customer-order-group__title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--customer-heading);
    margin: 0;
}

.customer-order-group__ref {
    font-weight: 400;
    color: var(--customer-text-muted);
}

.customer-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--customer-text-muted);
    font-size: 1rem;
}

/* Comment history */
.customer-notes .timeline-messages,
.customer-notes .timeline-messages .row,
.customer-notes .timeline-messages .col-md-4,
.customer-notes .timeline-messages .col-md-8 {
    color: var(--customer-text);
}

.customer-notes .timeline-messages .row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--customer-border);
}

.customer-notes .timeline-messages .row:last-child {
    border-bottom: none;
}

.customer-notes .timeline-messages .col-md-4 {
    color: var(--customer-text-muted);
}

/* Modals */
.customer-modal .modal-content {
    border-radius: var(--customer-radius);
    border: none;
    box-shadow: var(--customer-shadow);
}

.customer-modal .modal-header {
    border-bottom: 1px solid var(--customer-border);
    background: var(--customer-surface-muted);
}

.customer-modal .modal-title {
    font-weight: 600;
    color: var(--customer-heading);
}

/* Header link on brand background */
.customer-header-link {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.95) !important;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.customer-header-link:hover {
    opacity: 0.85;
    color: #fff !important;
    text-decoration: underline;
}

.customer-header-link--in-card {
    color: var(--customer-accent) !important;
    font-weight: 600;
}

.customer-header-link--in-card:hover {
    color: var(--customer-accent-hover) !important;
    opacity: 1;
    text-decoration: underline;
}

/* Compact site header / footer */
.customer-site-header {
    padding: 0.75rem 0 0.5rem;
    margin-bottom: 0.5rem;
}

.customer-site-header__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.65rem;
}

.customer-site-header__brand {
    width: 100%;
    display: flex;
    justify-content: center;
}

.customer-site-header__banner {
    max-height: 64px;
    width: auto;
    max-width: min(100%, 480px);
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.customer-site-header__logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
    width: 100%;
}

.customer-site-header__logo--main {
    max-height: 58px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.customer-site-header__logo--flank {
    max-height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    opacity: 0.95;
}

.customer-site-header__contact {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1.5rem;
    width: 100%;
    font-size: 0.9rem;
    text-align: center;
}

.customer-site-header__contact-item {
    flex: 0 0 auto;
    white-space: nowrap;
}

.customer-site-footer {
    padding: 1rem 0 1.5rem;
    margin-top: 1rem;
}

.customer-site-footer__banner {
    max-height: 48px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    opacity: 0.9;
}

.customer-site-footer__logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
}

.customer-site-footer__logo {
    max-height: 36px;
    width: auto;
    max-width: 90px;
    object-fit: contain;
    opacity: 0.9;
}

.customer-dashboard-filters label {
    color: var(--customer-heading);
    font-weight: 600;
    font-size: 0.85rem;
}

@media (max-width: 767.98px) {
    .customer-site-header__contact {
        gap: 0.4rem 1rem;
        font-size: 0.8rem;
    }

    .customer-site-header__logo--flank {
        display: none;
    }
}

/* Print */
@media print {
    .customer-card,
    .customer-order-group {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .customer-toolbar,
    .d-print-none {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .customer-card__title {
        font-size: 1.4rem;
    }

    .customer-card__header,
    .customer-card__body {
        padding: 1.25rem;
    }

    .customer-table thead th,
    .customer-table tbody td {
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }
}
