/* Wasupp Write - Custom Styles */

/* X-cloak for Alpine.js */
[x-cloak] {
    display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #111111;
}

.dark ::-webkit-scrollbar-track {
    background: #111111;
}

::-webkit-scrollbar-thumb {
    background: #FFFFFF;
    border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #A1A1AA;
}

/* Global Dark Mode Input Fix */
.dark input:not([type="checkbox"]):not([type="radio"]),
.dark select,
.dark textarea {
    color: #FFFFFF;
}

/* Fix Autofill for Dark Mode */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 50px #000000 inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

::-webkit-scrollbar-thumb:hover {
    background: #A1A1AA;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #A1A1AA;
}

/* Ensure no overlay blocking */
body {
    position: relative;
    overflow-x: hidden;
}

/* Fix any z-index issues */
.main-content {
    position: relative;
    z-index: 1;
}

/* DataTables Custom Styling */
.dataTables_wrapper {
    width: 100%;
    padding: 1.5rem;
    /* Add padding inside the card for controls */
    color: #A1A1AA;
    /* Slate 600 */
}

.dark .dataTables_wrapper {
    color: #FFFFFF;
    /* Slate 300 */
}

/* Header Spacing & Text Color */
.dataTables_length,
.dataTables_filter {
    margin-bottom: 1.5rem;
    color: #A1A1AA;
}

.dataTables_length label,
.dataTables_filter label {
    color: #A1A1AA !important;
    font-weight: 500;
}

.dark .dataTables_length,
.dark .dataTables_filter {
    color: #FFFFFF;
}

.dark .dataTables_length label,
.dark .dataTables_filter label {
    color: #FFFFFF !important;
}

/* Inputs & Selects */
.dataTables_wrapper input[type="search"],
.dataTables_wrapper select {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: #fff;
    color: #111111;
    outline: none;
}

.dataTables_wrapper input[type="search"]:focus,
.dataTables_wrapper select:focus {
    border-color: #7000FF;
    box-shadow: 0 0 0 2px rgba(112, 0, 255, 0.2);
}

.dark .dataTables_wrapper input[type="search"],
.dark .dataTables_wrapper select {
    border-color: #111111;
    background-color: #0A0A0A;
    /* Slate 900 */
    color: #FFFFFF;
}

/* Empty Row Fix */
table.dataTable tbody tr.odd,
table.dataTable tbody tr.even,
table.dataTable.display tbody tr.odd,
table.dataTable.display tbody tr.even {
    background-color: transparent !important;
}

table.dataTable.no-footer {
    border-bottom: none !important;
}

/* "No matching records found" row */
.dataTables_empty {
    padding: 2rem !important;
    color: #A1A1AA;
    /* Slate 500 */
    background: transparent !important;
}

.dark .dataTables_empty {
    color: #A1A1AA;
    /* Slate 400 */
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #A1A1AA !important;
    border-radius: 0.5rem !important;
    border: 1px solid transparent !important;
}

.dark .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #FFFFFF !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #111111 !important;
    color: #111111 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #111111 !important;
    color: #fff !important;
    border-color: #A1A1AA !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #7000FF !important;
    color: #fff !important;
    border: 1px solid #7000FF !important;
}

/* Info Text */
.dataTables_info {
    padding-top: 1.5rem !important;
    color: #A1A1AA !important;
}

.dark .dataTables_info {
    color: #A1A1AA !important;
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(8px);
}

.dark .preloader {
    background: rgba(15, 23, 42, 0.95);
}

.loader-ring {
    display: inline-block;
    width: 80px;
    height: 80px;
}

.loader-ring:after {
    content: " ";
    display: block;
    width: 64px;
    height: 64px;
    margin: 8px;
    border-radius: 50%;
    border: 6px solid #7000FF;
    border-color: #7000FF transparent #7000FF transparent;
    animation: loader-ring 1.2s linear infinite;
}

@keyframes loader-ring {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Fix DataTables sorted column background (ID column issue) */
table.dataTable.display tbody tr.odd>.sorting_1,
table.dataTable.order-column.stripe tbody tr.odd>.sorting_1,
table.dataTable.stripe tbody tr.odd>.sorting_1,
table.dataTable.display tbody tr.even>.sorting_1,
table.dataTable.order-column.stripe tbody tr.even>.sorting_1,
table.dataTable.stripe tbody tr.even>.sorting_1 {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Global Responsive Table Cells */
table.dataTable td {
    max-width: 350px;
    white-space: normal;
    word-wrap: break-word;
}

/* Dropify Custom Styles */
.dropify-wrapper {
    border: 2px dashed #FFFFFF;
    border-radius: 12px;
    background: #f8fafc;
}

.dark .dropify-wrapper {
    border-color: #A1A1AA;
    background: #111111;
}

.dropify-wrapper:hover {
    border-color: #7000FF;
}

.dropify-wrapper .dropify-message p {
    font-size: 14px !important;
}

.dropify-wrapper .dropify-message .file-icon {
    font-size: 24px !important;
}

.dropify-render img {
    margin: auto;
}

/* Tag Input Styles */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: #f8fafc;
}

.dark .tag-input {
    border-color: #A1A1AA;
    background: #111111;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: #7000FF;
    color: white;
    border-radius: 6px;
    font-size: 14px;
}

.tag .remove {
    cursor: pointer;
    margin-left: 4px;
    opacity: 0.8;
}

.tag .remove:hover {
    opacity: 1;
}

/* Ensure modal/dropdown visibility */
.modal,
.dropdown-menu {
    z-index: 1000;
}

/* Fix Alpine transitions */
[x-show] {
    transition: all 0.3s ease;
}

/* sr-only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Custom Switch Component */
.ps-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.ps-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
    appearance: none !important;
    -webkit-appearance: none !important;
    opacity: 0 !important;
}

.ps-switch-slider {
    width: 2.75rem;
    /* w-11 */
    height: 1.5rem;
    /* h-6 */
    background-color: rgba(255, 255, 255, 0.1);
    /* bg-slate-200 */
    border-radius: 9999px;
    /* rounded-full */
    position: relative;
    transition: background-color 0.2s, background-image 0.2s;
}

.dark .ps-switch-slider {
    background-color: #111111;
    /* dark:bg-slate-700 */
}

.ps-switch-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    background-color: white;
    border: 1px solid #d1d5db;
    /* border-gray-300 */
    border-radius: 9999px;
    height: 1.25rem;
    /* h-5 */
    width: 1.25rem;
    /* w-5 */
    transition: all 0.2s;
}

.ps-switch input:checked+.ps-switch-slider {
    background-color: #7000FF;
    /* bg-indigo-600 */
}

.ps-switch input:checked+.ps-switch-slider::after {
    transform: translateX(100%);
    border-color: white;
}

.ps-switch input:focus+.ps-switch-slider {
    /* ring-4 ring-indigo-300 */
    box-shadow: 0 0 0 4px rgba(165, 180, 252, 1);
}

.dark .ps-switch input:focus+.ps-switch-slider {
    /* dark:ring-indigo-800 */
    box-shadow: 0 0 0 4px rgba(55, 48, 163, 1);
}

/* --- Global Modal Styles --- */
.ps-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background-color: rgba(15, 23, 42, 0.75);
    /* Slate 900 / 75% */
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.ps-modal-container {
    position: fixed;
    inset: 0;
    z-index: 60;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ps-modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 32rem;
    /* max-w-lg */
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .ps-modal-content {
    background: #111111;
    /* Slate 800 */
    border-color: #111111;
    /* Slate 700 */
}

.ps-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #111111;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark .ps-modal-header {
    border-color: #111111;
}

.ps-modal-body {
    padding: 1.5rem;
}

.ps-modal-footer {
    padding: 1rem 1.5rem;
    background-color: #f8fafc;
    border-top: 1px solid #111111;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.dark .ps-modal-footer {
    background-color: #0A0A0A;
    /* Slate 900 */
    border-color: #111111;
}

/* --- Global Input Styles --- */
.ps-form-label {
    display: block;
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 500;
    color: #111111;
    /* Slate 700 */
    margin-bottom: 0.375rem;
}

.dark .ps-form-label {
    color: #FFFFFF;
    /* Slate 300 */
}

.ps-form-input,
.ps-form-select,
.ps-form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    /* Increased padding */
    font-size: 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid #FFFFFF;
    /* Slate 300 */
    background-color: #ffffff;
    color: #0A0A0A;
    /* Slate 900 */
    outline: none;
    transition: all 0.2s;
}

.dark .ps-form-input,
.dark .ps-form-select,
.dark .ps-form-textarea {
    background-color: #0A0A0A;
    /* Slate 900 */
    border-color: #111111;
    /* Slate 600 */
    color: #FFFFFF;
    /* Slate 200 */
}

.ps-form-input:focus,
.ps-form-select:focus,
.ps-form-textarea:focus {
    border-color: #7000FF;
    /* Indigo 500 */
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}