/* Global */
* {
    box-sizing: border-box;
}

body.page {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Make cards breathe a bit more on small screens */
@media (max-width: 640px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .main {
        margin: 16px auto 24px;
        padding: 0 10px;
    }

    .card {
        margin-bottom: 12px;
        padding: 16px 14px 12px;
        border-radius: 10px;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .btn {
        width: 100%;       /* Big tappable buttons */
        justify-content: center;
    }

    .btn-sm {
        width: auto;       /* keep small buttons inline */
    }

    input[type="text"],
    input[type="number"],
    select,
    textarea {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .photo-card img {
        max-height: 140px;
        object-fit: cover;
    }
}

/* Equipment cards instead of table on engineer rack view */
.equipment-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.equipment-card {
    background: #f9fafb;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid #e5e7eb;
}

.equipment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-weight: 600;
}

.equipment-card-meta {
    font-size: 0.8rem;
    color: #6b7280;
}

.equipment-card-notes {
    font-size: 0.85rem;
    margin-top: 4px;
}


/* Layout */
.header {
    background: #111827;
    color: #f9fafb;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

.main {
    max-width: 1100px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 20px 16px;
    box-shadow: 0 10px 15px -3px rgb(15 23 42 / 0.1),
                0 4px 6px -4px rgb(15 23 42 / 0.1);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.card-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
}

/* Forms */
form {
    margin-top: 8px;
}

.form-grid {
    display: grid;
    gap: 10px;
}

@media (min-width: 640px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

label {
    font-size: 0.9rem;
    color: #374151;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

input[type="text"],
input[type="number"],
select,
textarea {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 8px 10px;
    font-size: 0.9rem;
    outline: none;
    width: 100%;
}

input[type="file"] {
    font-size: 0.9rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb33;
}

/* Buttons */
.btn {
    border-radius: 999px;
    border: none;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #2563eb;
    color: #f9fafb;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Tables & lists */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
}

.list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.list li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list li:last-child {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-status-new {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-status-in_progress {
    background: #fef3c7;
    color: #92400e;
}

.badge-status-submitted {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-status-approved {
    background: #dcfce7;
    color: #166534;
}

/* Chips for room/rack */
.chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #f3f4f6;
    color: #374151;
}

/* Photo grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.photo-card {
    background: #f9fafb;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
}

.photo-card img {
    max-width: 100%;
    border-radius: 8px;
}

/* Small header link */
.breadcrumb {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 10px;
}
/* ---------- Lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lightbox.open {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 95%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    object-fit: contain;
    background: #000;
}

.lightbox-caption {
    color: #f9fafb;
    font-size: 14px;
    text-align: center;
    max-width: 80vw;
    word-wrap: break-word;
}

.lightbox-close {
    position: absolute;
    top: -10px;
    right: -10px;
    border: none;
    border-radius: 9999px;
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 32px;
    cursor: pointer;
    background: #111827;
    color: #f9fafb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: #dc2626;
}

/* Make thumbnails look clickable */
.photo-grid img {
    cursor: zoom-in;
}
.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Navigation arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #f9fafb;
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 2;
}

.lightbox-prev {
    left: -18px;
}

.lightbox-next {
    right: -18px;
}

.lightbox-nav:hover {
    background: rgba(37, 99, 235, 0.9);
}
