/* Pressura SaaS — Stylesheet */

:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --success: #27ae60;
    --danger: #c0392b;
    --warning: #f39c12;
    --grey: #7f8c8d;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --white: #ffffff;
    --bg: #f5f6fa;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
}

/* ── Navbar ── */
.navbar {
    background: var(--primary);
    padding: 0.8rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand a {
    color: var(--white);
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.9rem;
}
.nav-links a:hover { color: var(--white); }

/* ── Container ── */
.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--grey);
    font-size: 0.85rem;
    margin-top: 3rem;
}
.footer a { color: var(--primary-light); text-decoration: none; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}
.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-pass .stat-number { color: var(--success); }
.stat-fail .stat-number { color: var(--danger); }
.stat-label {
    font-size: 0.85rem;
    color: var(--grey);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Data Table ── */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--light);
    font-size: 0.9rem;
}
.data-table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table tbody tr:hover { background: rgba(26,82,118,0.03); }

.text-pass { color: var(--success); font-weight: 600; }
.text-fail { color: var(--danger); font-weight: 600; }

.btn-small {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: var(--primary-light);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.8rem;
}
.btn-small:hover { background: var(--primary); }

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--grey);
    background: var(--white);
    border-radius: 8px;
}

h2 { color: var(--primary); margin-bottom: 0.5rem; }
h3 { color: var(--dark); margin-bottom: 0.8rem; }

/* ── Verify Page (QR scan landing) ── */
.verify-page {
    background: linear-gradient(135deg, var(--primary) 0%, #1a3c5e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.verify-container {
    width: 100%;
    max-width: 500px;
}
.verify-header {
    text-align: center;
    color: var(--white);
    margin-bottom: 1.5rem;
}
.verify-header h1 {
    font-size: 1.8rem;
    letter-spacing: 2px;
    font-weight: 700;
}
.verify-header .subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.3rem;
}
.verify-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.verify-status {
    text-align: center;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
}
.status-pass { background: #d5f5e3; color: #1e8449; }
.status-fail { background: #fadbd8; color: #922b21; }
.status-pending { background: #fdebd0; color: #b9770e; }
.status-notfound { background: var(--light); color: var(--grey); }

.verify-table {
    width: 100%;
    border-collapse: collapse;
}
.verify-table th, .verify-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--light);
}
.verify-table th {
    text-align: left;
    color: var(--grey);
    font-weight: 500;
    width: 40%;
}
.verify-table td {
    color: var(--dark);
    font-weight: 500;
}

.verify-notfound-text {
    text-align: center;
    padding: 1rem 0;
    color: var(--grey);
    font-size: 0.9rem;
    line-height: 1.6;
}

.verify-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
}
.verify-footer a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

/* ── Login Page ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem;
}
.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}
.login-card h2 {
    font-size: 1.8rem;
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}
.login-subtitle {
    color: var(--grey);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.login-footer {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--grey);
}
.login-footer a { color: var(--primary-light); text-decoration: none; }

/* ── Forms ── */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.3rem;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-primary { background: var(--primary-light); color: var(--white); }
.btn-primary:hover { background: var(--primary); }
.btn-secondary { background: var(--light); color: var(--dark); }
.btn-secondary:hover { background: #ddd; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #a93226; }
.btn-full { width: 100%; }

.btn-small.btn-pass { background: var(--success); }
.btn-small.btn-pass:hover { background: #1e8449; }
.btn-small.btn-fail { background: var(--danger); }
.btn-small.btn-fail:hover { background: #a93226; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-pass { background: #d5f5e3; color: #1e8449; }
.badge-fail { background: #fadbd8; color: #922b21; }
.badge-trial { background: #fdebd0; color: #b9770e; }

/* ── Cards ── */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5rem;
}

/* ── Alerts ── */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.alert-error { background: #fadbd8; color: #922b21; }
.alert-warning { background: #fdebd0; color: #b9770e; }
.alert-success { background: #d5f5e3; color: #1e8449; }
.alert a { color: inherit; font-weight: 600; }

/* ── CTA Box (sign-in prompt on verify page) ── */
.cta-box {
    background: linear-gradient(135deg, #eaf2f8 0%, #d6eaf8 100%);
    border: 1px solid #aed6f1;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-top: 1.5rem;
}
.cta-box p {
    color: var(--dark);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ── Search Bar ── */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.search-bar input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary-light);
}

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

/* ── Valve Lifecycle ── */
.valve-header h2 { margin-bottom: 0.2rem; }
.valve-header .text-muted { margin-bottom: 1.5rem; }

.valve-identity { gap: 0.6rem; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}
.section-header h3 { margin-bottom: 0; }

.status-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}
.status-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}
.status-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Status badges */
.badge-status-active { background: #d5f5e3; color: #1e8449; }
.badge-status-condemned { background: #fadbd8; color: #922b21; }
.badge-status-repair { background: #fdebd0; color: #b9770e; }
.badge-status-spare { background: #d6eaf8; color: #2471a3; }
.badge-status-decommissioned { background: #e8e8e8; color: #666; }

/* Service / doc badges */
.badge-service { background: #d6eaf8; color: #1a5276; }
.badge-doc { background: #e8daef; color: #6c3483; }

.text-overdue { color: var(--danger); font-weight: 600; }

/* Trend chart container */
.trend-chart { background: var(--white); padding: 1rem; border-radius: 8px; }
.trend-chart h4 { color: var(--dark); margin-bottom: 0.8rem; font-size: 0.95rem; }

/* Small button variant */
.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* Add form toggle (details/summary) */
.add-form-toggle summary {
    cursor: pointer;
    list-style: none;
}
.add-form-toggle summary::-webkit-details-marker { display: none; }

/* Textarea */
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

/* Form section headers */
.card h4 {
    color: var(--primary);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--light);
    font-size: 0.95rem;
}
.card h4:first-child { margin-top: 0; }

/* ── Invoice ── */
.invoice-page { max-width: 800px; margin: 0 auto; }
.invoice-card {
    background: var(--white);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}
.invoice-addresses {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.invoice-addresses h4 {
    margin: 0 0 0.3rem;
    color: var(--grey);
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: none;
}
.invoice-addresses p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.invoice-table th {
    background: var(--bg);
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--grey);
    text-align: left;
    border-bottom: 2px solid var(--light);
}
.invoice-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--light);
    font-size: 0.9rem;
}
.invoice-table tfoot td {
    border-bottom: none;
    padding: 0.4rem 1rem;
}
.invoice-total td {
    border-top: 2px solid var(--dark);
    padding-top: 0.8rem;
}

.badge-tier { background: #d6eaf8; color: #1a5276; }

/* ── Print styles ── */
@media print {
    .navbar, .footer, .card:last-child, button, .btn, a[href='/admin/billing'] { display: none !important; }
    .invoice-card { box-shadow: none; padding: 0; }
    body { background: white; }
    .container { max-width: 100%; margin: 0; padding: 0; }
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
    .navbar {
        padding: 0.6rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem 1rem;
    }
    .nav-links a { margin-left: 0; font-size: 0.8rem; }
    .container { padding: 0 1rem; }
    .stat-number { font-size: 1.8rem; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.5rem; }
    .stat-card { padding: 1rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
    .verify-header h1 { font-size: 1.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .invoice-addresses { grid-template-columns: 1fr; gap: 1rem; }
    .invoice-header { flex-direction: column; gap: 1rem; }
    .search-bar form { flex-wrap: wrap; }
}
