/* NFOGuard Web Interface Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark-color);
    background-color: #f5f5f5;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

/* Header Logo and Text Layout */
.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.header-logo .logo {
    height: 60px;
    width: auto;
    /* Clean display for new logo */
    object-fit: contain;
}

.header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 0.25rem;
}

.header-content h1 i {
    margin-right: 0.5rem;
}

.header-content p {
    opacity: 0.9;
    font-size: 1rem;
    margin: 0;
}

/* Responsive logo layout */
@media (max-width: 768px) {
    .header-logo {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-text {
        align-items: center;
        text-align: center;
    }
    
    .header-logo .logo {
        height: 45px;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
}

/* Authentication Status */
.auth-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    font-size: 0.9rem;
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.9;
}

.auth-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.auth-logout:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.nav-tabs {
    max-width: 1200px;
    margin: 1rem auto 0;
    padding: 0 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-tab {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-tab.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--dark-color);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.movies { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-icon.tv { background: linear-gradient(135deg, #f093fb, #f5576c); }
.stat-icon.missing { background: linear-gradient(135deg, #ffecd2, #fcb69f); }
.stat-icon.activity { background: linear-gradient(135deg, #a8edea, #fed6e3); }

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-info p {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-info small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.chart-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-color);
    border-radius: 0.25rem;
    color: var(--text-muted);
}

/* Content Header */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.content-header h2 {
    color: var(--dark-color);
    font-weight: 600;
}

.content-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
}

.search-box input {
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 0.9rem;
    width: 250px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1rem;
}

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

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    position: sticky;
    top: 0;
}

.data-table tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.data-table .loading {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
}

/* Status badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-secondary {
    background-color: #e9ecef;
    color: #495057;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pagination .btn {
    padding: 0.5rem 0.75rem;
}

.pagination .page-info {
    margin: 0 1rem;
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

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

.modal-content {
    background: white;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--dark-color);
}

.modal-body {
    padding: 1.5rem;
}

/* Higher z-index for edit modals that appear on top of other modals */
#edit-modal, #smart-fix-modal {
    z-index: 1100 !important;
}

/* Reports */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-card h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.summary-card p {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.summary-card span {
    font-weight: 700;
    color: var(--primary-color);
}

.report-section {
    margin-bottom: 2rem;
}

.report-section h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* Tools */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.tool-card h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.tool-card p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.stats-display {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    min-height: 100px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}

.toast {
    background: white;
    border-radius: 0.25rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    min-width: 300px;
    border-left: 4px solid var(--primary-color);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Smart Fix Modal */
.smart-fix-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.option-card {
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.option-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.option-label {
    display: block;
    padding: 1rem;
    cursor: pointer;
    margin: 0;
}

.option-label input[type="radio"] {
    margin-right: 0.75rem;
    margin-top: 0.1rem;
    width: auto;
}

.option-content h4 {
    margin: 0 0 0.5rem 0;
    color: var(--dark-color);
    font-size: 1rem;
}

.option-content p {
    margin: 0 0 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.option-content small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.manual-date-input {
    width: 100% !important;
    margin-top: 0.5rem !important;
}

.option-card input[type="radio"]:checked + .option-content {
    color: var(--primary-color);
}

.option-card:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

/* Additional badge styles */
.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Enhanced Edit Modal Date Options */
.date-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.date-option-card {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.date-option-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.date-option-label {
    display: block;
    padding: 0.75rem;
    cursor: pointer;
    margin: 0;
}

.date-option-label input[type="radio"] {
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    width: auto;
}

.date-option-content h4 {
    margin: 0 0 0.25rem 0;
    color: var(--dark-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.date-option-content p {
    margin: 0 0 0.25rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.date-option-content small {
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 500;
}

.date-option-card input[type="radio"]:checked + .date-option-content h4 {
    color: var(--primary-color);
}

.date-option-card:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.03);
}

/* Responsive */
@media (max-width: 768px) {
    .content-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .content-controls {
        justify-content: center;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .nav-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

/* Database Admin Tools Styles */
.query-results {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
}

.query-info {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

.query-info.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.query-info.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: white;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.results-table th {
    background-color: var(--dark-color);
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
}

.results-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.results-table tr:hover {
    background-color: #f8f9fa;
}

.results-table td em {
    color: var(--text-muted);
    font-style: italic;
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
}

.admin-tools {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-tools .btn {
    text-align: left;
    justify-content: flex-start;
}

.admin-results {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
}

.scan-summary,
.fix-summary {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.scan-summary {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
}

.fix-summary.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.fix-errors {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

.fix-errors ul {
    margin: 0.5rem 0 0 1rem;
}

.missing-episodes {
    margin-top: 1rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

.loading::before {
    content: "⏳ ";
}

.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

/* Make text areas more distinctive */
textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    resize: vertical;
}

/* Button variations for admin tools */
.btn.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

/* Responsive adjustments for admin tools */
@media (max-width: 768px) {
    .table-container {
        max-height: 300px;
    }
    
    .results-table {
        font-size: 0.75rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.5rem;
    }
    
    .admin-tools {
        gap: 0.75rem;
    }
}