/* ===================================================
   Lightera Design System
   Brand colors from official brand guide.
   =================================================== */

:root {
    --lightera-purple-1: #6f00d3;
    --lightera-purple-2: #9e0fce;
    --lightera-purple-3: #b063ff;
    --lightera-green: #cdf564;
    --lightera-offwhite: #f2f0ee;
    --lightera-black: #000000;
    --lightera-gray: #31312f;

    --lightera-purple-hover: #5a00ab;
    --lightera-green-hover: #b8e050;
    --lightera-purple-light: rgba(111, 0, 211, 0.08);
    --lightera-purple-border: rgba(111, 0, 211, 0.2);

    --font-primary: 'Arial', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Inter', 'Arial', sans-serif;
}

/* Bootstrap overrides - light */
[data-bs-theme="light"] {
    --bs-body-bg: var(--lightera-offwhite);
    --bs-body-color: var(--lightera-black);
    --bs-primary: var(--lightera-purple-1);
    --bs-primary-rgb: 111, 0, 211;
}

/* Bootstrap overrides - dark (using Lightera gray #31312f and off-white #f2f0ee) */
[data-bs-theme="dark"] {
    --bs-body-bg: #1c1c1a;
    --bs-body-color: var(--lightera-offwhite);
    --bs-primary: var(--lightera-purple-3);
    --bs-primary-rgb: 176, 99, 255;
}

[data-bs-theme="dark"] .lightera-card {
    background-color: var(--lightera-gray);
    border-color: rgba(242, 240, 238, 0.15);
}

[data-bs-theme="dark"] .example-card {
    border-color: rgba(242, 240, 238, 0.15) !important;
}

[data-bs-theme="dark"] .example-card:hover {
    background-color: rgba(242, 240, 238, 0.08);
}

[data-bs-theme="dark"] .lightera-intro-banner {
    background: linear-gradient(135deg, rgba(111, 0, 211, 0.15), rgba(205, 245, 100, 0.05));
}

[data-bs-theme="dark"] .dop-certificate {
    background: #fff;
    color: #000;
    border-radius: 0.5rem;
}

[data-bs-theme="dark"] .lightera-footer {
    background-color: #1c1c1a;
}

[data-bs-theme="dark"] .paginator {
    border-top-color: rgba(242, 240, 238, 0.15) !important;
}

[data-bs-theme="dark"] .paginator .pagination-text {
    color: var(--lightera-offwhite);
}

[data-bs-theme="dark"] .paginator nav button {
    background-color: var(--lightera-gray);
    border-color: rgba(242, 240, 238, 0.15);
}

[data-bs-theme="dark"] .paginator nav button:hover:not([disabled]) {
    background-color: var(--lightera-purple-3);
}

/* Typography */
body {
    font-family: var(--font-primary);
    font-size: 0.95rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
}

/* Lightera primary button — .btn.lightera-btn-primary beats Bootstrap's .btn specificity */
.btn.lightera-btn-primary {
    background-color: #6f00d3;
    background-image: none;
    border: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(111, 0, 211, 0.3);
}

.btn.lightera-btn-primary:hover {
    background-color: #b063ff;
    background-image: none;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(176, 99, 255, 0.4);
}

.btn.lightera-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(111, 0, 211, 0.3);
}

.btn.lightera-btn-primary:disabled {
    background-color: #6f00d3;
    background-image: none;
    opacity: 1;
    transform: none;
    box-shadow: none;
    pointer-events: none;
    cursor: not-allowed;
}

/* Card styles */
.lightera-card {
    border: 1px solid var(--lightera-purple-border);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.lightera-card:hover {
    box-shadow: 0 4px 20px rgba(111, 0, 211, 0.12) !important;
}

.lightera-card-header {
    background-color: #6f00d3;
    background-image: none;
    color: white;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-bottom: none;
}

/* Badge */
.lightera-badge-accent {
    background-color: var(--lightera-green);
    color: var(--lightera-black);
    font-weight: 600;
}

/* Results grid card — subtle purple outline */
.lightera-results-card {
    border: 1px solid var(--lightera-purple-border);
    border-radius: 0.75rem;
    overflow: hidden; /* clips header corners to card's border-radius */
}

/* Results grid card header — page bg */
.lightera-results-header {
    background: var(--lightera-offwhite);
    border-bottom: 1px solid var(--lightera-purple-border);
}

/* Purple tab — left label, rounded bottom-right only, spans ~1st column width */
.lightera-results-tab {
    background: var(--lightera-purple-1);
    color: #fff;
    padding: 0.65rem 2rem;
    min-width: 14rem;
    border-radius: 0 0 0.5rem 0;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* Report number inline link */
.dop-report-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.dop-report-link:hover {
    color: var(--lightera-purple-1);
    text-decoration-color: var(--lightera-purple-1);
}

/* Input focus */
.form-control:focus {
    border-color: var(--lightera-purple-3);
    box-shadow: 0 0 0 0.25rem rgba(111, 0, 211, 0.15);
}

.lightera-input-icon {
    background: #6f00d3;
    color: white;
    border-color: #6f00d3;
}

/* Modal */
.lightera-modal-header {
    background: linear-gradient(135deg, var(--lightera-purple-1), var(--lightera-purple-2));
    color: white;
    border-bottom: none;
}

/* Detail view card — more rounded corners, clips button to curve */
.lightera-detail-card {
    border-radius: 0.75rem;
    overflow: hidden;
}

/* Detail view header — solid Lightera purple */
.lightera-detail-header {
    background: #6f00d3;
    border-bottom: none;
    padding: 0;
}

/* Tab blends into the solid purple header — just white text, no separate background */
.lightera-detail-tab {
    background: transparent;
    color: #fff;
    padding: 0.65rem 2rem;
    border-radius: 0;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* Download PDF button flush to the right corner — solid purple, mirrors the left tab shape */
/* Original preserved — swap class to lightera-btn-corner-text for the icon-link style */
.lightera-btn-corner {
    border-radius: 0 0 0 0.5rem;
    padding: 0.65rem 1.5rem;
    white-space: nowrap;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Download PDF icon-link style — white text on solid purple header */
.lightera-btn-corner-text {
    background: transparent;
    color: #fff;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0;
    padding: 0.5rem 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 1rem;
    font-weight: 400;
}

.lightera-btn-corner-text i {
    font-size: 1.2rem;
}

.lightera-btn-corner-text:hover {
    background-color: #b063ff;
    background-image: none;
    color: white;
}

/* Outline secondary buttons (Back to Results, X/clear) — purple on hover */
.btn.btn-outline-secondary:hover {
    background-color: #b063ff;
    background-image: none;
    border-color: #b063ff;
    color: white;
}

.dop-modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Theme toggle button */
.lightera-theme-toggle {
    color: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    background: transparent;
}

.lightera-theme-toggle:hover {
    background-color: rgba(111, 0, 211, 0.08);
    color: var(--lightera-purple-1);
    border-color: var(--lightera-purple-1);
}

/* Loading spinner */
.lightera-spinner {
    background-color: var(--lightera-purple-1);
    width: 0.75rem;
    height: 0.75rem;
}

/* Intro banner */
.lightera-intro-banner {
    background: linear-gradient(135deg, var(--lightera-purple-light), rgba(205, 245, 100, 0.08));
    border-left: 4px solid var(--lightera-purple-1);
}

/* Text color helpers */
.text-purple {
    color: var(--lightera-purple-1);
}

/* Example card hover */
.example-card {
    transition: all 0.2s ease;
    cursor: pointer;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

.example-card:hover {
    border-color: var(--lightera-purple-1) !important;
    background-color: var(--lightera-purple-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(111, 0, 211, 0.15);
}

.example-card:focus-visible {
    outline: 2px solid var(--lightera-purple-3);
    outline-offset: 2px;
}

.example-card-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

/* Fade-in animation */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* QuickGrid styling */
.quickgrid th {
    background: var(--lightera-offwhite) !important;
    color: var(--lightera-black) !important;
    font-weight: 600;
    border-color: rgba(0, 0, 0, 0.1) !important;
    padding: 0.75rem !important;
}

.quickgrid th:hover {
    background: #e8e6e3 !important;
}

.quickgrid th .col-title {
    color: var(--lightera-black) !important;
}

.quickgrid th .sort-indicator {
    color: var(--lightera-purple-1) !important;
}

.quickgrid td {
    padding: 0.6rem 0.75rem !important;
    vertical-align: middle;
    border-bottom: none !important;
    --bs-table-bg-state: transparent !important;
    --bs-table-accent-bg: transparent !important;
}

.quickgrid > tbody > tr {
    --bs-table-striped-bg: transparent !important;
    --bs-table-hover-bg: transparent !important;
    --bs-table-accent-bg: transparent !important;
}

/* Paginator styling — targets the actual QuickGrid Paginator class (.paginator) */
.paginator {
    padding: 0.75rem 1.25rem !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.paginator .pagination-text {
    font-size: 0.875rem;
    color: var(--lightera-gray);
}

/* Accordion overrides */
.accordion-button:not(.collapsed) {
    background-color: var(--lightera-purple-light);
    color: var(--lightera-purple-1);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(111, 0, 211, 0.15);
}

/* Accessibility */
:focus-visible {
    outline: 2px solid var(--lightera-purple-3);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .fade-in {
        animation: none;
    }
    .btn.lightera-btn-primary:hover,
    .example-card:hover {
        transform: none;
    }
}

/* Skeleton loading placeholder — mimics the results grid while data loads */
.skeleton-results {
    border: 1px solid var(--lightera-purple-border);
    border-radius: 0.75rem;
    overflow: hidden;
    animation: fadeIn 0.2s ease-in-out;
}

.skeleton-results .skeleton-header {
    background: var(--lightera-offwhite);
    border-bottom: 1px solid var(--lightera-purple-border);
    padding: 0;
    display: flex;
    align-items: center;
}

.skeleton-results .skeleton-tab {
    background: var(--lightera-purple-1);
    color: #fff;
    padding: 0.65rem 2rem;
    min-width: 14rem;
    border-radius: 0 0 0.5rem 0;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.skeleton-row:last-child {
    border-bottom: none;
}

.skeleton-bar {
    height: 0.9rem;
    border-radius: 4px;
    background: linear-gradient(90deg, #e8e6e3 25%, #f2f0ee 50%, #e8e6e3 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

[data-bs-theme="dark"] .skeleton-bar {
    background: linear-gradient(90deg, #3a3a38 25%, #4a4a48 50%, #3a3a38 75%);
    background-size: 200% 100%;
}

[data-bs-theme="dark"] .skeleton-results {
    background-color: var(--lightera-gray);
    border-color: rgba(242, 240, 238, 0.15);
}

[data-bs-theme="dark"] .skeleton-results .skeleton-header {
    background: var(--lightera-gray);
    border-bottom-color: rgba(242, 240, 238, 0.15);
}

[data-bs-theme="dark"] .skeleton-row {
    border-bottom-color: rgba(242, 240, 238, 0.05);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Certificate print styles within modal */
.dop-certificate {
    max-width: 800px;
    margin: 0 auto;
}
