/* Custom Styles for Estate Inventory Tracker */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #001f37;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* colors for summary cards */
.purple-bg {
    background-color: #6a56ff !important;
}  

.blue-bg {
    background-color: #31a3ff !important;
}

.cyan-bg {
    background-color: #32c7e9 !important;
}

.header-bg {
    background-color: #004080 !important;
}

/* Summary Cards */
.summary-card {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: none;
    transition: none;
}

/* Asset Cards */
.asset-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
    transition: none;
    overflow: hidden;
}

.asset-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.asset-image {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

/* Asset List Row Styles */
.asset-row {
    padding: 12px 16px;
    background-color: #7dc9ff;
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 8px;
    margin-bottom: 12px;
}

.asset-image-small {
    width: 80px;
    height: 60px;
    object-fit: cover;
    flex-shrink: 0;
}

.asset-info h5 {
    margin-bottom: 4px;
}

.asset-actions .btn {
    margin-left: 6px;
}

@media (max-width: 576px) {
    .asset-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .asset-actions {
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
}

/* Horizontal compact row layout */
.asset-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asset-right {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
}

.asset-meta {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    min-width: 160px;
}

.asset-meta > div {
    white-space: nowrap;
}

.asset-title h5 {
    font-size: 1rem;
    margin: 0;
}

@media (max-width: 576px) {
    .asset-right {
        width: 100%;
        justify-content: space-between;
    }
    .asset-meta {
        flex-direction: column;
        align-items: flex-start;
        min-width: 0;
    }
}

/* Table tweaks */
#assetsTable td, #assetsTable th {
    vertical-align: middle;
}

/* Scoped dropdown toggle styles for asset-row/table controls only */
#assetsTable .dropdown .dropdown-toggle,
.asset-row .dropdown .dropdown-toggle,
.asset-actions .dropdown-toggle {
    border: none;
    background: transparent;
    padding: 0.25rem 0.35rem;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.12s ease, transform 0.08s ease;
}

/* Slight hover/bg feedback for the kebab button */
.dropdown .dropdown-toggle:hover {
    background-color: rgba(0,0,0,0.04);
}

/* Make the vertical triple-dot icon larger for readability */
#assetsTable .dropdown-toggle i.bi-three-dots-vertical {
    font-size: 1.25rem;
    line-height: 1;
}

/* Remove the small caret/triangle that Bootstrap adds to dropdown toggles
   for the asset table rows so the kebab icon appears as a vertical triple-dot only. */
#assetsTable .dropdown-toggle::after {
    display: none !important;
}

/* Table layout: use natural sizing for columns (undo recent forced title expansion) */
#assetsTable {
    width: 100%;
}

#assetsTable td.col-auto, #assetsTable th.col-auto {
    white-space: nowrap;
}

.title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #dfdfdf;
}

.asset-details {
    font-size: 0.9rem;
}

.asset-details p {
    margin-bottom: 0.5rem;
}

.card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: none;
    transition: none;
}

.table-responsive {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-content {
    border-radius: 10px;
}

.btn {
    border-radius: 5px;
    transition: none;
}

.btn:hover {
    /* no translate/raise on hover; keep subtle shadow if desired */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Wider Add Asset button for better prominence */
.add-asset-btn {
    min-width: 220px;
    padding-left: 1.1rem;
    padding-right: 1.1rem;
}

.badge {
    padding: 8px 12px;
    font-size: 0.9rem;
}

h1, h2, h3, h4, h5 {
    color: #fff;
    font-weight: 600;
}

.form-label {
    font-weight: 500;
    color: #495057;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Keep summary cards side-by-side on small screens and reduce font/padding to fit */
@media (max-width: 576px) {
    /* Override Bootstrap .row margins so our summary-row sizing is predictable */
    .summary-row {
        display: flex !important;
        flex-wrap: nowrap !important; /* keep side-by-side */
        overflow-x: hidden;
        gap: 5px; /* exact 5px gap between cards */
        padding-bottom: 0.5rem;
        align-items: stretch;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Calculate each card width so three cards + two 5px gaps = 100% */
    .summary-row > .col-md-4 {
        flex: 0 0 calc((100% - 10px) / 3) !important;
        max-width: calc((100% - 10px) / 3) !important;
        padding-left: 2.5px !important;
        padding-right: 2.5px !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    /* Also handle cases where Bootstrap applies extra column wrappers */
    .summary-row > div.col-md-4 > .card,
    .summary-row > .col-md-4 > .card {
        height: 100%;
    }

    .summary-card .card-body {
        padding: 0.5rem 0.6rem;
    }

    .summary-card .card-title {
        font-size: 0.78rem;
    }

    .summary-card h2 {
        font-size: 1.15rem;
        margin: 0;
        line-height: 1.1;
    }

    /* When the summary cards stack vertically, ensure a 5px gap between them */
    .summary-row > .col-md-4 {
        margin-bottom: 5px;
    }
    .summary-row > .col-md-4:last-child {
        margin-bottom: 0;
    }
}

/* On small screens, hide quantity and estimated value columns to simplify the grid */
@media (max-width: 576px) {
    #assetsTable th.col-qty,
    #assetsTable td.col-qty,
    #assetsTable th.col-est,
    #assetsTable td.col-est {
        display: none;
    }

    /* Make rows more tappable */
    #assetsTable tbody tr {
        cursor: pointer;
    }
    /* Smaller thumbnails for phone screens */
    #assetsTable img.asset-image-small {
        width: 48px;
        height: 36px;
        object-fit: cover;
    }
}

/* Stack the header controls (filter + add) on small screens */
@media (max-width: 576px) {
    .assets-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .assets-header .header-controls {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .assets-header .header-controls select.form-select,
    .assets-header .header-controls .add-asset-btn {
        width: 100%;
    }
}
