/* Projects Page - Rewritten from scratch */

* {
    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-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;
}

.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);
}

/* 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;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.tab-switcher {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    background: rgba(0, 242, 255, 0.2);
    border: 1px solid rgba(0, 242, 255, 0.3);
}

.content-section {
    /* Content sections are shown/hidden via JavaScript */
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.search-box {
    width: 100%;
    max-width: 320px;
    padding: 12px 16px;
    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;
    outline: none;
    transition: all 0.2s;
}

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

.search-box::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00f2ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

/* Empty State */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 16px;
}

.empty p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
}

/* Projects Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.hidden {
    display: none !important;
}

/* Project Card */
.card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    border-color: #00f2ff;
    box-shadow: 0 12px 32px rgba(0, 242, 255, 0.2);
}

.card-thumbnail {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, rgba(0, 100, 255, 0.1), rgba(0, 242, 255, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-icon {
    width: 48px;
    height: 48px;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
}

.card:hover .card-icon {
    color: #00f2ff;
    transform: scale(1.1);
}

.card-footer {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.card-version {
    padding: 4px 8px;
    background: rgba(0, 242, 255, 0.15);
    color: #00f2ff;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.card:hover .card-actions {
    opacity: 1;
}

.card-action {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.card-action:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.card-action.delete:hover {
    background: rgba(255, 50, 50, 0.8);
    border-color: rgba(255, 50, 50, 0.5);
}

.card-action svg {
    width: 14px;
    height: 14px;
    color: #ffffff;
}

/* New Project Card */
.card-new {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.15);
}

.card-new:hover {
    border-style: solid;
    background: rgba(0, 242, 255, 0.05);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none; /* Override global styles */
    margin: 0;
    padding: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: 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: 480px;
    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;
    animation: modalIn 0.2s ease-out;
}

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

.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;
}

.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;
}

.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;
}

/* Form Elements */
.form-label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
}

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

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

.text-warning {
    color: #ff6b6b !important;
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, #00f2ff, #0066ff);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(0, 242, 255, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(255, 50, 50, 0.3);
}

/* Materials Table */
.table-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px;
    overflow-x: auto;
}

/* DataTables Customization */
.dataTables_wrapper {
    color: #e0e0e0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 16px;
}

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

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter 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);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0 !important;
    padding: 8px 12px;
    margin: 0 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00f2ff;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #00f2ff, #0066ff);
    color: #ffffff !important;
    border-color: transparent;
}

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

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

.dataTables_wrapper thead th {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.dataTables_wrapper tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

.material-name-link {
    color: var(--accent, #00f2ff);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.material-name-link:hover {
    color: var(--accent-light, #33f5ff);
    text-decoration: underline;
}

.dataTables_wrapper tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.dataTables_wrapper tbody tr:last-child td {
    border-bottom: none;
}

/* Button Icons */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.7);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

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

.edit-thumbnail-image {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

.edit-thumbnail-placeholder {
    padding: 24px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
    text-align: center;
}

/* Edit Modal Dialog */
.edit-modal-dialog {
    max-width: 800px;
    width: 90%;
}

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

.edit-form-panel {
    flex: 1;
}

.edit-preview-panel {
    width: 300px;
    flex-shrink: 0;
}

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

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

.required {
    color: #ff4444;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }
    
    .main {
        padding: 24px 16px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .edit-modal-body {
        flex-direction: column;
    }
    
    .edit-preview-panel {
        width: 100%;
    }
    
    .tab-switcher {
        width: 100%;
        justify-content: stretch;
    }
    
    .tab-btn {
        flex: 1;
    }
}
