﻿/* 
 * DRM Module Styles
 * Consolidated CSS for all DRM pages and controls
 * All classes prefixed with 'drm-' to avoid conflicts with other modules
 */

/* ========================================
   DRM Report Page Styles
   ======================================== */

/* Stat Cards */
.drm-stat-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 4px solid;
}

.drm-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.drm-stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.drm-stat-card.border-primary {
    border-left-color: #0d6efd !important;
}

.drm-stat-card.border-success {
    border-left-color: #198754 !important;
}

.drm-stat-card.border-info {
    border-left-color: #0dcaf0 !important;
}

.drm-stat-card.border-danger {
    border-left-color: #dc3545 !important;
}

.drm-stat-card.border-warning {
    border-left-color: #ffc107 !important;
}

/* Report Tables */
.drm-report-table {
    font-size: 0.875rem;
}

.drm-report-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}

.drm-report-table td {
    vertical-align: middle;
}

.drm-report-table .drm-table-violations {
    background-color: #fff3cd !important;
}

.drm-report-table .drm-table-high-alert {
    background-color: #f8d7da !important;
}

.drm-report-table .drm-table-medium-alert {
    background-color: #fff3cd !important;
}

/* Pagination Styles */
.drm-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.drm-pagination .page-link {
    padding: 0.25rem 0.5rem;
    margin: 0 0.125rem;
    border-radius: 0.25rem;
    min-width: 32px;
    text-align: center;
}

.drm-pagination .page-link.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.drm-pagination .pagination {
    margin-bottom: 0;
}

/* Page Size Dropdown */
.drm-page-size-dropdown {
    width: 80px !important;
}

/* ========================================
   Copyright Management Styles
   ======================================== */

/* Collection Tree Sidebar */
.drm-sidebar {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    position: sticky;
    top: 70px;
}

.drm-collection-tree {
    font-size: 0.875rem;
}

.drm-collection-tree .list-group-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.drm-collection-tree .list-group-item:hover {
    background-color: #f8f9fa;
}

.drm-collection-tree .list-group-item.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Material List */
.drm-material-item {
    border-left: 3px solid transparent;
    transition: border-left-color 0.15s ease-in-out;
}

.drm-material-item:hover {
    border-left-color: #0d6efd;
}

.drm-material-item.selected {
    background-color: #e7f1ff;
    border-left-color: #0d6efd;
}

/* License Badge Styles */
.drm-license-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.drm-license-badge.assigned {
    background-color: #198754;
    color: #fff;
}

.drm-license-badge.unassigned {
    background-color: #6c757d;
    color: #fff;
}

/* ========================================
   License Templates Styles
   ======================================== */

.drm-license-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.15s ease-in-out;
}

.drm-license-card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* Permission Icons */
.drm-permission-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
}

.drm-permission-icon.allowed {
    background-color: #d1e7dd;
    color: #198754;
}

.drm-permission-icon.denied {
    background-color: #f8d7da;
    color: #dc3545;
}

/* ========================================
   Security Alerts Styles
   ======================================== */

/* Alert Card Styles */
.drm-alert-card {
    transition: all 0.3s ease;
    border-left: 4px solid;
}

.drm-alert-card.high {
    border-left-color: #216cbb;
    background-color: #f0f7ff;
    color: #212529;
}

.drm-alert-card.medium {
    border-left-color: #28a745;
    background-color: #f0fff4;
    color: #212529;
}

.drm-alert-high {
    background-color: #f8d7da !important;
    border-left: 4px solid #dc3545;
}

.drm-alert-medium {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.drm-alert-low {
    background-color: #cff4fc !important;
    border-left: 4px solid #0dcaf0;
}

/* Badge Styles - Fully standalone, no Bootstrap dependency */
.drm-badge-warning {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    background-color: #ff6b6b !important;
    color: white !important;
}

.drm-badge-ok {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    background-color: #51cf66 !important;
    color: white !important;
}

.drm-badge-high {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    background-color: #216cbb !important;
    color: white !important;
}

.drm-badge-medium {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    background-color: #28a745 !important;
    color: white !important;
}

/* Table Violations */
.drm-table-violations {
    border-left: 4px solid #ff6b6b;
}

/* Sidebar Link Styles */
.drm-sidebar-link {
    text-decoration: none !important;
}

.drm-sidebar-link:hover {
    text-decoration: none !important;
}

.drm-sidebar-link.active {
    text-decoration: none !important;
}

/* DRM Nav Tabs */
.drm-nav-tabs .nav-link.active {
    background-color: #216cbb;
    color: white;
    border-color: #216cbb;
}

/* ========================================
   Utility Classes
   ======================================== */

.drm-text-truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drm-sticky-header {
    position: sticky;
    top: 56px;
    z-index: 100;
    background-color: #fff;
}

.drm-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ========================================
   License Templates Modal Styles
   ======================================== */

/* Modal Styles */
.drm-modal .modal-body {
    padding: 0.5rem 1rem;
}

.drm-modal .modal-dialog {
    max-width: 700px;
}

/* Form Check Styles */
.drm-form-check {
    padding-left: 0;
    margin-bottom: 0.25rem;
    min-height: 1.5rem;
    display: flex;
    align-items: flex-start;
}

.drm-license-checkbox {
    margin-right: 0.75rem;
    flex-shrink: 0;
    border: 1px solid #fff;
    background-color: #fff;
    border-radius: 0.25em;
}

.drm-license-checkbox:checked {
    background-color: #0d6efd;
    border-color: #fff;
}

.drm-license-checkbox:focus {
    border-color: #fff;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Material Checkbox */
.drm-material-checkbox {
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
    border: 1px solid #dee2e6;
    border-radius: 0.25em;
}

.drm-material-checkbox:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.drm-material-checkbox:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Limit Options */
#printLimitOptions,
#downloadLimitOptions {
    transition: all 0.3s ease;
}

#printLimitOptions .col-md-8,
#downloadLimitOptions .col-md-8 {
    padding-left: 2.5rem;
}

/* ========================================
   Copyright Management Tree Styles
   ======================================== */

.drm-tree-sidebar {
    background: #fafbfc;
    border-right: 1px solid #e1e4e8;
    overflow-y: auto;
}

.drm-tree-header {
    background: #f1f3f5;
    color: #495057;
    font-weight: 600;
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drm-tree-node {
    border-bottom: 1px solid #f0f0f0;
}

.drm-tree-node-header {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
    font-size: 13px;
}

.drm-tree-node-header:hover {
    background: #f8f9fa;
}

.drm-tree-node-header.selected {
    background: #e3f2fd;
    border-left: 3px solid #1976d2;
}

.drm-tree-node-header.active {
    background: #e7f1ff;
    border-left: 3px solid #0d6efd;
}

.drm-tree-node-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.drm-tree-toggle {
    transition: transform 0.15s;
    color: #6c757d;
    flex-shrink: 0;
    margin-right: 5px;
}

.drm-tree-toggle.expanded {
    transform: rotate(90deg);
}

.drm-tree-icon {
    color: #6c757d;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.drm-tree-label {
    font-size: 0.875rem;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drm-tree-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.drm-tree-children {
    display: none;
    padding-left: 15px;
    background: #fff;
}

.drm-tree-children.expanded {
    display: block;
}

.drm-tree-child-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
    font-size: 12px;
}

.drm-tree-child-item:hover {
    background: #f8f9fa;
}

.drm-tree-child-item.active {
    background: #fff8e6;
}

.drm-tree-badge {
    font-size: 10px;
    min-width: 30px;
    font-weight: 500;
}

.drm-license-breakdown-item {
    padding: 6px 12px;
    cursor: pointer;
    border-left: 2px solid #e9ecef;
    font-size: 11px;
    margin-left: 10px;
}

.drm-license-breakdown-item:hover {
    background: #f8f9fa;
    border-left-color: #6c757d;
}

.drm-tree-summary-node {
    background: #fff;
}

.drm-tree-warning-node {
    background: #fffbf0;
}

/* Resizable sidebar styles */
.drm-resizable-layout {
    display: flex;
    min-height: calc(100vh - 200px);
}

.drm-sidebar-container {
    min-width: 200px;
    max-width: 500px;
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 75px;
    align-self: flex-start;
    border-right: 1px solid #e1e4e8;
    max-height: calc(100vh - 115px);
    display: flex;
    flex-direction: column;
    transition: width 0.2s, min-width 0.2s, opacity 0.2s;
}

.drm-sidebar-container.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    border-right: none;
    opacity: 0;
}

.drm-sidebar-container>.drm-tree-header {
    flex-shrink: 0;
}

.drm-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
}

.drm-resize-handle:hover,
.drm-resize-handle.dragging {
    background: #0d6efd;
}

.drm-content-container {
    flex: 1;
    min-width: 0;
}

/* Sticky table header */
table.drm-sticky-header thead {
    position: sticky;
    top: 70px;
    z-index: 100;
}

/* Sidebar toggle button */
.drm-sidebar-toggle {
    position: absolute;
    left: 0;
    top: 10px;
    background: #0d6efd;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    z-index: 100;
    transition: left 0.2s;
}

.drm-sidebar-toggle:hover {
    background: #0b5ed7;
}

.drm-tree-header .drm-toggle-btn {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background 0.15s;
    color: #0d6efd;
    font-size: 14px;
}

.drm-tree-header .drm-toggle-btn:hover {
    background: rgba(13, 110, 253, 0.1);
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {

    .drm-sidebar,
    .drm-tree-sidebar {
        max-height: none;
        position: relative;
        top: 0;
    }

    .drm-text-truncate {
        max-width: 150px;
    }
}

/* ========================================
   Sticky Bulk Actions
   ======================================== */
.sticky-bulk-actions {
    position: -webkit-sticky;
    position: sticky;
    top: 80px;
    z-index: 1020;
    background-color: #fff;
    padding-top: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Ensure table header sticks BELOW the bulk actions */
/* Adjust top value based on the actual height of bulk actions bar approx 60-70px */
.sticky-header th.sticky-top {
    top: 155px !important;
    z-index: 1010;
}