/* Base Styles - Common to all themes */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    transition: background 0.3s ease;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Glassmorphic Container */
.glass-container {
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 40px;
    transition: all 0.3s ease;
    position: relative;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
}

/* Buttons */
.btn {
    display: inline-block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    margin-top: 10px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Sections */
.section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid;
}

.section:last-child {
    border-bottom: none;
}

.section h2 {
    font-size: 18px;
    margin-bottom: 15px;
}

/* Info Rows */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
}

.info-label {
    font-weight: 500;
}

.info-value {
    font-weight: 600;
}

/* Links */
.nav-link {
    display: inline-block;
    margin-top: 20px;
    text-decoration: none;
    font-weight: 500;
}

.nav-link:hover {
    text-decoration: underline;
}

/* Top Navigation Links (outside container) */
.top-navigation {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.top-navigation .nav-link {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    margin-top: 0;
    border: 1px solid;
}

.links {
    text-align: center;
    margin-top: 20px;
}

.links a {
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.links a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    margin-right: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
}

.checkbox-group label {
    font-size: 14px;
    cursor: pointer;
}

/* Help Text */
.help-text {
    font-size: 12px;
    margin-top: 5px;
}

/* Library & Dashboard */
.storage-banner {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.storage-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.storage-label {
    font-weight: 500;
}

.storage-value {
    font-weight: 600;
}

.storage-help-text {
    font-size: 12px;
    margin-top: 8px;
    opacity: 0.7;
}

.progress-warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Library Filters */
.library-filters {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.filters-form .filter-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-input, .filter-select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid;
    font-size: 14px;
    transition: all 0.3s ease;
    height: 42px;
    box-sizing: border-box;
}

.filter-input:focus, .filter-select:focus {
    outline: none;
}

.filter-row .btn {
    width: auto;
    margin-top: 0 !important;
    padding: 10px 20px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-actions .btn {
    min-width: 140px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0 !important;
    width: auto;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    flex: 1;
}

.filter-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid;
    position: relative;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.filter-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: inherit;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    margin-bottom: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bulk-actions-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.bulk-selection-count {
    font-size: 15px;
    font-weight: 600;
    color: white;
}

.bulk-actions-buttons {
    display: flex;
    gap: 10px;
}

.bulk-actions-buttons .btn {
    min-width: 140px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0 !important;
    width: auto;
}

/* Documents List */
.documents-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.document-card {
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    gap: 20px;
}

.document-card:hover {
    transform: translateX(4px);
}

.document-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.document-select-wrapper {
    display: flex;
    align-items: center;
}

.document-select-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    transition: all 0.2s ease;
}

.document-select-checkbox:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

.document-select-checkbox:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.document-select-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.favorite-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.favorite-btn:hover, .favorite-btn.active {
    opacity: 1;
    transform: scale(1.2);
}

.document-mode-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.badge-srt {
    border: 1px solid #60a5fa;
    color: #60a5fa;
}

.badge-document {
    border: 1px solid #34d399;
    color: #34d399;
}

.badge-smart_doc {
    border: 1px solid #a78bfa;
    color: #a78bfa;
}

.document-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 200px;
}

.document-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.document-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    opacity: 0.8;
    flex-shrink: 0;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.document-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    max-width: 200px;
}

.tag-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

/* Tags Edit Modal */
.tags-edit-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.1);
}

.tag-edit-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tag-remove-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.tag-remove-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    color: #ff4444;
}

.document-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.document-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0 !important;
}

/* Custom Select */
.custom-select {
    position: relative;
    min-width: 220px;
}

.select-trigger {
    padding: 10px 16px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.select-trigger:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
}

.custom-select.open .select-trigger {
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

.select-arrow {
    width: 16px;
    height: 16px;
    stroke: white;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.3s ease;
}

.custom-select.open .select-arrow {
    transform: rotate(180deg);
}

.select-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.custom-select.open .select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.select-option {
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.select-option:last-child {
    border-bottom: none;
}

.select-option:hover {
    background: rgba(255,255,255,0.2);
    padding-left: 20px;
}

.select-option.active {
    background: white;
    color: #667eea;
    font-weight: 600;
}

.select-options::-webkit-scrollbar {
    width: 8px;
}

.select-options::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.select-options::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.select-options::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.pagination-btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pagination-info {
    font-size: 14px;
    font-weight: 500;
}

/* Library Actions */
.library-actions {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Modal - Body lock when modal is open */
body.modal-active {
    overflow: hidden;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    /* Style glassmorphique blanc semi-transparent */
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    color: #ffffff;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.modal-close:hover {
    opacity: 1;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    opacity: 0.7;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card, .chart-card-full {
    padding: 25px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-card h3, .chart-card-full h3 {
    font-size: 16px;
    margin-bottom: 20px;
}

/* Jobs History */
.jobs-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 12px;
}

.jobs-stats .stat-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.jobs-stats .stat-label {
    font-size: 14px;
    opacity: 0.7;
}

.jobs-stats .stat-value {
    font-size: 20px;
    font-weight: 700;
}

.jobs-stats .stat-value.success {
    color: #10b981;
}

.jobs-stats .stat-value.error {
    color: #ef4444;
}

.jobs-filters {
    margin-bottom: 30px;
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.job-item {
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.job-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.job-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.job-status.status-completed {
    border: 1px solid #10b981;
    color: #10b981;
}

.job-status.status-error {
    border: 1px solid #ef4444;
    color: #ef4444;
}

.job-status.status-processing {
    border: 1px solid #3b82f6;
    color: #3b82f6;
}

.job-status.status-pending {
    border: 1px solid #9ca3af;
    color: #9ca3af;
}

.job-details {
    font-size: 14px;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    opacity: 0.8;
}

.job-error {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ffffff;
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .filters-form .filter-row {
        grid-template-columns: 1fr;
    }

    .documents-grid {
        grid-template-columns: 1fr;
    }

    .top-navigation {
        flex-direction: column;
        gap: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .jobs-stats {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .glass-container {
        padding: 30px 20px;
    }
}
