/* Dark Theme for Torrential */

/* Override SB Admin colors for dark theme */
:root {
  --dark-bg: #1a1a1a;
  --dark-card: #2d2d2d;
  --dark-sidebar: #212529;
  --dark-text: #e9ecef;
  --dark-text-muted: #adb5bd;
  --dark-border: #495057;
  --accent-primary: #4e73df;
  --accent-success: #1cc88a;
  --accent-warning: #f6c23e;
  --accent-danger: #e74a3b;
}

/* Body and main background */
body {
  background-color: var(--dark-bg) !important;
  color: var(--dark-text) !important;
}

/* Ensure all containers have dark background */
#wrapper, .container-fluid, .main-content, .content-wrapper {
  background-color: var(--dark-bg) !important;
}

/* Page content area */
.container, .container-fluid {
  background-color: var(--dark-bg) !important;
}

/* All white divs and sections */
div, section, main, header, footer {
  background-color: inherit !important;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--dark-sidebar) 10%, #343a40 100%) !important;
}

/* All sidebar text should be white */
.sidebar, .sidebar * {
  color: var(--dark-text) !important;
}

.sidebar .nav-item .nav-link {
  color: var(--dark-text) !important;
}

.sidebar .nav-item .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--dark-text) !important;
}

.sidebar .nav-item .nav-link.active {
  background-color: var(--accent-primary) !important;
  color: white !important;
}

.sidebar .sidebar-brand {
  background-color: var(--dark-sidebar) !important;
  color: var(--dark-text) !important;
}

.sidebar .sidebar-brand-text {
  color: var(--dark-text) !important;
}

.sidebar-divider {
  border-color: var(--dark-border) !important;
}

/* Sidebar collapse items */
.sidebar .collapse-item {
  color: var(--dark-text) !important;
}

.sidebar .collapse-item:hover {
  color: white !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Sidebar headings */
.sidebar-heading {
  color: var(--dark-text-muted) !important;
}

/* Ensure all sidebar links are white */
.sidebar a, .sidebar a:hover, .sidebar a:focus {
  color: var(--dark-text) !important;
}

/* Brand icon */
.sidebar .sidebar-brand-icon {
  color: var(--dark-text) !important;
}

/* Cards */
.card {
  background-color: var(--dark-card) !important;
  border: 1px solid var(--dark-border) !important;
  color: var(--dark-text) !important;
}

.card-header {
  background-color: rgba(0, 0, 0, 0.1) !important;
  border-bottom: 1px solid var(--dark-border) !important;
  color: var(--dark-text) !important;
}

/* Tables */
.table {
  color: var(--dark-text) !important;
}

.table-dark {
  background-color: var(--dark-card) !important;
}

.table thead th {
  background-color: var(--dark-sidebar) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}

.table td, .table th {
  border-color: var(--dark-border) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

/* Forms */
.form-control {
  background-color: var(--dark-card) !important;
  border: 1px solid var(--dark-border) !important;
  color: var(--dark-text) !important;
}

.form-control:focus {
  background-color: var(--dark-card) !important;
  border-color: var(--accent-primary) !important;
  color: var(--dark-text) !important;
  box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25) !important;
}

.form-control::placeholder {
  color: var(--dark-text-muted) !important;
}

/* Buttons - keep existing colors but adjust for dark theme */
.btn-primary {
  background-color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}

.btn-success {
  background-color: var(--accent-success) !important;
  border-color: var(--accent-success) !important;
}

.btn-warning {
  background-color: var(--accent-warning) !important;
  border-color: var(--accent-warning) !important;
  color: #212529 !important;
}

.btn-danger {
  background-color: var(--accent-danger) !important;
  border-color: var(--accent-danger) !important;
}

.btn-secondary {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: var(--dark-text) !important;
}

/* Progress bars */
.progress {
  background-color: rgba(0, 0, 0, 0.2) !important;
}

/* Badges */
.badge {
  color: #fff !important;
}

/* Modals */
.modal-content {
  background-color: var(--dark-card) !important;
  border: 1px solid var(--dark-border) !important;
}

.modal-header {
  border-bottom: 1px solid var(--dark-border) !important;
}

.modal-footer {
  border-top: 1px solid var(--dark-border) !important;
}

.modal-title {
  color: var(--dark-text) !important;
}

/* Tabs */
.nav-tabs {
  border-bottom: 1px solid var(--dark-border) !important;
}

.nav-tabs .nav-link {
  color: var(--dark-text-muted) !important;
  border: 1px solid transparent !important;
}

.nav-tabs .nav-link:hover {
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}

.nav-tabs .nav-link.active {
  background-color: var(--dark-card) !important;
  border-color: var(--dark-border) var(--dark-border) var(--dark-card) !important;
  color: var(--dark-text) !important;
}

.tab-content {
  background-color: var(--dark-card) !important;
}

/* Status indicators */
.text-success {
  color: var(--accent-success) !important;
}

.text-danger {
  color: var(--accent-danger) !important;
}

.text-warning {
  color: var(--accent-warning) !important;
}

.text-primary {
  color: var(--accent-primary) !important;
}

.text-muted {
  color: var(--dark-text-muted) !important;
}

/* Login form specific */
.login-container {
  background-color: var(--dark-card) !important;
  border: 1px solid var(--dark-border) !important;
}

/* Alerts */
.alert {
  border: 1px solid var(--dark-border) !important;
}

.alert-warning {
  background-color: rgba(246, 194, 62, 0.1) !important;
  color: var(--accent-warning) !important;
  border-color: var(--accent-warning) !important;
}

.alert-danger {
  background-color: rgba(231, 74, 59, 0.1) !important;
  color: var(--accent-danger) !important;
  border-color: var(--accent-danger) !important;
}

.alert-success {
  background-color: rgba(28, 200, 138, 0.1) !important;
  color: var(--accent-success) !important;
  border-color: var(--accent-success) !important;
}

/* Scrollbars for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--dark-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6c757d;
}

/* Topbar */
.topbar {
  background-color: var(--dark-card) !important;
  border-bottom: 1px solid var(--dark-border) !important;
}

/* Dropdown menus */
.dropdown-menu {
  background-color: var(--dark-card) !important;
  border: 1px solid var(--dark-border) !important;
}

.dropdown-item {
  color: var(--dark-text) !important;
}

.dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--dark-text) !important;
}

/* Status badges */
.status-badge {
  font-weight: 600;
}

.status-downloading {
  background-color: var(--accent-primary) !important;
}

.status-seeding {
  background-color: var(--accent-success) !important;
}

.status-paused {
  background-color: #6c757d !important;
}

.status-error {
  background-color: var(--accent-danger) !important;
}

/* Additional white background overrides */
.row, .col, .col-md-4, .col-md-6, .col-md-8, .col-md-12, .col-lg-3, .col-lg-6, .col-lg-9 {
  background-color: transparent !important;
}

/* Content wrapper and page wrapper */
#content-wrapper, #page-top, .content {
  background-color: var(--dark-bg) !important;
}

/* Any remaining white backgrounds */
.bg-white {
  background-color: var(--dark-card) !important;
}

/* Login section specific */
#login-section {
  background-color: var(--dark-bg) !important;
}

/* Dashboard and other sections */
#dashboard-section, #torrents-section, #admin-section {
  background-color: var(--dark-bg) !important;
}

/* Card bodies */
.card-body {
  background-color: var(--dark-card) !important;
  color: var(--dark-text) !important;
}

/* Table containers */
.table-responsive {
  background-color: var(--dark-card) !important;
}

/* Input groups */
.input-group-text {
  background-color: var(--dark-sidebar) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}

/* Close buttons for modals */
.btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Any elements with white background class */
.bg-light {
  background-color: var(--dark-card) !important;
}

/* Border utilities */
.border {
  border-color: var(--dark-border) !important;
}

/* Shadow adjustments for dark theme */
.shadow {
  box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.4) !important;
}

.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3) !important;
}

.shadow-lg {
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5) !important;
}