/**
 * Project List Table Styles
 * Modern, sortable, filterable list view
 */

/* Container and Layout */
.project-list-container {
    padding: 20px;
    background: var(--bg-secondary, #f8f9fa);
    min-height: 400px;
}

.project-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color, #dee2e6);
}

.project-list-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary, #333);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Filter Bar */
.project-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--text-secondary, #6c757d);
    white-space: nowrap;
}

.filter-search {
    flex: 1;
    min-width: 200px;
}

.filter-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
    font-size: 0.875rem;
}

.filter-search input:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.filter-select select {
    padding: 8px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.filter-select select:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
}

/* Stats Bar */
.project-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary, #6c757d);
}

.stat-item {
    display: flex;
    gap: 5px;
}

.stat-item strong {
    color: var(--text-primary, #333);
}

/* Table Styles */
.project-list-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.project-list-table table {
    width: 100%;
    border-collapse: collapse;
}

.project-list-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.project-list-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    user-select: none;
}

.project-list-table th.sortable {
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
}

.project-list-table th.sortable:hover {
    background-color: rgba(255,255,255,0.1);
}

.project-list-table th.sortable i {
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.75rem;
}

.project-list-table th.sortable.sort-asc i::before {
    content: "\f0de"; /* fa-sort-up */
    opacity: 1;
}

.project-list-table th.sortable.sort-desc i::before {
    content: "\f0dd"; /* fa-sort-down */
    opacity: 1;
}

/* Table Body */
.project-list-table tbody tr {
    transition: background-color 0.2s;
}

.project-list-table tbody tr:hover {
    background-color: var(--hover-bg, #f8f9fa);
}

.project-list-table td {
    padding: 12px 15px;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.7);
}

/* Fix layout of status/actions cells in list view (do NOT use card flex styles) */
.project-list-table td.project-status,
.project-list-table td.project-actions {
    display: table-cell;
    vertical-align: middle;
}

/* Project Name Cell */
.project-name-cell {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.access-icon {
    font-size: 1rem;
    margin-top: 2px;
}

.name-details {
    flex: 1;
    min-width: 0;
}

.name-details strong {
    display: block;
    color: var(--text-primary, #333);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.name-details small {
    display: block;
    color: var(--text-secondary, #6c757d);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-completed {
    background: #cce5ff;
    color: #004085;
}

.status-paused {
    background: #fff3cd;
    color: #856404;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-default {
    background: #e2e3e5;
    color: #383d41;
}

/* Archived projects */
.status-archived {
    background: #e5e7eb;
    color: #374151;
}

[data-theme="dark"] .status-archived,
body[data-theme="dark"] .status-archived {
    background: #374151;
    color: #e5e7eb;
}

/* Language Flags */
.language-flags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.language-flag {
    font-size: 1.2rem;
    cursor: help;
}

/* Row Count */
.row-count {
    font-weight: 500;
    color: var(--text-primary, #333);
}

/* Date */
.date {
    color: var(--text-secondary, #6c757d);
    font-size: 0.8125rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 4px;
}

.btn-icon {
    padding: 6px 8px;
    background: transparent;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary, #6c757d);
}

.btn-icon:hover {
    background: var(--primary-color, #007bff);
    border-color: var(--primary-color, #007bff);
    color: white;
}

.btn-icon.danger:hover {
    background: #dc3545;
    border-color: #dc3545;
}

.btn-icon i {
    font-size: 0.875rem;
}

/* No Projects Message */
.no-projects {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #6c757d);
}

.no-projects i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 15px;
}

.no-projects p {
    margin: 0;
    font-size: 1.125rem;
}

/* Error Message */
.project-list-container .error-message {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.project-list-container .error-message i {
    font-size: 2.5rem;
    color: #dc3545;
    margin-bottom: 15px;
}

.project-list-container .error-message p {
    margin: 0 0 20px;
    color: var(--text-primary, #333);
}

.project-list-container .error-message button {
    padding: 8px 16px;
    background: var(--primary-color, #007bff);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.project-list-container .error-message button:hover {
    background: var(--primary-hover, #0056b3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .project-list-table {
        overflow-x: auto;
    }

    .project-list-table table {
        min-width: 900px;
    }
}

@media (max-width: 768px) {
    .project-filters {
        flex-wrap: wrap;
    }

    .filter-search {
        width: 100%;
        min-width: unset;
    }

    .project-list-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .project-stats {
        flex-wrap: wrap;
    }

    /* Switch to card view on mobile */
    .project-list-table table {
        display: block;
    }

    .project-list-table thead {
        display: none;
    }

    .project-list-table tbody {
        display: block;
    }

    .project-list-table tr {
        display: block;
        margin-bottom: 15px;
        padding: 15px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .project-list-table td {
        display: block;
        padding: 5px 0;
        text-align: left;
    }

    .project-list-table td::before {
        content: attr(data-label);
        font-weight: 500;
        display: inline-block;
        width: 100px;
        color: var(--text-secondary, #6c757d);
    }

    .action-buttons {
        margin-top: 10px;
        justify-content: flex-start;
    }
}

/* Dark Mode Support - Both automatic and manual */
@media (prefers-color-scheme: dark),
[data-theme="dark"] {
    .project-list-container {
        background: #1a1a1a;
    }

    .project-list-header {
        border-bottom-color: #3d3d3d;
    }

    .project-list-header h2 {
        color: #e0e0e0;
    }

    .project-filters {
        background: #2d2d2d;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }

    .project-list-table {
        background: #2d2d2d;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }

    .project-list-table thead {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }

    .project-list-table td {
        border-bottom-color: #3d3d3d;
    }

    .project-list-table tbody tr:hover {
        background: #3a3a3a;
    }

    .filter-search input,
    .filter-select select {
        background: #1a1a1a;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }

    .filter-search input:focus,
    .filter-select select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 2px rgba(102,126,234,0.2);
    }

    .filter-group label {
        color: #a0a0a0;
    }

    .name-details strong {
        color: #e0e0e0;
    }

    .name-details small {
        color: #8a8a8a;
    }

    .project-client,
    .project-rows .row-count {
        color: #d0d0d0;
    }

    .date {
        color: #8a8a8a;
    }

    .btn-icon {
        background: #1a1a1a;
        border-color: #4d4d4d;
        color: #a0a0a0;
    }

    .btn-icon:hover {
        background: #667eea;
        border-color: #667eea;
        color: white;
    }

    .btn-icon.danger:hover {
        background: #e53e3e;
        border-color: #e53e3e;
    }

    .btn-primary {
        background: #667eea;
        border: 1px solid #667eea;
        color: white;
    }

    .btn-primary:hover {
        background: #5a67d8;
        border-color: #5a67d8;
    }

    .btn-success {
        background: #48bb78;
        border: 1px solid #48bb78;
        color: white;
    }

    .btn-success:hover {
        background: #38a169;
        border-color: #38a169;
    }

    .project-stats {
        color: #a0a0a0;
    }

    .project-stats strong {
        color: #e0e0e0;
    }

    .no-projects {
        color: #8a8a8a;
    }

    .no-projects i {
        opacity: 0.2;
    }

    .error-message {
        background: #2d2d2d;
    }

    .error-message p {
        color: #e0e0e0;
    }

    /* Status badges in dark mode */
    .status-active {
        background: rgba(72, 187, 120, 0.2);
        color: #68d391;
    }

    .status-completed {
        background: rgba(66, 153, 225, 0.2);
        color: #63b3ed;
    }

    .status-paused {
        background: rgba(236, 201, 75, 0.2);
        color: #f6e05e;
    }

    .status-cancelled {
        background: rgba(245, 101, 101, 0.2);
        color: #fc8181;
    }

    .status-default {
        background: rgba(160, 174, 192, 0.2);
        color: #a0aec0;
    }
}

/* Explicit dark mode when body has data-theme="dark" */
body[data-theme="dark"] .project-list-container {
    background: #1a1a1a;
}

body[data-theme="dark"] .project-filters,
body[data-theme="dark"] .project-list-table {
    background: #2d2d2d;
}

body[data-theme="dark"] .project-list-table thead {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

body[data-theme="dark"] .project-list-table tbody tr:hover {
    background: #3a3a3a;
}

/* Dark mode for filter inputs and selects */
body[data-theme="dark"] .filter-search input,
body[data-theme="dark"] #project-search {
    background: #1a1a1a;
    border-color: #4d4d4d;
    color: #e0e0e0;
}

body[data-theme="dark"] .filter-select select,
body[data-theme="dark"] #project-status-filter,
body[data-theme="dark"] #project-owner-filter {
    background: #1a1a1a;
    border-color: #4d4d4d;
    color: #e0e0e0;
}

body[data-theme="dark"] .filter-search input:focus,
body[data-theme="dark"] .filter-select select:focus,
body[data-theme="dark"] #project-search:focus,
body[data-theme="dark"] #project-status-filter:focus,
body[data-theme="dark"] #project-owner-filter:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.2);
}

body[data-theme="dark"] .filter-group label {
    color: #a0a0a0;
}

/* Dark mode text colors for specific table cells */
body[data-theme="dark"] .project-client,
body[data-theme="dark"] .project-owner,
body[data-theme="dark"] .project-languages {
    color: #e2e8f0 !important;
}

/* File list styles */
.empty-project {
    opacity: 0.7;
}

.has-files .project-name {
    font-weight: 500;
}

.expand-files-btn {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    color: #2196f3;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.expand-files-btn:hover {
    background: #2196f3;
    color: white;
}

.expand-files-btn i {
    transition: transform 0.2s;
}

.no-files-badge {
    display: inline-block;
    background: #ffe0e0;
    color: #d32f2f;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 4px;
}

.file-list-row {
    background: #f8f9fa;
}

.file-list-cell {
    padding: 0 !important;
}

.file-list-container {
    padding: 15px 20px;
    background: white;
    margin: 10px;
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    max-height: 400px;
    overflow-y: auto;
}

.file-list-container h5 {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 14px;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-bottom: 1px solid #eee;
    min-height: 32px;
}

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

.file-icon {
    font-size: 18px;
}

.file-name {
    flex: 1;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    color: #333;
    min-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-language {
    background: #2196f3;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    display: inline-block;
    margin-right: 4px;
}

.file-language.lang-badge + .file-language.lang-badge {
    margin-left: 2px;
}

.audio-icon {
    font-size: 16px;
    color: #4caf50;
}

.standalone-badge {
    font-size: 16px;
    color: #ff9800;
}

.file-date {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    margin-left: auto;
}

/* Dark mode file list */
[data-theme="dark"] .file-list-row,
body[data-theme="dark"] .file-list-row {
    background: #1e1e1e;
}

[data-theme="dark"] .file-list-container,
body[data-theme="dark"] .file-list-container {
    background: #2a2a2a;
    color: #e0e0e0;
}

[data-theme="dark"] .file-list-container h5,
body[data-theme="dark"] .file-list-container h5 {
    color: #bbb;
}

[data-theme="dark"] .file-item,
body[data-theme="dark"] .file-item {
    border-bottom-color: #444;
}

[data-theme="dark"] .file-name,
body[data-theme="dark"] .file-name {
    color: #e0e0e0;
}

[data-theme="dark"] .expand-files-btn,
body[data-theme="dark"] .expand-files-btn {
    background: #1e3a5f;
    border-color: #2196f3;
}

[data-theme="dark"] .expand-files-btn:hover,
body[data-theme="dark"] .expand-files-btn:hover {
    background: #2196f3;
}

[data-theme="dark"] .no-files-badge,
body[data-theme="dark"] .no-files-badge {
    background: #3e2723;
    color: #ff8a80;
}

/* Clickable file items */
.file-item.clickable {
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.file-item.clickable:hover {
    background-color: rgba(102, 126, 234, 0.1);
    transform: translateX(5px);
}

[data-theme="dark"] .file-item.clickable:hover,
body[data-theme="dark"] .file-item.clickable:hover {
    background-color: rgba(33, 150, 243, 0.15);
}

/* File item with delete button layout */
.file-item-content {
    display: inline-flex;
    align-items: center;
    flex: 1;
    gap: 10px;
}

.file-item .delete-file-btn {
    margin-left: auto;
    padding: 2px 8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.file-item .delete-file-btn:hover {
    opacity: 1;
    background: #c82333;
}

.file-item .delete-file-btn i {
    font-size: 12px;
}

/* Dark mode delete button */
[data-theme="dark"] .file-item .delete-file-btn,
body[data-theme="dark"] .file-item .delete-file-btn {
    background: #d32f2f;
}

[data-theme="dark"] .file-item .delete-file-btn:hover,
body[data-theme="dark"] .file-item .delete-file-btn:hover {
    background: #f44336;
}

/* Project overview layout */
.project-overview {
    padding: 16px 18px;
}

.project-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.project-overview-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.project-overview-breadcrumb {
    font-size: 13px;
    color: var(--text-secondary);
}

.project-overview-breadcrumb .breadcrumb-item {
    font-weight: 500;
}

.project-overview-breadcrumb .breadcrumb-current {
    color: var(--primary-color);
}

.project-overview-breadcrumb .breadcrumb-meta {
    margin-left: 8px;
    opacity: 0.85;
}

.project-overview-content {
    margin-top: 8px;
}

.project-overview-loading {
    font-size: 14px;
    color: var(--text-secondary);
}

.project-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 12px;
}

.project-overview-grid-bottom {
    margin-top: 20px;
}

.overview-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    border: 1px solid var(--border-color);
}

.overview-section h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.overview-summary-grid > div {
    font-size: 13px;
    margin-bottom: 4px;
}

.project-overview-description {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.overview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.overview-table th,
.overview-table td {
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    text-align: left;
}

.overview-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 12px;
}
