/* Dark Mode Base Styles */
/* These styles provide automatic dark mode support for common elements */

/* Prevent flash of unstyled content */
[x-cloak] { display: none !important; }

/* ===== BASE DARK MODE ===== */
html.dark body {
    background-color: rgb(17, 24, 39) !important; /* gray-900 */
    color: rgb(243, 244, 246) !important; /* gray-100 */
}

html.dark main {
    background-color: rgb(17, 24, 39) !important; /* gray-900 */
}

/* ===== ALL FORM ELEMENTS ===== */
html.dark input,
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="number"],
html.dark input[type="url"],
html.dark input[type="search"],
html.dark input[type="date"],
html.dark input[type="datetime-local"],
html.dark input[type="tel"],
html.dark textarea,
html.dark select,
html.dark .form-control,
html.dark .form-select {
    background-color: rgb(55, 65, 81) !important; /* gray-700 */
    border-color: rgb(75, 85, 99) !important; /* gray-600 */
    color: rgb(243, 244, 246) !important; /* gray-100 */
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: rgb(156, 163, 175) !important; /* gray-400 */
}

html.dark input:focus,
html.dark textarea:focus,
html.dark select:focus {
    border-color: rgb(99, 102, 241) !important; /* indigo-500 */
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3) !important;
    outline: none !important;
}

html.dark input:disabled,
html.dark textarea:disabled,
html.dark select:disabled,
html.dark input[readonly],
html.dark textarea[readonly] {
    background-color: rgb(31, 41, 55) !important; /* gray-800 */
    color: rgb(156, 163, 175) !important; /* gray-400 */
    opacity: 0.7;
}

/* Checkbox & Radio */
html.dark input[type="checkbox"],
html.dark input[type="radio"] {
    background-color: rgb(55, 65, 81) !important;
    border-color: rgb(107, 114, 128) !important;
}

html.dark input[type="checkbox"]:checked,
html.dark input[type="radio"]:checked {
    background-color: rgb(99, 102, 241) !important;
    border-color: rgb(99, 102, 241) !important;
}

/* ===== LABELS ===== */
html.dark label,
html.dark .form-label {
    color: rgb(209, 213, 219) !important; /* gray-300 */
}

/* ===== TABLES ===== */
html.dark table {
    background-color: rgb(31, 41, 55) !important; /* gray-800 */
}

html.dark table thead,
html.dark table thead tr,
html.dark thead.bg-gray-50,
html.dark .bg-gray-50 {
    background-color: rgb(55, 65, 81) !important; /* gray-700 */
}

html.dark table tbody {
    background-color: rgb(31, 41, 55) !important; /* gray-800 */
}

html.dark table tbody tr {
    background-color: rgb(31, 41, 55) !important; /* gray-800 */
}

html.dark table tbody tr:hover,
html.dark tr.hover\:bg-gray-50:hover {
    background-color: rgb(55, 65, 81) !important; /* gray-700 */
}

html.dark table th {
    background-color: rgb(55, 65, 81) !important; /* gray-700 */
    color: rgb(209, 213, 219) !important; /* gray-300 */
    border-color: rgb(75, 85, 99) !important; /* gray-600 */
}

html.dark table td {
    border-color: rgb(75, 85, 99) !important; /* gray-600 */
    color: rgb(229, 231, 235) !important; /* gray-200 */
}

html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: rgb(75, 85, 99) !important; /* gray-600 */
}

/* ===== CARDS & CONTAINERS ===== */
html.dark .bg-white,
html.dark div.bg-white,
html.dark section.bg-white,
html.dark article.bg-white {
    background-color: rgb(31, 41, 55) !important; /* gray-800 */
}

html.dark .bg-gray-100 {
    background-color: rgb(55, 65, 81) !important; /* gray-700 */
}

html.dark .rounded-lg,
html.dark .rounded,
html.dark .card {
    border-color: rgb(75, 85, 99) !important; /* gray-600 */
}

/* ===== SHADOWS ===== */
html.dark .shadow,
html.dark .shadow-sm,
html.dark .shadow-md,
html.dark .shadow-lg {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3) !important;
}

/* ===== TEXT COLORS ===== */
html.dark .text-gray-400 {
    color: rgb(156, 163, 175) !important; /* gray-400 */
}

html.dark .text-gray-500 {
    color: rgb(156, 163, 175) !important; /* gray-400 */
}

html.dark .text-gray-600 {
    color: rgb(209, 213, 219) !important; /* gray-300 */
}

html.dark .text-gray-700 {
    color: rgb(229, 231, 235) !important; /* gray-200 */
}

html.dark .text-gray-800 {
    color: rgb(243, 244, 246) !important; /* gray-100 */
}

html.dark .text-gray-900 {
    color: rgb(255, 255, 255) !important; /* white */
}

html.dark h1, html.dark h2, html.dark h3, 
html.dark h4, html.dark h5, html.dark h6 {
    color: rgb(255, 255, 255) !important;
}

html.dark p {
    color: rgb(209, 213, 219) !important; /* gray-300 */
}

/* ===== BORDERS ===== */
html.dark .border,
html.dark .border-b,
html.dark .border-t,
html.dark .border-l,
html.dark .border-r {
    border-color: rgb(75, 85, 99) !important; /* gray-600 */
}

html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300 {
    border-color: rgb(75, 85, 99) !important; /* gray-600 */
}

/* ===== BUTTONS ===== */
html.dark .bg-gray-800 {
    background-color: rgb(75, 85, 99) !important; /* gray-600 */
}

html.dark .bg-gray-800:hover,
html.dark .hover\:bg-gray-900:hover {
    background-color: rgb(107, 114, 128) !important; /* gray-500 */
}

html.dark button.border-gray-300,
html.dark a.border-gray-300 {
    border-color: rgb(107, 114, 128) !important; /* gray-500 */
    color: rgb(209, 213, 219) !important; /* gray-300 */
}

html.dark button.border-gray-300:hover,
html.dark a.border-gray-300:hover,
html.dark .hover\:bg-gray-100:hover {
    background-color: rgb(55, 65, 81) !important; /* gray-700 */
}

/* ===== ALERTS & NOTIFICATIONS ===== */
html.dark .bg-green-50 {
    background-color: rgba(34, 197, 94, 0.15) !important;
}
html.dark .border-green-200 {
    border-color: rgba(34, 197, 94, 0.4) !important;
}
html.dark .text-green-700,
html.dark .text-green-800 {
    color: rgb(134, 239, 172) !important; /* green-300 */
}

html.dark .bg-red-50 {
    background-color: rgba(239, 68, 68, 0.15) !important;
}
html.dark .border-red-200 {
    border-color: rgba(239, 68, 68, 0.4) !important;
}
html.dark .text-red-700,
html.dark .text-red-800 {
    color: rgb(252, 165, 165) !important; /* red-300 */
}

html.dark .bg-yellow-50 {
    background-color: rgba(234, 179, 8, 0.15) !important;
}
html.dark .border-yellow-200 {
    border-color: rgba(234, 179, 8, 0.4) !important;
}
html.dark .text-yellow-700,
html.dark .text-yellow-800 {
    color: rgb(253, 224, 71) !important; /* yellow-300 */
}

html.dark .bg-blue-50 {
    background-color: rgba(59, 130, 246, 0.15) !important;
}
html.dark .border-blue-200 {
    border-color: rgba(59, 130, 246, 0.4) !important;
}
html.dark .text-blue-700,
html.dark .text-blue-800 {
    color: rgb(147, 197, 253) !important; /* blue-300 */
}

/* ===== BADGES ===== */
html.dark .bg-indigo-50,
html.dark .bg-indigo-100 {
    background-color: rgba(99, 102, 241, 0.2) !important;
}
html.dark .text-indigo-700,
html.dark .text-indigo-800 {
    color: rgb(165, 180, 252) !important; /* indigo-300 */
}

html.dark .bg-green-100 {
    background-color: rgba(34, 197, 94, 0.2) !important;
}

html.dark .bg-red-100 {
    background-color: rgba(239, 68, 68, 0.2) !important;
}

html.dark .bg-blue-100 {
    background-color: rgba(59, 130, 246, 0.2) !important;
}

html.dark .bg-purple-100 {
    background-color: rgba(168, 85, 247, 0.2) !important;
}
html.dark .text-purple-700,
html.dark .text-purple-800 {
    color: rgb(216, 180, 254) !important; /* purple-300 */
}

/* ===== LINKS ===== */
html.dark a {
    color: rgb(165, 180, 252); /* indigo-300 */
}

html.dark a:hover {
    color: rgb(199, 210, 254); /* indigo-200 */
}

html.dark a.text-indigo-600 {
    color: rgb(165, 180, 252) !important;
}

html.dark a.text-red-600,
html.dark .text-red-600 {
    color: rgb(252, 165, 165) !important;
}

html.dark a.text-red-700 {
    color: rgb(252, 165, 165) !important;
}

/* ===== MODALS ===== */
html.dark .modal-content,
html.dark [x-show*="modal"] > div,
html.dark [x-show*="Modal"] > div {
    background-color: rgb(31, 41, 55) !important; /* gray-800 */
    border-color: rgb(75, 85, 99) !important;
}

html.dark .bg-black\/50,
html.dark .bg-gray-900\/50,
html.dark [class*="bg-opacity"] {
    background-color: rgba(0, 0, 0, 0.75) !important;
}

/* ===== SELECT2 DARK MODE ===== */
html.dark .select2-container--default .select2-selection--single,
html.dark .select2-container--default .select2-selection--multiple {
    background-color: rgb(55, 65, 81) !important;
    border-color: rgb(75, 85, 99) !important;
    color: rgb(243, 244, 246) !important;
    min-height: 38px !important;
}

html.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: rgb(243, 244, 246) !important;
    line-height: 36px !important;
}

html.dark .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
}

html.dark .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: rgb(156, 163, 175) transparent transparent transparent !important;
}

html.dark .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: rgb(156, 163, 175) !important;
}

html.dark .select2-container--default .select2-selection--single .select2-selection__clear {
    color: rgb(156, 163, 175) !important;
    font-weight: bold;
}

html.dark .select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: rgb(239, 68, 68) !important;
}

html.dark .select2-container--default .select2-results__option {
    background-color: rgb(55, 65, 81) !important;
    color: rgb(243, 244, 246) !important;
    padding: 8px 12px !important;
}

html.dark .select2-container--default .select2-results__option--highlighted[aria-selected],
html.dark .select2-container--default .select2-results__option:hover {
    background-color: rgb(99, 102, 241) !important;
    color: white !important;
}

html.dark .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: rgb(79, 70, 229) !important;
    color: white !important;
}

html.dark .select2-container--default .select2-results__option--disabled {
    color: rgb(107, 114, 128) !important;
}

html.dark .select2-dropdown {
    background-color: rgb(55, 65, 81) !important;
    border-color: rgb(75, 85, 99) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2) !important;
}

html.dark .select2-search--dropdown .select2-search__field {
    background-color: rgb(31, 41, 55) !important;
    border-color: rgb(75, 85, 99) !important;
    color: rgb(243, 244, 246) !important;
    padding: 8px 12px !important;
}

html.dark .select2-search--dropdown .select2-search__field::placeholder {
    color: rgb(156, 163, 175) !important;
}

html.dark .select2-search--dropdown .select2-search__field:focus {
    border-color: rgb(99, 102, 241) !important;
    outline: none !important;
}

html.dark .select2-container--default .select2-results__message {
    color: rgb(156, 163, 175) !important;
}

html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgb(79, 70, 229) !important;
    border-color: rgb(99, 102, 241) !important;
    color: white !important;
    padding: 2px 8px !important;
    margin: 4px !important;
}

html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: white !important;
    margin-right: 4px !important;
}

html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: rgb(252, 165, 165) !important;
    background: transparent !important;
}

html.dark .select2-container--default .select2-selection--multiple .select2-search__field {
    color: rgb(243, 244, 246) !important;
}

html.dark .select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
    color: rgb(156, 163, 175) !important;
}

html.dark .select2-container--default.select2-container--focus .select2-selection--single,
html.dark .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: rgb(99, 102, 241) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3) !important;
}

html.dark .select2-container--default.select2-container--open .select2-selection--single,
html.dark .select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: rgb(99, 102, 241) !important;
}

html.dark .select2-container--default .select2-results > .select2-results__options {
    background-color: rgb(55, 65, 81) !important;
}

/* Select2 loading indicator */
html.dark .select2-container--default .select2-results__option--load-more,
html.dark .select2-container--default .select2-results__option[aria-busy="true"] {
    color: rgb(156, 163, 175) !important;
}

/* Select2 option groups */
html.dark .select2-container--default .select2-results__group {
    color: rgb(209, 213, 219) !important;
    background-color: rgb(31, 41, 55) !important;
    padding: 8px 12px !important;
    font-weight: 600 !important;
}

/* ===== PAGINATION ===== */
html.dark nav[aria-label="Pagination"] span,
html.dark nav[aria-label="Pagination"] a,
html.dark .pagination span,
html.dark .pagination a {
    background-color: rgb(31, 41, 55) !important;
    border-color: rgb(75, 85, 99) !important;
    color: rgb(209, 213, 219) !important;
}

html.dark nav[aria-label="Pagination"] span[aria-current],
html.dark .pagination .active {
    background-color: rgb(99, 102, 241) !important;
    border-color: rgb(99, 102, 241) !important;
    color: white !important;
}

html.dark nav[aria-label="Pagination"] a:hover,
html.dark .pagination a:hover {
    background-color: rgb(55, 65, 81) !important;
}

/* ===== DROPDOWN MENUS ===== */
html.dark .dropdown-menu,
html.dark [x-show*="dropdown"],
html.dark [x-show*="open"] ul {
    background-color: rgb(31, 41, 55) !important;
    border-color: rgb(75, 85, 99) !important;
}

/* ===== CHART.JS DARK MODE ===== */
html.dark canvas {
    filter: none;
}

/* Chart.js legend text color */
html.dark .chartjs-render-monitor {
    color: rgb(209, 213, 219) !important;
}

/* ===== SCROLLBAR DARK MODE ===== */
html.dark ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html.dark ::-webkit-scrollbar-track {
    background: rgb(31, 41, 55);
}

html.dark ::-webkit-scrollbar-thumb {
    background: rgb(75, 85, 99);
    border-radius: 5px;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: rgb(107, 114, 128);
}

/* ===== OVERFLOW CONTAINERS ===== */
html.dark .overflow-x-auto,
html.dark .overflow-y-auto,
html.dark .overflow-auto {
    background-color: rgb(31, 41, 55) !important;
}

/* Demo modal: arka plan görünsün (overflow kuralı uygulanmasın) */
html.dark #demo-modal.overflow-y-auto {
    background-color: unset !important;
}

/* ===== SPECIFIC COMPONENT FIXES ===== */

/* Action buttons in tables */
html.dark .hover\:bg-red-50:hover {
    background-color: rgba(239, 68, 68, 0.2) !important;
}

html.dark .hover\:bg-indigo-50:hover,
html.dark .hover\:bg-indigo-100:hover {
    background-color: rgba(99, 102, 241, 0.2) !important;
}

html.dark .hover\:bg-green-50:hover {
    background-color: rgba(34, 197, 94, 0.2) !important;
}

html.dark .hover\:bg-purple-50:hover {
    background-color: rgba(168, 85, 247, 0.2) !important;
}

/* Border colors for action buttons */
html.dark .border-red-300 {
    border-color: rgba(239, 68, 68, 0.5) !important;
}

html.dark .border-indigo-300 {
    border-color: rgba(99, 102, 241, 0.5) !important;
}

html.dark .border-green-300 {
    border-color: rgba(34, 197, 94, 0.5) !important;
}

/* Gradient backgrounds - keep them vibrant */
html.dark .bg-gradient-to-r {
    opacity: 0.95;
}

/* Fix for bg-indigo-50 bulk action bar */
html.dark .bg-indigo-50 {
    background-color: rgba(99, 102, 241, 0.15) !important;
}

html.dark .border-indigo-200 {
    border-color: rgba(99, 102, 241, 0.4) !important;
}

html.dark .text-indigo-900 {
    color: rgb(199, 210, 254) !important; /* indigo-200 */
}

/* ===== HR & DIVIDERS ===== */
html.dark hr {
    border-color: rgb(75, 85, 99) !important;
}

/* ===== TOOLTIP ===== */
html.dark [role="tooltip"],
html.dark .tooltip {
    background-color: rgb(17, 24, 39) !important;
    color: rgb(243, 244, 246) !important;
    border-color: rgb(75, 85, 99) !important;
}

/* ===== FANCYBOX DARK MODE ===== */
html.dark .fancybox__container {
    --fancybox-bg: rgba(17, 24, 39, 0.95);
}

/* ===== TRANSITIONS ===== */
*, *::before, *::after {
    transition: background-color 0.15s ease-in-out, 
                border-color 0.15s ease-in-out, 
                color 0.15s ease-in-out;
}

/* Exclude animated elements */
canvas, img, video, svg path, svg circle, svg rect {
    transition: none !important;
}
