/* ============================================
   BoxJockey — Master Stylesheet
   ============================================ */

/* === Reset & Base === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #2c3e50;
    /* Subtle dot-grid pattern on a light blue-grey background.
       Adds visual texture without being distracting. */
    background-color: #e4e9f0;
    background-image: radial-gradient(circle, #cdd4de 1px, transparent 1px);
    background-size: 24px 24px;
}

/* === Layout === */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 16px;
    border-bottom: 1px solid #cdd4de;
}

/* === Logo Branding === */
.logo-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Make logo clickable to go home — no underline or color change */
.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo-main {
    height: 120px;
}

.logo-byline {
    font-size: 13px;
    color: #7f8c8d;
    font-style: italic;
}

.logo-fsl {
    height: 40px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.org-label {
    color: #7f8c8d;
    font-size: 14px;
}

/* === Buttons === */
.btn {
    padding: 10px 20px;
    background: #1A5276;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn:hover { background: #154360; }

.btn-secondary {
    background: white;
    color: #2c3e50;
    border: 1px solid #ddd;
}

.btn-secondary:hover { background: #f5f7fa; }

.logout-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

/* === Cards & Forms === */
.card {
    background: white;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2E86C1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.error {
    color: #c0392b;
    margin-top: 12px;
    display: none;
}

/* === Auth Section (Login Page) === */
#auth-section {
    max-width: 400px;
    margin: 80px auto;
    padding: 20px;
}

/* === Welcome Bar (Dashboard) === */
.welcome-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.welcome-bar h1 {
    font-size: 24px;
    font-weight: 600;
}

/* === Dashboard Stat Cards === */
/* WHY a grid: Cards reflow on smaller screens automatically.
   auto-fill with minmax means 2 columns on mobile, 3 on desktop. */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-top: 4px solid transparent;
}

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

/* Border-top colors give each card a distinct identity at a glance */
.stat-card-blue   { border-top-color: #2E86C1; }
.stat-card-yellow { border-top-color: #F39C12; }
.stat-card-orange { border-top-color: #E67E22; }
.stat-card-purple { border-top-color: #8E44AD; }
.stat-card-green  { border-top-color: #27AE60; }
.stat-card-amber  { border-top-color: #D4AC0D; }

.stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.stat-count {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 500;
}

/* Summary row spans the full grid width */
.stat-summary {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 14px;
    color: #7f8c8d;
    padding: 8px 0;
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* === Filter Bar (Moves List) === */
.filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    background: #f0f2f5;
    border-color: #bbb;
}

.filter-btn.active {
    background: #1A5276;
    color: white;
    border-color: #1A5276;
}

/* === Moves List === */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 { font-size: 20px; }

.moves-list { list-style: none; }

.move-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.move-item:last-child { border-bottom: none; }

.move-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.move-info p {
    font-size: 13px;
    color: #7f8c8d;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

/* === Status Badges === */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-lead           { background: #EBF5FB; color: #2E86C1; }
.status-intake         { background: #FEF9E7; color: #F39C12; }
.status-pending_quote  { background: #f6ad55; color: #fff; }
.status-quoted         { background: #F5EEF8; color: #8E44AD; }
.status-booked         { background: #EAFAF1; color: #27AE60; }
.status-in_progress    { background: #FDF2E9; color: #E67E22; }
.status-completed      { background: #D5F5E3; color: #1E8449; }
.status-cancelled      { background: #F2F3F4; color: #7F8C8D; }
.status-lost           { background: #FDEDEC; color: #C0392B; }

/* === Move Detail View === */
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.back-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.back-btn:hover { background: #f5f7fa; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-field label {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-field p {
    font-size: 15px;
    font-weight: 500;
}

/* === Pipeline Buttons === */
.pipeline-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.pipeline-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.pipeline-btn:hover { background: #f5f7fa; }

.pipeline-btn.active {
    background: #1A5276;
    color: white;
    border-color: #1A5276;
}

.pipeline-btn.active:hover { background: #154360; }

/* === Rooms & Photos (Operator Review) === */
.room-card {
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fb;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.room-header:hover { background: #eef1f5; }

/* Rotate indicator arrow when room is expanded */
.room-header::after {
    content: '▸';
    font-size: 14px;
    color: #999;
    transition: transform 0.2s ease;
}

.room-header.room-open::after {
    transform: rotate(90deg);
}

.room-name {
    font-weight: 600;
    font-size: 15px;
}

.room-count {
    font-size: 13px;
    color: #7f8c8d;
}

/* Photo thumbnail grid — 4 columns, gap between each */
.room-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 12px 16px;
}

.photo-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.photo-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.room-empty {
    font-size: 13px;
    color: #999;
    padding: 8px 0;
    grid-column: 1 / -1;
}

/* === Photo Lightbox === */
/* WHY: A dark overlay with the image centered. Clicking outside
   or pressing Escape closes it. Prev/next arrows to flip through. */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }

.lightbox-caption {
    position: absolute;
    bottom: -36px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

/* === Responsive Adjustments === */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pipeline-bar {
        gap: 4px;
    }

    .pipeline-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .lightbox-prev { left: 4px; }
    .lightbox-next { right: 4px; }
}
