/* ============================================
   Components - mAuthor Project Auto Translator
   ============================================ */

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    margin-right: 48px;
}

.navbar-brand .logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.navbar-nav {
    display: flex;
    gap: 8px;
    list-style: none;
    flex: 1;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.user-menu:hover {
    background: var(--bg-card);
}

.user-menu.active {
    background: var(--bg-card);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 0.75rem;
}

.user-menu {
    position: relative;
    z-index: 3000; /* Higher than modal (2000) to ensure logout is always accessible */
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 3001; /* Higher than modal (2000) to ensure logout is always accessible */
    padding: 8px 0;
}

.user-menu.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
}

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-mini {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.stat-mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.stat-mini-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.stat-mini-label {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.queue-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 12px;
    margin-bottom: 8px;
}

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

.queue-item-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.queue-item-status {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 5px;
    background: var(--accent-info);
    color: white;
}

.progress-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 5px;
    transition: width 0.3s;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--glow-primary);
}

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

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
}

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

.btn-secondary:disabled .fa-spinner {
    animation: spin 1s linear infinite;
    color: var(--accent-warning);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.7rem;
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== FORM INPUTS ===== */
.form-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: 'Roboto', sans-serif;
    transition: all 0.2s;
    padding: 10px;
    font-size: 0.875rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:hover {
    border-color: var(--accent-primary);
}

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

/* Select dropdown styling */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-secondary);
}

.upload-area:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.upload-area.dragover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    box-shadow: var(--glow-primary);
}

.upload-icon {
    font-size: 2rem;
    color: var(--accent-primary);
    margin: 0;
    flex-shrink: 0;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
}

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

.table thead {
    background: var(--bg-secondary);
}

.table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.table th.sortable:hover {
    background: var(--bg-hover);
}

.table th.sortable .sort-icon {
    margin-left: 8px;
    font-size: 0.7rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.table th.sortable:hover .sort-icon {
    opacity: 1;
}

.table th.sortable.sort-asc .sort-icon::before {
    content: '\f0de';
    opacity: 1;
    color: var(--accent-primary);
}

.table th.sortable.sort-desc .sort-icon::before {
    content: '\f0dd';
    opacity: 1;
    color: var(--accent-primary);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table tbody tr {
    transition: all 0.2s;
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 500;
}

.status-ready {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
}

.status-progress {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-info);
}

.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-error);
}

/* ===== MODAL DIALOGS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ===== LOGIN FORM ===== */
.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 32px;
    max-width: 450px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.login-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: 'Roboto', sans-serif;
    margin-bottom: 16px;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.login-input::placeholder {
    color: var(--text-muted);
}

/* ===== UTILITY CLASSES ===== */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s;
        z-index: 999;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }
}

