/* ===== Material & Tool Inventory — The Bluff Workshop ===== */
/* Phase 1 Prototype: Static UI with mock data */

:root {
    --color-bg: #FFFFFF;
    --color-primary: #1EA2C0;
    --color-primary-dark: #178899;
    --color-accent: #DB68AC;
    --color-text: #1a1a1a;
    --color-text-muted: #666666;
    --color-border: #e5e5e5;
    --color-bg-alt: #f8f9fa;
    --color-success: #57B488;
    --color-warning: #F09D3D;
    --color-danger: #E12D4A;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --nav-height: 56px;
    --bottom-nav-height: 64px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--color-text);
    background: var(--color-bg-alt);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.screen { display: none; }
.screen.active { display: block; }

/* ===== Login ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f0f9fb 0%, #fdf2f8 100%);
}
.login-logo-img { width: 80px; height: auto; margin-bottom: 1rem; }
.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; text-align: center; }
.login-subtitle { color: var(--color-text-muted); margin-bottom: 2rem; text-align: center; }
.login-form { width: 100%; max-width: 360px; }
.login-note {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: center;
    background: #fff3cd;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

/* ===== App Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    box-shadow: var(--shadow);
}
.app-header-inner {
    max-width: 960px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}
.app-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 700;
    font-size: 1.1rem;
}
.app-logo-img { height: 32px; width: auto; }
.app-header-right { display: flex; align-items: center; gap: 0.75rem; }
.user-name { font-size: 0.85rem; color: var(--color-text-muted); }

/* ===== Bottom Nav (Mobile) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: #fff;
    border-top: 1px solid var(--color-border);
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.7rem;
    transition: color 0.2s;
}
.bottom-nav-item.active { color: var(--color-primary); }
.bottom-nav-icon { font-size: 1.4rem; margin-bottom: 2px; }

/* ===== Container ===== */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 1rem) 1rem calc(var(--bottom-nav-height) + 1rem);
}

/* ===== Typography ===== */
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.section-title { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.75rem; color: var(--color-text-muted); }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.back-link {
    display: inline-block;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.back-link:hover { text-decoration: underline; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-full { width: 100%; }

/* ===== Dashboard ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.dashboard-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.dashboard-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.dashboard-card-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.dashboard-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.dashboard-stat { font-size: 2rem; font-weight: 700; color: var(--color-primary); }
.dashboard-label { font-size: 0.8rem; color: var(--color-text-muted); }
.dashboard-card-action { border: 2px dashed var(--color-border); background: transparent; }
.dashboard-card-action .dashboard-card-icon { color: var(--color-primary); font-size: 2.5rem; }

/* ===== Search ===== */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.search-input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    outline: none;
}
.search-input:focus { border-color: var(--color-primary); }
.filter-select {
    padding: 0.6rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: #fff;
    min-width: 120px;
}

/* ===== Card Grid ===== */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 600px) {
    .card-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
    .card-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* ===== Item Card ===== */
.item-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--color-text);
    display: block;
    transition: transform 0.2s, box-shadow 0.2s;
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.item-card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--color-bg-alt);
}
.item-card-body { padding: 0.75rem; }
.item-card-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.item-card-meta { font-size: 0.8rem; color: var(--color-text-muted); }
.item-card-badges { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-available { background: #e6f7ef; color: #1a7f4b; }
.badge-reserved { background: #fff3e0; color: #b36b00; }
.badge-used { background: #f0f0f0; color: #666; }
.badge-good { background: #e6f7ef; color: #1a7f4b; }
.badge-needs-repair { background: #fff3e0; color: #b36b00; }
.badge-broken { background: #fde8ec; color: #c0392b; }
.badge-category { background: #e8f4fd; color: #1565a0; }
.badge-3d { background: #f3e8fd; color: #7b1fa2; }

/* ===== Detail View ===== */
.detail-header { margin-bottom: 1.5rem; }
.detail-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.detail-gallery {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}
.detail-gallery img {
    height: 200px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
}
.detail-info { background: #fff; border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--color-text-muted); }
.detail-row-value { font-weight: 500; text-align: right; }
.detail-description {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
}
.detail-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.detail-3d {
    margin-top: 1rem;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.detail-3d-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
}
.detail-3d model-viewer {
    width: 100%;
    height: 300px;
}

/* ===== Forms ===== */
.form-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--color-text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1.5rem; }

/* ===== File Upload ===== */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.file-upload-area:hover { border-color: var(--color-primary); background: #f0f9fb; }
.file-input {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}
.file-upload-label { pointer-events: none; }
.file-upload-icon { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.file-upload-hint { display: block; font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.25rem; }

.photo-preview-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.photo-preview-grid img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--color-border);
}

/* ===== Detail Section Header (inline edit) ===== */
.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

/* ===== Editable Media Thumbnails ===== */
.media-thumb-wrap {
    position: relative;
    display: inline-block;
}
.media-thumb-wrap img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--color-border);
}
.media-delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-danger);
    color: #fff;
    border: 2px solid #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: var(--shadow);
}
.media-delete-btn:hover {
    background: #b71c33;
}
.scan-existing-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.scan-existing-item .scan-info {
    flex: 1;
    font-size: 0.9rem;
}
.scan-existing-item .scan-icon {
    font-size: 1.5rem;
}

/* ===== Lightbox ===== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
}
.lightbox-overlay.visible { opacity: 1; }
.lightbox-overlay img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    cursor: default;
}
.lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
}
.photo-preview-grid img,
.detail-gallery img { cursor: pointer; }

/* ===== Item List (Recent) ===== */
.item-list { display: flex; flex-direction: column; gap: 0.5rem; }
.item-list-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    padding: 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
    box-shadow: var(--shadow);
}
.item-list-row:hover { box-shadow: var(--shadow-lg); }
.item-list-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--color-bg-alt);
    flex-shrink: 0;
}
.item-list-info { flex: 1; }
.item-list-name { font-weight: 600; font-size: 0.9rem; }
.item-list-sub { font-size: 0.8rem; color: var(--color-text-muted); }

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-text);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    box-shadow: var(--shadow-lg);
}
.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .bottom-nav { display: none; }
    .container {
        padding-bottom: 2rem;
    }
}
@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr; }
    .search-bar { flex-direction: column; }
    .detail-gallery img { height: 150px; }
}
