/* Custom styles for Asset Management System */

/* ── Color palette overrides ───────────────────────────────────── */
:root {
    --pico-font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --pico-primary: #4f46e5;
    --pico-primary-hover: #4338ca;
    --pico-primary-focus: rgba(79, 70, 229, 0.35);
    --pico-primary-inverse: #ffffff;
    --pico-card-background-color: #ffffff;
    --pico-background-color: #f1f5f9;
    --pico-color: #0f172a;
    --pico-muted-color: #64748b;
    --pico-card-border-color: #e2e8f0;
    --pico-border-color: #e2e8f0;
    --pico-table-border-color: #e2e8f0;
    --pico-form-element-border-color: #cbd5e1;
    --pico-form-element-background-color: #ffffff;
    --pico-form-element-active-border-color: #4f46e5;
    --pico-font-weight: 400;
    --pico-h1-font-weight: 700;
    --pico-h2-font-weight: 600;
    --pico-h3-font-weight: 600;
    --pico-radius: 0.75rem;
}

/* ── Body background ───────────────────────────────────────────── */
body {
    background: var(--pico-background-color);
}

/* ── Navigation ─────────────────────────────────────────────────── */
nav.container-fluid {
    padding: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border-bottom: none;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 3.5rem;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.desktop-nav {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
}

.desktop-nav li a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.4rem 0.85rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.desktop-nav li a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Mobile Menu Button ─────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    gap: 0.4rem;
    color: #ffffff;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.menu-text {
    font-family: inherit;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ffffff;
}

/* Down-arrow chevron icon */
.chevron-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.chevron-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-menu-btn.active .chevron-icon {
    transform: rotate(180deg);
}

/* ── Mobile Navigation Dropdown ─────────────────────────────────── */
.mobile-nav {
    display: none;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease, padding 0.3s ease;
    background: #3730a3;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav.open {
    display: block;
    max-height: 300px;
    padding: 0.5rem 0;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0 0.5rem;
}

.mobile-nav li {
    text-align: center;
}

.mobile-nav li a {
    display: block;
    padding: 0.7rem 1rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    border-radius: 0.5rem;
    transition: background 0.2s ease;
}

.mobile-nav li a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* ── Main content area ──────────────────────────────────────────── */
main.container {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ── Page headers ───────────────────────────────────────────────── */
main > header {
    margin-bottom: 1.5rem;
}

main h1 {
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0;
}

/* ── Cards (articles, details) ──────────────────────────────────── */
article {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-card-border-color);
    border-radius: var(--pico-radius);
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
}

article header {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: var(--pico-muted-color);
}

/* ── Tables ─────────────────────────────────────────────────────── */
table {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-card-border-color);
    border-radius: var(--pico-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pico-muted-color);
    border-bottom: 2px solid var(--pico-border-color);
}

table tbody tr {
    border-bottom: 1px solid var(--pico-table-border-color);
    transition: background 0.15s ease;
}

table tbody tr:last-child {
    border-bottom: none;
}

table tbody tr:hover {
    background: #f8fafc;
}

table td {
    vertical-align: middle;
}

/* ── Forms & Inputs ─────────────────────────────────────────────── */
input,
select,
textarea {
    border-radius: 0.5rem;
    border: 1px solid var(--pico-form-element-border-color);
    background: var(--pico-form-element-background-color);
    padding: 0.6rem 0.85rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--pico-primary);
    box-shadow: 0 0 0 3px var(--pico-primary-focus);
}

/* ── Buttons ────────────────────────────────────────────────────── */
button,
a[role="button"] {
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

button:hover,
a[role="button"]:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

button.outline,
a[role="button"].outline {
    box-shadow: none;
}

/* ── Status badges ──────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.status-retired {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-maintenance {
    background-color: #fef9c3;
    color: #854d0e;
}

/* ── Image upload dropzone ──────────────────────────────────────── */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--pico-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
    background: #fafbfc;
}

.dropzone.dragover {
    border-color: var(--pico-primary);
    background-color: #eef2ff;
}

.file-upload-btn {
    color: var(--pico-primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Image preview grid ─────────────────────────────────────────── */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.image-card {
    position: relative;
    border: 1px solid var(--pico-card-border-color);
    border-radius: var(--pico-radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    background: #fff;
}

.image-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.image-card.primary {
    border-color: var(--pico-primary);
    border-width: 2px;
}

.image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-actions {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background: #fafbfc;
    flex-wrap: wrap;
    justify-content: center;
}

.image-actions button,
.image-actions .small {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

.primary-badge {
    background: var(--pico-primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* ── Asset detail gallery ───────────────────────────────────────── */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--pico-radius);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--pico-card-border-color);
}

.image-gallery img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.image-gallery .primary-image {
    grid-column: 1 / -1;
    height: 400px;
}

.no-images {
    text-align: center;
    padding: 3rem;
    color: var(--pico-muted-color);
    background: var(--pico-card-background-color);
    border-radius: var(--pico-radius);
    border: 2px dashed var(--pico-border-color);
}

/* ── Form actions ───────────────────────────────────────────────── */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ── Responsive table ───────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Action buttons in tables ───────────────────────────────────── */
.actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* ── Danger button variant ──────────────────────────────────────── */
button.danger,
button.danger.outline {
    --pico-form-element-invalid-border-color: var(--pico-del-color);
    background: var(--pico-del-background-color);
    border-color: var(--pico-del-color);
    color: var(--pico-del-color);
}

button.danger.outline {
    background: transparent;
}

button.danger:hover {
    background: var(--pico-del-color);
    color: white;
}

/* ── Small button variant ───────────────────────────────────────── */
button.small,
a.small {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* ── Flexbox utilities ──────────────────────────────────────────── */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── Details/Summary ────────────────────────────────────────────── */
details {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-card-border-color);
    border-radius: var(--pico-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

details summary {
    font-weight: 600;
    cursor: pointer;
}

/* ── Footer ─────────────────────────────────────────────────────── */
footer.container-fluid {
    background: #1e293b;
    color: #94a3b8;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    text-align: center;
    font-size: 0.85rem;
}

/* ── Table thumbnails ───────────────────────────────────────────── */
.table-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-right: 10px;
    vertical-align: middle;
}

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--pico-muted-color);
}

/* ── Login page ─────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
}

.login-card {
    max-width: 420px;
    width: 100%;
    background: #ffffff;
    border-radius: var(--pico-radius);
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.login-card h1 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #4f46e5;
}

.login-card .alert-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid #fecaca;
}

.login-card .demo-creds {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    line-height: 1.6;
}

/* ── Stat cards (QR code stats) ─────────────────────────────────── */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--pico-card-border-color);
    border-radius: var(--pico-radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.stat-card h5 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pico-muted-color);
    margin-bottom: 0.25rem;
}

.stat-card h2 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}

.stat-card.available h2 { color: #166534; }
.stat-card.assigned h2 { color: #4f46e5; }
.stat-card.printed h2 { color: #64748b; }

/* ── QR code images ─────────────────────────────────────────────── */
.qr-checkbox-list {
    max-height: 300px;
    overflow-y: auto;
}

.qr-thumb {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 0.375rem;
    border: 1px solid var(--pico-border-color);
}

.qr-code-img {
    max-width: 200px;
    border: 1px solid var(--pico-border-color);
    border-radius: var(--pico-radius);
}

/* ── Mobile optimizations ───────────────────────────────────────── */
@media (max-width: 768px) {
    .flex-between {
        flex-direction: column;
        align-items: stretch;
    }
    
    .image-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .image-gallery .primary-image {
        height: 250px;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .actions button,
    .actions a {
        width: 100%;
        text-align: center;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .desktop-nav {
        display: none;
    }
}
