/* ── HH Door Measure – Website Stylesheet ── */

:root {
    --green-dark: #2E6B27;
    --green-mid: #3D8234;
    --green-light: #4A9B3E;
    --green-accent: #5DBF52;
    --amber: #FFC107;
    --white: #FFFFFF;
    --off-white: #F5F5F5;
    --text: #2D2D2D;
    --text-light: #666;
    --border: #E0E0E0;
    --shadow: rgba(0, 0, 0, 0.08);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--off-white);
    line-height: 1.6;
}

/* ── Navigation ── */

nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--green-dark);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: 0 2px 8px var(--shadow);
}

nav .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--white);
    font-weight: 700;
    font-size: 1.15rem;
}

nav .logo img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav ul li a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--white);
}

/* ── Mobile nav toggle ── */

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    nav ul {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--green-dark);
        flex-direction: column;
        padding: 1rem 2rem;
        gap: 0.75rem;
        box-shadow: 0 4px 12px var(--shadow);
    }

    nav ul.open {
        display: flex;
    }
}

/* ── Hero section ── */

.hero {
    background: linear-gradient(135deg, var(--green-light), var(--green-dark));
    color: var(--white);
    text-align: center;
    padding: 5rem 2rem 4rem;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    font-size: 1.25rem;
    opacity: 0.85;
    margin-bottom: 0.75rem;
}

.hero .version {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.hero .cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ── Sections ── */

section {
    max-width: 960px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

section h2 {
    font-size: 1.8rem;
    color: var(--green-dark);
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--green-accent);
    padding-bottom: 0.5rem;
    display: inline-block;
}

section h3 {
    font-size: 1.2rem;
    color: var(--green-mid);
    margin: 1.5rem 0 0.75rem;
}

section p {
    margin-bottom: 1rem;
}

/* ── Feature grid ── */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 2px 12px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.feature-card .icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--green-light), var(--green-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin: 0 0 0.5rem;
    color: var(--text);
    font-size: 1.1rem;
}

.feature-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 0;
}

/* ── Info card ── */

.info-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 2px 12px var(--shadow);
    margin-bottom: 1.5rem;
}

/* ── Tables ── */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 2rem;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
}

table th {
    background: var(--green-dark);
    color: var(--white);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 600;
}

table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:nth-child(even) td {
    background: var(--off-white);
}

/* ── Lists ── */

ul,
ol {
    margin: 0.5rem 0 1rem 1.5rem;
}

li {
    margin-bottom: 0.4rem;
}

/* ── Footer ── */

footer {
    background: var(--green-dark);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 2rem;
    font-size: 0.9rem;
}

footer a {
    color: var(--white);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer .links {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 1rem;
}

/* ── Legal pages ── */

.legal {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.legal h1 {
    font-size: 2rem;
    color: var(--green-dark);
    margin-bottom: 0.5rem;
}

.legal .meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.legal h2 {
    font-size: 1.4rem;
    color: var(--green-dark);
    margin: 2rem 0 0.75rem;
    border-bottom: 2px solid var(--green-accent);
    padding-bottom: 0.3rem;
    display: inline-block;
}

.legal h3 {
    font-size: 1.1rem;
    color: var(--green-mid);
    margin: 1.25rem 0 0.5rem;
}

.legal p,
.legal li {
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ── Highlight box ── */

.highlight-box {
    background: #FFF8E1;
    border-left: 4px solid var(--amber);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.highlight-box.green {
    background: #E8F5E9;
    border-left-color: var(--green-accent);
}

/* ── Hero small variant ── */

.hero-small {
    padding: 3rem 2rem 2.5rem;
}

/* ── Auth overlay ── */

.auth-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}

.auth-card {
    background: var(--white);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 4px 24px var(--shadow);
    text-align: center;
}

.auth-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.auth-card h2 {
    color: var(--green-dark);
    margin-bottom: 0.5rem;
}

.auth-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.auth-card input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

.auth-card input[type="password"]:focus {
    outline: none;
    border-color: var(--green-light);
}

.auth-card .btn {
    width: 100%;
    margin-top: 0.5rem;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.auth-error {
    color: #D32F2F;
    background: #FFEBEE;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.auth-remember {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-light);
    cursor: pointer;
}

/* ── JSON Toolbar ── */

.json-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toolbar-left label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.toolbar-left select {
    padding: 0.4rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--white);
    cursor: pointer;
}

.toolbar-left select:focus {
    outline: none;
    border-color: var(--green-light);
}

.result-badge {
    background: var(--green-dark);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}

.btn-icon:hover {
    border-color: var(--green-light);
    background: #E8F5E9;
}

/* ── Loading ── */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--green-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Error ── */

.error-display {
    background: #FFEBEE;
    color: #D32F2F;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* ── Result cards ── */

.result-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 2px 12px var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.result-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--green-light), var(--green-dark));
    color: var(--white);
}

.result-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.result-number {
    font-weight: 700;
    font-size: 1.1rem;
}

.result-id {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
}

.result-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.emp-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.emp-avatar-placeholder {
    font-size: 1.5rem;
}

.emp-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.result-body {
    padding: 1.25rem;
}

/* ── Meta items ── */

.result-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
}

.meta-value {
    font-size: 0.95rem;
    word-break: break-word;
}

.meta-value a {
    color: var(--green-mid);
    text-decoration: none;
}

.meta-value a:hover {
    text-decoration: underline;
}

/* ── Photos (enhanced) ── */

.result-photos-section {
    margin-bottom: 1rem;
}

.result-photos-section h4 {
    font-size: 0.95rem;
    color: var(--green-dark);
    margin-bottom: 0.5rem;
}

.result-photos {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.photo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.photo-item a {
    display: block;
    width: 140px;
    height: 140px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: border-color 0.2s, transform 0.2s;
}

.photo-item a:hover {
    border-color: var(--green-light);
    transform: scale(1.03);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
}

/* ── Summary ── */

.result-summary {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f1f8e9;
    border-left: 3px solid var(--green-mid);
    border-radius: 0 8px 8px 0;
}

/* ── Door details ── */

.door-details-section {
    margin-bottom: 1rem;
}

.details-toggle {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--off-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--green-dark);
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    transition: background 0.2s;
}

.details-toggle:hover {
    background: #E8F5E9;
}

.door-details-content {
    padding-top: 0.75rem;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section h5 {
    font-size: 0.95rem;
    color: var(--green-dark);
    margin-bottom: 0.4rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.detail-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.detail-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.detail-label {
    font-weight: 600;
    color: var(--text-light);
    width: 30%;
    white-space: nowrap;
}

.detail-value {
    color: var(--text);
}

.detail-vis {
    text-align: center;
    width: 2rem;
}

.detail-source {
    color: var(--text-light);
    font-size: 0.8rem;
    width: 4rem;
}

.detail-subheader {
    font-weight: 700;
    color: var(--green-mid);
    padding-top: 0.5rem !important;
    font-size: 0.85rem;
    background: #fafafa;
}

/* ── Result actions ── */

.result-actions {
    margin-bottom: 0.75rem;
}

.btn-sm {
    padding: 0.4rem 1.25rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* ── Toggle JSON button ── */

.result-toggle {
    display: block;
    width: 100%;
    padding: 0.6rem;
    background: var(--off-white);
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.result-toggle:hover {
    background: #E8F5E9;
    color: var(--green-dark);
}

.result-json {
    margin: 0;
    padding: 1rem 1.25rem;
    background: #1E1E2E;
    color: #CDD6F4;
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    border-top: 1px solid var(--border);
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
    max-height: 400px;
    overflow-y: auto;
}

/* ── Raw JSON view ── */

.json-raw {
    background: #1E1E2E;
    color: #CDD6F4;
    padding: 1.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    line-height: 1.5;
    overflow: auto;
    max-height: 70vh;
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
}

/* ── Pagination ── */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-bottom: 1rem;
}

.page-info {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 600;
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    section {
        padding: 2.5rem 1.25rem;
    }

    .legal {
        padding: 2rem 1.25rem;
    }

    .json-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right {
        justify-content: flex-end;
    }

    .result-photos {
        gap: 0.5rem;
    }

    .photo-item a {
        width: 100px;
        height: 100px;
    }

    .detail-label {
        white-space: normal;
    }
}