/* =========================================
   ASB Asset Manager Pro - Stylesheet
   ========================================= */

/* --- Global --- */
.asb-dashboard {
    font-family: "Meiryo", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
    font-size: 12px;
    color: #333;
    max-width: 100%;
    margin: 20px auto;
    box-sizing: border-box;
}

/* --- Toolbar --- */
.asb-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.asb-search-group {
    display: flex;
    gap: 5px;
    align-items: center;
}

.asb-toolbar label {
    font-weight: bold;
}

.asb-toolbar input[type="text"],
.asb-toolbar select {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    height: 32px;
    box-sizing: border-box;
}

/* --- Asset Table --- */
.asb-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border: 1px solid #ccc;
    font-size: 12px;
    table-layout: fixed;
}

.asb-table th {
    background-color: #f1f1f1;
    padding: 8px 5px;
    border: 1px solid #ccc;
    text-align: left;
    white-space: nowrap;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asb-table td {
    padding: 5px;
    border: 1px solid #ccc;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* IMAGE CELL: overflow must be visible so hover popup is not clipped */
.asb-table td.td-image {
    overflow: visible;
    position: relative;
    text-align: center;
}

.asb-table tr:hover {
    background-color: #f0f8ff;
}

.text-right {
    text-align: right;
}

/* --- Clickable taxonomy terms (click to filter) --- */
.clickable-term {
    color: #0073aa;
    cursor: pointer;
    text-decoration: underline;
    margin-right: 3px;
}

.clickable-term:hover {
    color: #005177;
    text-decoration: none;
}

/* Active filter highlight */
.clickable-term.active-filter {
    background-color: #0073aa;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    text-decoration: none;
}

/* --- Thumbnail & Hover Preview --- */
.img-thumbnail-wrapper {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 45px;
}

.img-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid #ddd;
    background-color: #eee;
}

.img-preview-popup {
    display: none;
    position: absolute;
    top: -20px;
    left: 70px;
    z-index: 1000;
    background: #fff;
    padding: 5px;
    border: 1px solid #ccc;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border-radius: 4px;
    width: 250px;
    pointer-events: none;
}

.img-preview-popup img {
    width: 100%;
    height: auto;
    display: block;
}

.img-thumbnail-wrapper:hover .img-preview-popup {
    display: block;
}

/* --- Buttons --- */
.asb-btn {
    cursor: pointer;
    padding: 5px 12px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 12px;
    display: inline-block;
    text-decoration: none;
    line-height: 1.4;
    text-align: center;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #0073aa;
    color: #fff;
}
.btn-primary:hover {
    background-color: #006799;
}

.btn-secondary {
    background-color: #f0f0f1;
    color: #333;
    border: 1px solid #999;
}
.btn-secondary:hover {
    background-color: #e5e5e5;
}

.btn-vr {
    background-color: #6f42c1;
    color: #fff;
    margin-right: 5px;
}
.btn-vr:hover {
    background-color: #5a32a3;
}

.btn-search {
    background-color: #555;
    color: #fff;
}
.btn-search:hover {
    background-color: #333;
}

.btn-external {
    background-color: #fff;
    color: #6f42c1;
    border: 1px solid #6f42c1;
    margin-left: 10px;
}
.btn-external:hover {
    background-color: #f3ebff;
}

/* --- Modal --- */
.asb-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

.asb-modal-content {
    background-color: #fff;
    margin: 3vh auto;
    width: 95%;
    max-width: 900px;
    border-radius: 5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    max-height: 94vh;
    position: relative;
}

.modal-header {
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 5px 5px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.close-modal:hover {
    color: #333;
}

/* --- Tab UI --- */
.asb-tabs {
    display: flex;
    background: #eee;
    border-bottom: 1px solid #ddd;
}

.tab-link {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    color: #666;
    border-right: 1px solid #ddd;
    transition: background 0.2s;
}

.tab-link:last-child {
    border-right: none;
}

.tab-link:hover {
    background-color: #e9e9e9;
}

.tab-link.active {
    background: #fff;
    color: #0073aa;
    border-bottom: 2px solid #fff;
    margin-bottom: -1px;
}

.tab-content {
    display: none;
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.tab-content.active {
    display: block;
}

/* --- Form Elements --- */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 12px;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 3px rgba(0, 115, 170, 0.3);
}

.required-mark {
    color: #d63638;
    margin-left: 3px;
}

/* --- Maintenance History List --- */
.history-list {
    border: 1px solid #eee;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    background: #fff;
}

.history-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.history-item:nth-child(even) {
    background: #f9f9f9;
}

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

/* --- VR Overlay Panel (MP -> WP info) --- */
.asb-vr-overlay {
    position: absolute;
    top: 50px;
    right: 15px;
    width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    background: rgba(255,255,255,0.96);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 200;
    font-size: 13px;
    color: #333;
}

.asb-vr-overlay-header {
    padding: 10px 14px;
    background: #6f42c1;
    color: #fff;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
}

.asb-vr-overlay-body {
    padding: 12px 14px;
}

.asb-vr-overlay-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.asb-vr-overlay-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.asb-vr-overlay-table td:first-child {
    font-weight: bold;
    color: #666;
    width: 80px;
    white-space: nowrap;
}

/* --- Matterport status message --- */
.mp-status-msg {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 300;
    display: none;
}

/* --- Responsive Mobile --- */
@media (max-width: 768px) {
    .asb-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .asb-search-group {
        width: 100%;
    }

    .asb-table thead {
        display: none;
    }

    .asb-table tbody tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #ccc;
        border-radius: 4px;
        padding: 8px;
        background: #fff;
    }

    .asb-table tbody td {
        display: flex;
        justify-content: space-between;
        border: none;
        padding: 4px 8px;
        text-align: left !important;
        overflow: visible;
    }

    .asb-table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 10px;
        color: #666;
    }

    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .asb-vr-overlay {
        width: 100%;
        right: 0;
        top: auto;
        bottom: 0;
        max-height: 50vh;
        border-radius: 8px 8px 0 0;
    }
}
