/* HVAC Field Service — mobile-first styles, no build step, no framework. */

:root {
    --blue: #1d5fae;
    --blue-dark: #144582;
    --green: #1f8a4c;
    --amber: #b9791b;
    --red: #c0392b;
    --gray-50: #f7f8fa;
    --gray-100: #eef0f3;
    --gray-200: #dde1e6;
    --gray-400: #9aa3af;
    --gray-600: #5b6673;
    --gray-800: #2c333b;
    --radius: 10px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px 48px;
}

/* ---------- Top navigation ---------- */
.topbar {
    background: var(--blue-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { color: #fff; font-weight: 700; font-size: 1.05rem; display: inline-flex; align-items: center; }
.brand-logo { max-height: 32px; max-width: 160px; display: block; }
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}
.topnav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topnav a { color: #dce8fb; }
.topnav a:hover { color: #fff; }
.nav-user { color: #a9c2e6; font-size: 0.85rem; margin-left: 4px; }
.nav-logout {
    background: rgba(255,255,255,0.15);
    padding: 6px 12px;
    border-radius: 6px;
    color: #fff !important;
}

@media (max-width: 640px) {
    .nav-toggle { display: block; }
    .topnav {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
        padding-top: 12px;
    }
    .topnav.open { display: flex; }
    .topbar { flex-wrap: wrap; }
}

/* ---------- Flash messages ---------- */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 0.95rem; }
.flash-success { background: #e5f6ea; color: #1f6b38; border: 1px solid #b9e3c4; }
.flash-error { background: #fbeaea; color: var(--red); border: 1px solid #f2c6c1; }
.flash-info { background: #eaf1fb; color: var(--blue-dark); border: 1px solid #c9dcf5; }

/* ---------- Cards / lists ---------- */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}
.card h1, .card h2, .card h3 { margin-top: 0; }

.list-card {
    display: block;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    color: inherit;
}
.list-card:hover { border-color: var(--blue); text-decoration: none; }
.list-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.list-card-title { font-weight: 600; font-size: 1.02rem; }
.list-card-meta { color: var(--gray-600); font-size: 0.88rem; margin-top: 4px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-600);
    white-space: nowrap;
}
.badge-scheduled { background: #eaf1fb; color: var(--blue-dark); }
.badge-progress { background: #fdf1de; color: var(--amber); }
.badge-completed { background: #e5f6ea; color: var(--green); }
.badge-cancelled { background: #fbeaea; color: var(--red); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 0.92rem; }
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    color: var(--gray-800);
    font-family: inherit;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.field-hint { color: var(--gray-600); font-size: 0.82rem; margin-top: 4px; }
fieldset { border: 1px solid var(--gray-200); border-radius: var(--radius); margin: 0 0 16px; padding: 12px 14px; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 11px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--blue);
    color: #fff !important;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
}
.btn:hover { background: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--blue-dark) !important; border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #9c2d21; }
.btn-success { background: var(--green); }
.btn-success:hover { background: #176b3c; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Utility ---------- */
.muted { color: var(--gray-600); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
hr.sep { border: none; border-top: 1px solid var(--gray-200); margin: 18px 0; }
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--gray-100); font-size: 0.92rem; }

/* ---------- Login page ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .brand-title { text-align: center; font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.login-card .brand-sub { text-align: center; color: var(--gray-600); margin-bottom: 20px; font-size: 0.9rem; }
.demo-creds { background: var(--gray-100); border-radius: 8px; padding: 10px 12px; font-size: 0.82rem; color: var(--gray-600); margin-top: 16px; }

/* ---------- Photo gallery ---------- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin: 12px 0;
}
.photo-tile { position: relative; border-radius: 8px; overflow: hidden; background: var(--gray-100); aspect-ratio: 1/1; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile form { position: absolute; top: 4px; right: 4px; }
.photo-tile .del-btn {
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
    cursor: pointer;
}
.photo-caption { font-size: 0.72rem; color: var(--gray-600); padding: 2px 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.capture-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed var(--gray-400);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--gray-600);
    font-weight: 600;
    cursor: pointer;
    background: #fff;
}
.capture-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Stat row (dashboard) ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-tile { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-tile .num { font-size: 1.5rem; font-weight: 700; }
.stat-tile .label { font-size: 0.78rem; color: var(--gray-600); }
@media (max-width: 480px) { .stat-row { grid-template-columns: repeat(3, 1fr); gap: 6px; } .stat-tile { padding: 10px 6px; } .stat-tile .num { font-size: 1.2rem; } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters a { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--gray-200); color: var(--gray-600); font-size: 0.85rem; }
.filters a.active { background: var(--blue); border-color: var(--blue); color: #fff; }
