/* Tailwind Custom CSS - Separated for better maintenance */

/* ============================================
   Typography & Fonts
   ============================================ */

@font-face {
    font-family: 'Font Awesome 6 Free';
    font-display: swap;
}

@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/css/fonts/Quicksand/Quicksand-Medium.ttf') format('truetype');
}

@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/css/fonts/Quicksand/Quicksand-SemiBold.ttf') format('truetype');
}

@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/css/fonts/Quicksand/Quicksand-Bold.ttf') format('truetype');
}

* {
    font-family: "Quicksand", serif;
    font-weight: 600;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

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

/* ============================================
   Marquee Animation
   ============================================ */
@keyframes marquee {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-50%);
    }
}

.animate-marquee {
    animation: marquee 30s linear infinite;
}

.animate-marquee:hover {
    animation-play-state: paused;
}

/* ============================================
   Loading Dots Animation
   ============================================ */
.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loading-dots div {
    width: 12px;
    height: 12px;
    margin: 0 4px;
    background-color: #10b981;
    border-radius: 50%;
    animation: loading-bounce 1.4s infinite ease-in-out both;
}

.loading-dots div:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots div:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ============================================
   Sidebar Category Toggle
   ============================================ */
.sidebar-category-toggle[aria-expanded="true"] .material-icons-outlined {
    transform: rotate(180deg);
}

/* Smooth transitions for category content */
[data-category-content] {
    transition: all 0.3s ease-in-out;
    max-height: 0;
    overflow: hidden;
}

[data-category-content]:not(.hidden) {
    max-height: 1000px;
}

/* ============================================
   Card Hover Effects
   ============================================ */
.group:hover .group-hover\:scale-110 {
    transform: scale(1.1);
}

/* ============================================
   Text Line Clamp Utilities
   ============================================ */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   Prose Dark Mode Styling (for post content)
   ============================================ */
.prose.dark\:prose-invert {
    color: #d1d5db;
}

.prose.dark\:prose-invert h1,
.prose.dark\:prose-invert h2,
.prose.dark\:prose-invert h3,
.prose.dark\:prose-invert h4 {
    color: #ffffff;
}

.prose.dark\:prose-invert a {
    color: #10b981;
}

.prose.dark\:prose-invert strong {
    color: #ffffff;
}

/* ============================================
   Aspect Ratio for Video Container
   ============================================ */
.aspect-video {
    aspect-ratio: 16 / 9;
}

/* ============================================
   Mobile Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    /* Mobile sidebar toggle */
    #sidebar {
        display: none;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 999999999;
        width: 310px;
    }

    #sidebar.show {
        display: flex;
    }

    /* Show text labels when mobile sidebar is opened */
    #sidebar.show .hidden.lg\:block {
        display: block !important;
    }

    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 40;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ============================================
   Mobile Font Size Normalization
   ============================================ */
@media (max-width: 640px) {
    /* Balance cards - reduce large numbers */
    .text-3xl {
        font-size: 1.5rem !important; /* 24px instead of 30px */
        line-height: 2rem !important;
    }

    /* Section headings */
    .text-2xl {
        font-size: 1.25rem !important; /* 20px instead of 24px */
        line-height: 1.75rem !important;
    }

    .text-xl {
        font-size: 1.125rem !important; /* 18px instead of 20px */
        line-height: 1.5rem !important;
    }

    .text-lg {
        font-size: 1rem !important; /* 16px instead of 18px */
        line-height: 1.5rem !important;
    }

    /* Card padding adjustments */
    .p-6 {
        padding: 1rem !important; /* 16px instead of 24px */
    }

    .p-5 {
        padding: 0.875rem !important; /* 14px instead of 20px */
    }

    /* Gap adjustments */
    .gap-6 {
        gap: 1rem !important; /* 16px instead of 24px */
    }

    .gap-8 {
        gap: 1.25rem !important; /* 20px instead of 32px */
    }

    /* Margin bottom adjustments */
    .mb-8 {
        margin-bottom: 1.25rem !important;
    }

    /* Main content padding */
    #content {
        padding: 0.75rem !important;
    }

    /* Balance card specific */
    .grid-cols-1.md\:grid-cols-3 .p-6 {
        padding: 1rem !important;
    }

    /* Reduce decorative circle size */
    .w-32.h-32 {
        width: 5rem !important;
        height: 5rem !important;
    }

    /* Icon sizes in cards */
    .material-icons-outlined {
        font-size: 20px !important;
    }

    /* Smaller icons where needed */
    .text-base .material-icons-outlined,
    .text-sm .material-icons-outlined {
        font-size: 16px !important;
    }

    /* Featured service cards */
    .rounded-2xl.p-6 h3.text-xl {
        font-size: 1rem !important;
    }

    /* DataTable font size */
    .tailwind-datatable table {
        font-size: 12px !important;
    }

    .tailwind-datatable thead th {
        padding: 10px !important;
        font-size: 11px !important;
    }

    .tailwind-datatable tbody td {
        padding: 10px !important;
    }

    /* Tab buttons */
    .tab-status a {
        padding: 0.5rem 0.75rem !important;
    }

    .tab-status a span.text-xs,
    .tab-status a span.text-sm {
        font-size: 11px !important;
    }

    /* Form inputs */
    input, select, textarea {
        font-size: 14px !important;
    }

    /* Buttons */
    button, .btn {
        font-size: 14px !important;
    }

    /* Order summary card */
    #total-price-display {
        font-size: 1.5rem !important;
    }
}

/* ============================================
   Animation Utilities
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-in-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

/* ============================================
   Utility Classes
   ============================================ */
.transition-all-300 {
    transition: all 300ms ease-in-out;
}

.shadow-hover:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.shadow-soft {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.dark .shadow-soft {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Dark Mode Toggle Smooth Transition
   ============================================ */
* {
    transition-property: background-color, border-color, color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Exclude transitions for specific elements to avoid performance issues */
.no-transition,
.no-transition * {
    transition: none !important;
}

/* ============================================
   Z-Index Management
   ============================================ */
.z-sidebar {
    z-index: 30;
}

.z-overlay {
    z-index: 40;
}

.z-modal {
    z-index: 50;
}

.z-tooltip {
    z-index: 60;
}

/* ============================================
   DataTable Custom Styling for Tailwind
   ============================================ */

/* Custom scrollbar for DataTable */
.custom-scrollbar::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #4b5563;
}

/* Base DataTable Styling */
.tailwind-datatable table {
    width: 100%;
    font-size: 13px;
    text-align: left;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.dark .tailwind-datatable table {
    border-color: #374151;
}

.tailwind-datatable thead {
    font-size: 0.75rem;
    text-transform: uppercase;
    background-color: #f9fafb;
}

.dark .tailwind-datatable thead {
    background-color: rgba(31, 41, 55, 0.5);
}

.tailwind-datatable thead th {
    padding: 15px !important;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}

.tailwind-datatable thead th:last-child {
    border-right: none;
}

.dark .tailwind-datatable thead th {
    color: #9ca3af;
    border-bottom-color: #374151;
    border-right-color: #374151;
}

.tailwind-datatable tbody tr {
    background-color: #ffffff;
    transition: background-color 0.15s ease-in-out;
}

.dark .tailwind-datatable tbody tr {
    background-color: var(--surface-dark, #1f2937);
}

.tailwind-datatable tbody tr:hover {
    background-color: #f9fafb;
}

.dark .tailwind-datatable tbody tr:hover {
    background-color: rgba(55, 65, 81, 0.5);
}

.tailwind-datatable tbody td {
    padding: 15px !important;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}

.tailwind-datatable tbody td:last-child {
    border-right: none;
}

.tailwind-datatable tbody tr:last-child td {
    border-bottom: none;
}

.dark .tailwind-datatable tbody td {
    color: #e5e7eb;
    border-bottom-color: #374151;
    border-right-color: #374151;
}

/* DataTable Wrapper */
.dataTables_wrapper {
    width: 100%;
}

/* DataTable Controls - Search & Length */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.dark .dataTables_wrapper .dataTables_length label,
.dark .dataTables_wrapper .dataTables_filter label {
    color: #d1d5db;
}

.dataTables_wrapper .dataTables_length select {
    padding: 0.5rem 0.75rem;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.15s ease-in-out;
}

.dark .dataTables_wrapper .dataTables_length select {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--primary, #10b981);
    border-color: var(--primary, #10b981);
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.5rem 1rem;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-left: 0.5rem;
    color: #374151;
    transition: all 0.15s ease-in-out;
}

.dark .dataTables_wrapper .dataTables_filter input {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--primary, #10b981);
    border-color: var(--primary, #10b981);
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Mobile pagination - scroll horizontal */
@media (max-width: 640px) {
    .dataTables_wrapper .dataTables_paginate {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-block;
    min-width: 36px;
    padding: 8px 12px;
    text-align: center;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    line-height: 1;
    flex-shrink: 0;
}

/* Mobile pagination buttons - smaller */
@media (max-width: 640px) {
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        min-width: 32px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

.dark .dataTables_wrapper .dataTables_paginate .paginate_button {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

.dark .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #374151;
    border-color: #6b7280;
    color: #f9fafb;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #10b981;
    color: #ffffff;
    border-color: #10b981;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: #059669;
    border-color: #059669;
    color: #ffffff;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background-color: #ffffff;
    border-color: #d1d5db;
    color: #374151;
}

.dark .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}

/* Previous and Next buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next {
    font-weight: 500;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
    margin-top: 1rem;
    font-size: 13px !important;
    color: #6b7280;
}

.dark .dataTables_wrapper .dataTables_info {
    color: #9ca3af;
}

/* DataTable filter */
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 10px !important;
}

/* Processing indicator */
.dataTables_wrapper .dataTables_processing {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

div.dataTables_processing > div:last-child > div {
    background-color: #ffc107 !important;
    width: 10px !important;
    height: 10px !important;
}

/* Sorting icons - remove default DataTables icons */
table.dataTable thead > tr > th.sorting:before,
table.dataTable thead > tr > th.sorting:after,
table.dataTable thead > tr > th.sorting_asc:before,
table.dataTable thead > tr > th.sorting_asc:after,
table.dataTable thead > tr > th.sorting_desc:before,
table.dataTable thead > tr > th.sorting_desc:after,
.tailwind-datatable thead th.sorting:before,
.tailwind-datatable thead th.sorting:after,
.tailwind-datatable thead th.sorting_asc:before,
.tailwind-datatable thead th.sorting_asc:after,
.tailwind-datatable thead th.sorting_desc:before,
.tailwind-datatable thead th.sorting_desc:after {
    content: '';
    display: none;
}

/* Custom sorting icons */
.tailwind-datatable thead th.sorting,
.tailwind-datatable thead th.sorting_asc,
.tailwind-datatable thead th.sorting_desc,
table.dataTable thead > tr > th.sorting,
table.dataTable thead > tr > th.sorting_asc,
table.dataTable thead > tr > th.sorting_desc {
    position: relative;
    padding-right: 28px !important;
    cursor: pointer;
    user-select: none;
}

.tailwind-datatable thead th.sorting:after,
table.dataTable thead > tr > th.sorting:after {
    content: '⬍' !important;
    display: inline-block !important;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #a78bfa;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.tailwind-datatable thead th.sorting:hover:after,
table.dataTable thead > tr > th.sorting:hover:after {
    opacity: 1;
    color: #8b5cf6;
}

.dark .tailwind-datatable thead th.sorting:after,
.dark table.dataTable thead > tr > th.sorting:after {
    color: #c4b5fd;
    opacity: 0.4;
}

.dark .tailwind-datatable thead th.sorting:hover:after,
.dark table.dataTable thead > tr > th.sorting:hover:after {
    opacity: 1;
    color: #a78bfa;
}

.tailwind-datatable thead th.sorting_asc:after,
table.dataTable thead > tr > th.sorting_asc:after {
    content: '▲' !important;
    display: inline-block !important;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #8b5cf6;
    text-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
    opacity: 1;
}

.tailwind-datatable thead th.sorting_desc:after,
table.dataTable thead > tr > th.sorting_desc:after {
    content: '▼' !important;
    display: inline-block !important;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #ec4899;
    text-shadow: 0 0 8px rgba(236, 72, 153, 0.5);
    opacity: 1;
}

/* Empty state */
.dataTables_empty {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.dark .dataTables_empty {
    color: #9ca3af;
}

/* DataTable Badge Styling */
.tailwind-datatable td span.inline-flex {
    border-radius: 5px !important;
    padding: 8px !important;
}

.feed-content strong {
    color: #92400e !important;
}

.feed-content p {
    color: #0f172a !important;
    margin-bottom: 5px !important;
    margin-top: 10px !important;
}

.feed-content img {
    display: flex;
    justify-content: center;
    width: 50%;
}

/* ============================================
   DataTable Action Buttons
   ============================================ */
.tailwind-datatable .btn-cancel,
.tailwind-datatable button[id="cancel"] {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background-color: #dc2626;
    color: #ffffff;
    transition: background-color 0.15s ease-in-out;
    border: none;
    cursor: pointer;
}

.tailwind-datatable .btn-cancel:hover,
.tailwind-datatable button[id="cancel"]:hover {
    background-color: #b91c1c;
}

.tailwind-datatable .btn-refill,
.tailwind-datatable button[id="refill"] {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background-color: #2563eb;
    color: #ffffff;
    transition: background-color 0.15s ease-in-out;
    border: none;
    cursor: pointer;
}

.tailwind-datatable .btn-refill:hover,
.tailwind-datatable button[id="refill"]:hover {
    background-color: #1d4ed8;
}

.tailwind-datatable .btn-refund,
.tailwind-datatable button[id="refund"] {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background-color: #7c3aed;
    color: #ffffff;
    transition: background-color 0.15s ease-in-out;
    border: none;
    cursor: pointer;
}

.tailwind-datatable .btn-refund:hover,
.tailwind-datatable button[id="refund"]:hover {
    background-color: #6d28d9;
}

.tailwind-datatable > .table-responsive {
    overflow-x: auto !important;
}

div.dataTables_wrapper div.dataTables_paginate ul.pagination {
    display: flex !important;
    gap: 5px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.active {
    background: rgb(38 155 146 / var(--tw-bg-opacity, 1)) !important;
    color: #fff !important;
}