/* Assets Page Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    height: 60px;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 100;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
}

.header-user {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #00f2ff, #0066ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #ffffff;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: rgba(20, 20, 30, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.user-dropdown.hidden {
    display: none;
}

.dropdown-item {
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Header Navigation */
.header-nav {
    display: flex;
    gap: 24px;
    margin-right: 24px;
}

.nav-link {
    color: rgba(224, 224, 224, 0.6);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover {
    color: #e0e0e0;
}

.nav-link.active {
    color: #00f2ff;
    border-bottom-color: #00f2ff;
}

/* Main Content */
.main {
    padding: 40px 32px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 24px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.table-container {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-top: 24px;
    overflow-x: auto;
}

#assets-table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

#assets-table thead th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    text-align: left;
}

#assets-table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.9rem;
}

#assets-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

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

.asset-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}

.asset-thumbnail-placeholder {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.btn-action.edit {
    color: var(--accent);
}

.btn-action.delete {
    color: #ff4444;
}

.btn-action.delete:hover {
    background: rgba(255, 68, 68, 0.1);
    border-color: #ff4444;
}

/* DataTables Customization */
.dataTables_wrapper {
    color: var(--text-main);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-main);
    margin-top: 16px;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 4px;
    margin: 0 8px;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main) !important;
    padding: 8px 12px;
    margin: 0 4px;
    border-radius: 4px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent);
    color: #000 !important;
    border-color: var(--accent);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: 0;
    z-index: 9999;
    display: none;
}

.modal:not(.hidden) {
    display: flex;
    pointer-events: auto;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 9999;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
    z-index: 10000;
    overflow: hidden;
    animation: modalIn 0.2s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-label .required {
    color: #ff4444;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #00f2ff;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 242, 255, 0.1);
}

.form-input::placeholder {
    color: var(--text-dim);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #00f2ff;
    color: #000;
    font-weight: 600;
}

.btn-primary:hover {
    background: #00d9e6;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.btn-danger {
    background: #ff4444;
    color: #fff;
}

.btn-danger:hover {
    background: #cc3333;
}

.text-warning {
    color: #ffaa00;
    margin-top: 12px;
    font-size: 0.875rem;
}

.changes-preview {
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
}

.changes-preview .change-item {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.changes-preview .change-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.changes-preview .change-label {
    color: var(--text-dim);
    font-weight: 500;
}

.changes-preview .change-value {
    color: var(--text-main);
    margin-top: 4px;
}

.changes-preview .change-old {
    color: #ff4444;
    text-decoration: line-through;
    margin-right: 8px;
}

.changes-preview .change-new {
    color: var(--accent);
}

/* Edit Modal Preview */
.edit-modal-dialog {
    max-width: 900px;
}

.edit-modal-body {
    display: flex;
    gap: 24px;
    padding: 24px;
}

.edit-preview-panel {
    flex: 1;
    min-width: 0;
}

.edit-preview-viewport {
    width: 100%;
    height: 400px;
    background: #2a2a3e;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.edit-preview-viewport canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.edit-preview-info {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    text-align: center;
}

.edit-thumbnail-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.thumbnail-display-container {
    width: 100%;
    height: 120px;
    margin-bottom: 12px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background: #00ff88;
    color: #000;
}

.btn-success:hover {
    background: #00e677;
}

.edit-form-panel {
    flex: 1;
    min-width: 0;
}

.version-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 6px;
    margin-bottom: 20px;
}

.version-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
}

.version-number {
    color: #00f2ff;
    font-size: 1rem;
    font-weight: 600;
}

/* Upload Version Modal */
#upload-version-modal .edit-preview-viewport {
    position: relative;
    transition: all 0.3s ease;
}

#upload-version-modal .edit-preview-viewport.drag-over {
    border: 3px dashed var(--accent);
    background: rgba(0, 242, 255, 0.05);
}

#upload-version-modal .edit-preview-viewport.drag-over::after {
    content: 'Drop file to preview';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 600;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

/* Asset Detail Modal */
.asset-detail-dialog {
    max-width: 1200px;
}

.asset-detail-body {
    display: flex;
    gap: 24px;
    padding: 24px;
}

.detail-preview-panel {
    flex: 2;
    min-width: 0;
}

.detail-preview-viewport {
    width: 100%;
    height: 500px;
    background: #2a2a3e;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.detail-preview-viewport canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.detail-versions-panel {
    flex: 1;
    min-width: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.versions-title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.versions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.version-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.version-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 242, 255, 0.5);
}

.version-item.active {
    background: rgba(0, 242, 255, 0.15);
    border-color: #00f2ff;
}

.version-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.version-number {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.9rem;
}

.version-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: rgba(0, 242, 255, 0.2);
    color: #00f2ff;
    border-radius: 4px;
    font-weight: 500;
}

.version-comment {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin-bottom: 4px;
    line-height: 1.4;
}

.version-date {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .edit-modal-body,
    .asset-detail-body {
        flex-direction: column;
    }
    
    .edit-preview-viewport,
    .detail-preview-viewport {
        height: 300px;
    }
    
    .detail-versions-panel {
        max-height: none;
    }
}
