/**
 * User List Styles
 * Styles for the user management DataTable
 */

/* User list container */
.maticad365-user-list {
    margin: 20px 0;
}

/* Users loading spinner */
.users-loading {
    text-align: center;
    padding: 40px 20px;
}

.users-loading .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* User grid view */
.user-grid-view {
    margin-top: 20px;
}

/* Bulk actions toolbar */
.bulk-actions {
    margin-bottom: 15px;
}

#add-user,#proj-open-all {
    cursor:pointer
}

.delete_selected_users {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.delete_selected_users:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.delete_selected_users:hover:not(:disabled) {
    background: #c82333;
}

.delete-progress {
    color: #666;
    font-size: 14px;
}

/* User actions buttons */
.user-actions {display: flex;flex-direction: row;align-content: flex-end;grid-gap:10px}
.user-actions img {width: 13px}


/* Toggle switch for active status */
.user-active-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin: 0;
    cursor: pointer;
}

.user-active-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .toggle-slider {
    background-color: #28a745;
}

input:focus + .toggle-slider {
    box-shadow: 0 0 3px #28a745;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

input:disabled + .toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}


/* User role badge */
.user-role {
    font-weight: 500;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 4px;
    display: inline-block;
    font-size: 13px;
    color: #333;
}

/* DataTable cell alignments */
td.user-actions-cell,
td.user-status-cell {
    text-align: center;
    vertical-align: middle;
}

td.cell-checkbox {
    text-align: center;
    width: 40px;
    vertical-align: middle;
}

/* Error message */
.error-message {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .user-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .user-edit-btn,
    .user-delete-btn {
        padding: 4px 8px;
    }
}

/* User Edit Form Styles */
.maticad365-user-edit-form-wrapper {
    max-width: 100%;
    margin: 0px auto;
    padding: 30px;
}

.maticad365-user-edit-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.maticad365-user-edit-form .form-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 15px;
    align-items: center;
    border-bottom: 1px solid #F2F2F2
}

.maticad365-user-edit-form .form-row label {
    color: #777A8D;
    text-align: left;
    padding-right: 10px;
}

.maticad365-user-edit-form .form-field {
    width: 100%;
    padding: 10px 0;
    border: 0 none !important;
    transition: border-color 0.3s;
    color:#999;
    font-size: 16px;
}

.maticad365-user-edit-form .form-field:focus {
    color:#000;
    outline: none;
}

.maticad365-user-edit-form select.form-field {
    cursor: pointer;
    background-color: #fff;
}

.maticad365-user-edit-form .form-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
}

.maticad365-user-edit-form .user-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #fff;
    color: #999;
    border: 1px solid #999;
    border-radius: 19px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: fit-content;
}

.maticad365-user-edit-form .user-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.maticad365-user-edit-form .user-save-btn img {
    display: block;
    filter: none;
}

.maticad365-user-edit-form .form-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
}

.maticad365-user-edit-form .form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.maticad365-user-edit-form .form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive adjustments for form */
@media (max-width: 768px) {
    .maticad365-user-edit-form-wrapper {
        padding: 20px;
    }
    
    .maticad365-user-edit-form .form-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .maticad365-user-edit-form .form-row label {
        text-align: left;
        padding-right: 0;
    }
    
    .maticad365-user-edit-form .form-actions {
        justify-content: flex-start;
    }
    
    .maticad365-user-edit-form .user-save-btn {
        width: auto;
    }
}

/* Hide specific fields when in create mode */
.maticad365-user-edit-form.form-mode-create .hide-on-create {
    display: none !important;
}

/* =============================================================
 * ATTACHMENTS DRAWER
 * ============================================================= */

/* Backdrop */
#tp-attach-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 99998;
    opacity: 0;
    transition: opacity .25s ease;
}
#tp-attach-backdrop.tp-backdrop-open {
    display: block;
    opacity: 1;
}

/* Panel */
#tp-attach-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(680px, 92vw);
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, .18);
}
#tp-attach-panel.tp-panel-open {
    transform: translateX(0);
}

/* Prevent body scroll when panel is open */
body.tp-panel-active {
    overflow: hidden;
}

/* Panel header */
#tp-attach-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    gap: 12px;
}
#tp-attach-title {
    font-size: 16px;
    font-weight: 300;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#tp-attach-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #6b7280;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: background .15s, color .15s;
}
#tp-attach-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Scrollable body */
#tp-attach-body {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 20px;
}

/* Loading spinner */
.tp-attach-loading {
    display: flex;
    justify-content: center;
    padding: 48px 0;
}
.tp-attach-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Empty / error message */
.tp-attach-empty {
    text-align: center;
    color: #6b7280;
    padding: 48px 0;
    font-size: 14px;
}

/* Attachment grid */
.tp-attach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

/* Card */
.tp-attach-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    transition: box-shadow .15s;
}
.tp-attach-card:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}

/* Thumbnail */
.tp-attach-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: zoom-in;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tp-attach-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s;
}
.tp-attach-thumb:hover img {
    transform: scale(1.05);
}
.tp-attach-noimg {
    font-size: 36px;
    color: #9ca3af;
}

/* 360° link fills the thumb cell */
.tp-attach-360link {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}
.tp-attach-360link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s;
    display: block;
}
.tp-attach-360link:hover img {
    transform: scale(1.05);
}

/* 360° badge — small overlay in bottom-right corner */
.tp-attach-360-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    letter-spacing: 0.5px;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.35);
}

/* Card footer */
.tp-attach-card-footer {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
}
.tp-attach-name {
    font-size: 12px;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* Action buttons */
.tp-attach-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.tp-attach-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    padding: 3px 7px;
    line-height: 1.4;
    color: #374151;
    text-decoration: none;
    transition: background .15s, color .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tp-attach-btn:hover {
    background: #f3f4f6;
}
.tp-attach-delete:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}
.tp-attach-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* =============================================================
 * ATTACHMENT LIGHTBOX
 * ============================================================= */

#tp-attach-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, .88);
    align-items: center;
    justify-content: center;
}
#tp-attach-lightbox.tp-lb-open {
    display: flex;
}
#tp-lb-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
#tp-lb-img {
    max-width: 88vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}
#tp-lb-caption {
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
    text-align: center;
    margin: 0;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#tp-lb-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: .8;
    transition: opacity .15s;
}
#tp-lb-close:hover {
    opacity: 1;
}
