/**
 * Knight Online Dark Theme
 * Medieval fantasy inspired dark theme
 */

/* Knight Online Dark Mode Variables */
body.dark-mode {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #252d3f;
    --bg-card: #1e2533;
    --text-primary: #e8eaed;
    --text-secondary: #b4b8c5;
    --text-muted: #7a7f8f;
    --border-color: #2d3548;
    --accent-primary: #d4af37;
    --accent-secondary: #8b7355;
    --accent-danger: #c9302c;
    --accent-success: #5cb85c;
    --link-color: #d4af37;
    --link-hover: #f5d76e;
}

/* Body */
body.dark-mode {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* Container */
body.dark-mode .container {
    background-color: transparent;
}

/* Cards - Knight Online Theme */
body.dark-mode .card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

body.dark-mode .card-header {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%) !important;
    border-bottom: 2px solid var(--accent-primary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .card-header.bg-primary {
    background: linear-gradient(135deg, #d4af37 0%, #8b7355 100%) !important;
    color: #1a1f2e !important;
}

body.dark-mode .card-header.bg-success {
    background: linear-gradient(135deg, #5cb85c 0%, #449d44 100%) !important;
}

body.dark-mode .card-header.bg-warning {
    background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%) !important;
}

body.dark-mode .card-body {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .card-footer {
    background-color: var(--bg-tertiary) !important;
    border-top-color: var(--border-color) !important;
}

/* Navbar - Knight Online Theme */
body.dark-mode .navbar {
    background: linear-gradient(135deg, #1a1f2e 0%, #252d3f 100%) !important;
    border-bottom: 2px solid var(--accent-primary) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.dark-mode .navbar-brand {
    color: var(--accent-primary) !important;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-mode .nav-link {
    color: var(--text-secondary) !important;
    transition: all 0.3s ease;
}

body.dark-mode .nav-link:hover {
    color: var(--accent-primary) !important;
    transform: translateY(-1px);
}

body.dark-mode .navbar-toggler {
    border-color: var(--accent-primary);
}

body.dark-mode .navbar-toggler-icon {
    filter: brightness(0) invert(1);
}

/* Forms */
body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--link-color) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(91, 154, 255, 0.25) !important;
}

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

body.dark-mode .form-label {
    color: var(--text-primary) !important;
}

body.dark-mode .form-text {
    color: var(--text-secondary) !important;
}

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

body.dark-mode .table-dark {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

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

body.dark-mode .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-mode thead {
    border-bottom: 2px solid var(--border-color);
}

/* Alerts */
body.dark-mode .alert {
    border-color: var(--border-color) !important;
}

body.dark-mode .alert-info {
    background-color: rgba(91, 154, 255, 0.1) !important;
    color: #5b9aff !important;
    border-color: rgba(91, 154, 255, 0.3) !important;
}

body.dark-mode .alert-success {
    background-color: rgba(52, 211, 153, 0.1) !important;
    color: #34d399 !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
}

body.dark-mode .alert-warning {
    background-color: rgba(251, 191, 36, 0.1) !important;
    color: #fbbf24 !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

body.dark-mode .alert-danger {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

/* Badges */
body.dark-mode .badge {
    color: #fff !important;
}

body.dark-mode .badge.bg-light {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .badge.bg-secondary {
    background-color: #6b7280 !important;
}

/* Buttons - Knight Online Theme */
body.dark-mode .btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #8b7355 100%) !important;
    border: none !important;
    color: #1a1f2e !important;
    font-weight: 600 !important;
}

body.dark-mode .btn-primary:hover {
    background: linear-gradient(135deg, #f5d76e 0%, #a68a5f 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3) !important;
}

body.dark-mode .btn-success {
    background: linear-gradient(135deg, #5cb85c 0%, #449d44 100%) !important;
    border: none !important;
}

body.dark-mode .btn-warning {
    background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%) !important;
    border: none !important;
}

body.dark-mode .btn-danger {
    background: linear-gradient(135deg, #d9534f 0%, #c9302c 100%) !important;
    border: none !important;
}

body.dark-mode .btn-outline-primary {
    color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    background: transparent !important;
}

body.dark-mode .btn-outline-primary:hover {
    background: var(--accent-primary) !important;
    color: #1a1f2e !important;
}

body.dark-mode .btn-secondary {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .btn-light {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Modals */
body.dark-mode .modal-content {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .modal-header {
    background-color: var(--bg-tertiary) !important;
    border-bottom-color: var(--border-color) !important;
}

body.dark-mode .modal-footer {
    background-color: var(--bg-tertiary) !important;
    border-top-color: var(--border-color) !important;
}

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

body.dark-mode .close,
body.dark-mode .btn-close {
    filter: invert(1);
}

/* Dropdowns */
body.dark-mode .dropdown-menu {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

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

body.dark-mode .dropdown-item:hover {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .dropdown-divider {
    border-top-color: var(--border-color) !important;
}

/* Breadcrumb */
body.dark-mode .breadcrumb {
    background-color: var(--bg-tertiary) !important;
}

body.dark-mode .breadcrumb-item {
    color: var(--text-secondary) !important;
}

body.dark-mode .breadcrumb-item.active {
    color: var(--text-primary) !important;
}

/* Pagination */
body.dark-mode .page-link {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .page-link:hover {
    background-color: var(--bg-tertiary) !important;
    color: var(--link-color) !important;
}

body.dark-mode .page-item.active .page-link {
    background-color: var(--link-color) !important;
    border-color: var(--link-color) !important;
}

/* Text Colors */
body.dark-mode .text-muted {
    color: var(--text-muted) !important;
}

body.dark-mode .text-dark {
    color: var(--text-primary) !important;
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, 
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6 {
    color: var(--text-primary) !important;
}

body.dark-mode a {
    color: var(--link-color) !important;
}

body.dark-mode a:hover {
    color: var(--link-hover) !important;
}

/* Lists */
body.dark-mode .list-group-item {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .list-group-item:hover {
    background-color: var(--bg-tertiary) !important;
}

/* Hr */
body.dark-mode hr {
    border-color: var(--border-color) !important;
    opacity: 1;
}

/* Progress */
body.dark-mode .progress {
    background-color: var(--bg-tertiary) !important;
}

/* Tooltips & Popovers */
body.dark-mode .tooltip-inner {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .popover {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .popover-header {
    background-color: var(--bg-tertiary) !important;
    border-bottom-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .popover-body {
    color: var(--text-primary) !important;
}

/* Code & Pre */
body.dark-mode code {
    background-color: var(--bg-tertiary) !important;
    color: #f8719f !important;
}

body.dark-mode pre {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Custom scrollbar for dark mode */
body.dark-mode::-webkit-scrollbar {
    width: 12px;
}

body.dark-mode::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

body.dark-mode::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 6px;
}

body.dark-mode::-webkit-scrollbar-thumb:hover {
    background: #3a3d4a;
}

/* Smooth transitions */
body, .card, .form-control, .btn, .navbar {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Dark mode toggle button */
#darkModeToggle {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#darkModeToggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode #darkModeToggle {
    color: #fbbf24;
}
