/* Blazor system styles - essential for application functionality */
/* All other styling will use Tailwind classes */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Page Header Styles */
.page-header {
    padding: 1.5rem 2rem;
    background: #FDFDFF;
    margin-bottom: 2rem;
}

.page-header-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.page-header-back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

    .page-header-back-button:hover {
        color: #1D0C67;
        background: #f8fafc;
        border-color: #e2e8f0;
    }

.page-header-title-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.page-header-icon {
    font-size: 1.5rem;
    color: #1D0C67;
}

.page-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.page-header-badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

    .page-header-badge.badge-default {
        background: #f1f5f9;
        color: #64748b;
    }

    .page-header-badge.badge-success {
        background: #dcfce7;
        color: #16a34a;
    }

    .page-header-badge.badge-warning {
        background: #fed7aa;
        color: #ea580c;
    }

    .page-header-badge.badge-error {
        background: #fee2e2;
        color: #dc2626;
    }

.page-header-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-left: 0.5rem;
}

.page-header-actions {
    display: flex;
    gap: 0.75rem;
}

.page-header-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.breadcrumb-link {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

    .breadcrumb-link:hover {
        color: #1D0C67;
    }

.breadcrumb-separator {
    color: #cbd5e0;
}

.breadcrumb-current {
    color: #1a202c;
    font-weight: 500;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .page-header {
        background: #1a202c;
        border-color: #2d3748;
    }

    .page-header-title {
        color: #f7fafc;
    }

    .page-header-back-button:hover {
        background: #2d3748;
        border-color: #4a5568;
    }
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Data Table Layout Styles */
.data-table-layout {
    background: #FDFDFF;
    min-height: 100vh;
    padding: 24px;
    transition: background-color 0.2s, color 0.2s;
}

.dark .data-table-layout {
    background: #111827;
}

/* Expanded Data Table Layout */
.data-table-layout.expanded {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    padding: 8px;
    background: #ffffff;
    overflow: auto;
    transition: all 0.3s ease;
}

.dark .data-table-layout.expanded {
    background: #111827;
}

/* Hide sidebar when expanded */
.data-table-layout.expanded ~ .sidebar {
    display: none;
}

/* Adjust expanded table content */
.data-table-layout.expanded .table-header {
    margin-bottom: 12px;
}

.data-table-layout.expanded .table-title {
    font-size: 32px;
}

.data-table-layout.expanded .table-container {
    max-height: calc(100vh - 200px);
    overflow: auto;
}

/* Header Section */
.table-header {
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    transition: color 0.2s;
}

.dark .table-title {
    color: #f3f4f6;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.primary-background-color {
    background-color: var(--primary-color, #1D0C67);
    color: white;
}
.primary-color{
    color: var(--primary-color, #1D0C67);
}
.border-primary {
    border-color: var(--primary-color, #1D0C67) !important;
}
/* Primary Action Button */
.primary-action-btn {
    background: var(--primary-color, #1D0C67);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

    .primary-action-btn:hover {
        background: var(--primary-color-dark, #150A55);
        color: white;
    }

/* Branding-aware button styles */
.btn-primary-action {
    background-color: var(--primary-color, #1D0C67) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    transition: background-color 0.2s !important;
    text-decoration: none !important;
}

    .btn-primary-action:hover {
        background-color: var(--primary-color-dark, #150A55) !important;
        color: white !important;
        text-decoration: none !important;
    }

/* Settings form button - wider and taller */
.btn-primary-form {
    background-color: var(--primary-color, #1D0C67) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: background-color 0.2s !important;
    text-decoration: none !important;
    min-width: 200px !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

    .btn-primary-form:hover {
        background-color: var(--primary-color-dark, #150A55) !important;
        color: white !important;
        text-decoration: none !important;
    }

    .btn-primary-form:disabled {
        opacity: 0.5 !important;
        cursor: not-allowed !important;
    }

/* Secondary action button */
.btn-secondary-action {
    background-color: var(--secondary-color, #33C6E4) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    transition: background-color 0.2s !important;
    text-decoration: none !important;
}

    .btn-secondary-action:hover {
        background-color: var(--secondary-color-dark, #2BA8C7) !important;
        color: white !important;
        text-decoration: none !important;
    }

/* Checkbox with branding colors */
.checkbox-primary {
    accent-color: var(--primary-color, #1D0C67) !important;
}

.dark .primary-action-btn {
    background: var(--primary-color, #1D0C67);
}

    .dark .primary-action-btn:hover {
        background: #6d28d9;
    }

/* Filter Button */
.filter-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.dark .filter-btn {
    border-color: #4b5563;
    color: #d1d5db;
}

.filter-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.dark .filter-btn:hover {
    background: #374151;
    border-color: #6b7280;
}

/* Toolbar */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toolbar-right {
    display: flex;
    align-items: center;
}

/* Card container for toolbar + table (Figma-like) */
.table-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    overflow: hidden;
    /* ensures rounded corners clip children (table, toolbar) */
}

.dark .table-card {
    background: #111827;
    border-color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Toolbar row inside card */
.table-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.dark .table-toolbar-row {
    background: #111827;
    border-bottom-color: #374151;
}

/* Optional filters panel just under toolbar, subtle background */
.filters-panel {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.dark .filters-panel {
    background: #1f2937;
    border-bottom-color: #374151;
}

/* When table-container is inside the card, remove its borders so the card provides the chrome */
.table-card .table-container {
    border: 0;
    border-radius: 0;
}

/* Settings Button */
.settings-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s;
}

    .settings-btn:hover {
        background: #f3f4f6;
        color: #374151;
    }

/* Search Container */
.search-container {
    position: relative;
    width: 240px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    font-size: 14px;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #ffffff;
    color: #374151;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.dark .search-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #1D0C67);
    box-shadow: 0 0 0 1px var(--primary-color, #1D0C67);
}

.dark .search-input:focus {
    border-color: var(--primary-color, #1D0C67);
    box-shadow: 0 0 0 1px var(--primary-color, #1D0C67);
}

.search-input::placeholder {
    color: #9ca3af;
}

.dark .search-input::placeholder {
    color: #6b7280;
}

/* Toolbar Actions */
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.row-count {
    font-size: 14px;
    color: #6b7280;
    margin-right: 8px;
    transition: color 0.2s;
}

.dark .row-count {
    color: #9ca3af;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s;
    cursor: pointer;
}

    .btn-icon:hover:not(:disabled) {
        background: #f3f4f6;
        color: #374151;
    }

.dark .btn-icon {
    color: #9ca3af;
}

    .dark .btn-icon:hover:not(:disabled) {
        background: #374151;
        color: #d1d5db;
    }

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Table Container */
.table-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    transition: background-color 0.2s, border-color 0.2s;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

    .table-container::-webkit-scrollbar {
        height: 8px;
    }

    .table-container::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 4px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
        transition: background-color 0.2s;
    }

        .table-container::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

.dark .table-container {
    background: #1f2937;
    border-color: #374151;
    scrollbar-color: #4b5563 #374151;
}

    /* Dark theme scrollbar for webkit browsers */
    .dark .table-container::-webkit-scrollbar-track {
        background: #374151;
    }

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

        .dark .table-container::-webkit-scrollbar-thumb:hover {
            background: #6b7280;
        }

/* Table Wrapper */
.table-wrapper {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    min-width: max-content;
}

.table-header-cell,
.table-cell {
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Custom scrollbar for table wrapper */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.dark .table-wrapper::-webkit-scrollbar-track {
    background: #374151;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dark .table-wrapper::-webkit-scrollbar-thumb {
    background: #6b7280;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Scroll indicator */
.scroll-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #64748b;
}

.dark .scroll-indicator {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

.scroll-indicator i {
    color: #3b82f6;
}

.dark .scroll-indicator i {
    color: #2A1A75;
}

/* Legacy Data Table Support - Consolidated with Figma styles */
.data-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    min-width: max-content;
    background: #ffffff;
}

.dark .data-table {
    background: #1f2937;
}

.data-table thead {
    background: #f9fafb;
    transition: background-color 0.2s;
}

.dark .data-table thead {
    background: #374151;
}

.table-header-cell {
    padding: 12px 16px;
    font-weight: 500;
    font-size: 14px;
    color: #374151;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .table-header-cell {
    color: #d1d5db;
    border-bottom-color: #4b5563;
}

.table-header-cell.sortable {
    cursor: pointer;
    user-select: none;
}

    .table-header-cell.sortable:hover {
        background: #f3f4f6;
    }

.dark .table-header-cell.sortable:hover {
    background: #4b5563;
}

.sort-indicator {
    margin-left: 4px;
    font-size: 12px;
    color: #6b7280;
    transition: color 0.2s;
}

.dark .sort-indicator {
    color: #9ca3af;
}

.table-row {
    transition: background-color 0.2s;
    background: #ffffff !important;
}

.dark .table-row {
    background: #1f2937 !important;
}

.table-row:hover {
    background: #f9fafb !important;
}

.dark .table-row:hover {
    background: #374151 !important;
}

.table-cell {
    padding: 12px 16px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    transition: color 0.2s, border-color 0.2s;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dark .table-cell {
    color: #d1d5db;
    border-bottom-color: #374151;
}

.actions-column {
    width: 80px;
    text-align: center;
}

.actions-cell {
    text-align: center;
}

.actions-menu-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    color: #6b7280;
    transition: all 0.2s;
}

    .actions-menu-btn:hover {
        background: #f3f4f6;
        color: #374151;
    }

.dark .actions-menu-btn {
    color: #9ca3af;
}

    .dark .actions-menu-btn:hover {
        background: #374151;
        color: #d1d5db;
    }

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-pending .status-dot {
    background: #f59e0b;
}

.status-completed .status-dot {
    background: #10b981;
}

.status-cancelled .status-dot {
    background: #ef4444;
}

/* Amount Values */
.amount-value {
    font-weight: 500;
    color: #374151;
}

/* Dropdown Menu Styles - Enhanced for Better Positioning */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    display: none !important;
    min-width: 160px;
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 4px 0;
    margin-top: 4px;
    transition: all 0.2s;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
}

    .dropdown-menu.show {
        display: block !important;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

/* Smart positioning for dropdowns in table rows */
.figma-table-row:nth-last-child(-n+3) .dropdown-menu,
.table-row:nth-last-child(-n+3) .dropdown-menu {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
    transform: translateY(10px);
}

    .figma-table-row:nth-last-child(-n+3) .dropdown-menu.show,
    .table-row:nth-last-child(-n+3) .dropdown-menu.show {
        transform: translateY(0);
    }

/* Ensure dropdown stays within viewport - moved to main dropdown-menu selector to avoid duplication */

/* Enhanced positioning for small tables (less than 5 rows) */
.figma-table tbody:has(tr:nth-child(-n+5)) .figma-table-row:nth-last-child(-n+2) .dropdown-menu,
.data-table tbody:has(tr:nth-child(-n+5)) .table-row:nth-last-child(-n+2) .dropdown-menu {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
    transform: translateY(10px);
}

    .figma-table tbody:has(tr:nth-child(-n+5)) .figma-table-row:nth-last-child(-n+2) .dropdown-menu.show,
    .data-table tbody:has(tr:nth-child(-n+5)) .table-row:nth-last-child(-n+2) .dropdown-menu.show {
        transform: translateY(0);
    }

.dark .dropdown-menu {
    background: #374151;
    border-color: #4b5563;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.dropdown-item {
    padding: 8px 16px;
    font-size: 14px;
    color: #374151;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.dark .dropdown-item {
    color: #d1d5db;
}

.dropdown-item:hover:not(:disabled) {
    background: #f3f4f6;
    color: #374151;
}

.dark .dropdown-item:hover:not(:disabled) {
    background: #4b5563;
    color: #f3f4f6;
}

.dropdown-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dropdown-item.text-danger {
    color: #dc2626;
}

.dark .dropdown-item.text-danger {
    color: #f87171;
}

.dropdown-item.text-danger:hover:not(:disabled) {
    background: #fef2f2;
    color: #dc2626;
}

.dark .dropdown-item.text-danger:hover:not(:disabled) {
    background: #7f1d1d;
    color: #f87171;
}

/* Sidebar Dropdown Styles */
.sidebar-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    position: relative;
    transition: all 0.2s ease;
}

    .dropdown-toggle.sidebar-link {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
    }

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
    color: #6b7280;
}

.dropdown-toggle.open .dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    background: rgba(0, 0, 0, 0.05);
    border-left: 2px solid #1D0C67;
    margin-left: 20px;
    padding-left: 8px;
    margin-top: 4px;
    animation: slideDown 0.2s ease-out;
}

.dark .sidebar-submenu {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #1D0C67;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #6b7280;
    text-decoration: none;
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
}

    .sidebar-sublink:hover {
        background: rgba(29, 12, 103, 0.1);
        color: #1D0C67;
        text-decoration: none;
    }

.dark .sidebar-toggle img {
    filter: brightness(0) invert(1);
}

.dark .btn-icon img {
    filter: brightness(0) invert(1);
}

/* Force header background in dark mode */
.dark .header {
    background-color: #1f2937 !important;
    background: #1f2937 !important;
}

.dark header {
    background-color: #1f2937 !important;
    background: #1f2937 !important;
}

    /* Force header title text color in dark mode */
    .dark header h1 {
        color: #ffffff !important;
    }

.dark .header h1 {
    color: #ffffff !important;
}

.dark h1.text-xl {
    color: #ffffff !important;
}

/* Nuclear option - override all h1 in dark mode */
.dark h1 {
    color: #ffffff !important;
}

/* Override Tailwind classes specifically */
.dark .text-gray-900 {
    color: #ffffff !important;
}

/* Force dropdown menu background in dark mode */
.dark .dropdown-menu {
    background-color: #1f2937 !important;
    background: #1f2937 !important;
}

/* Settings components dark mode text colors - more specific selectors */
.dark main h2 {
    color: #ffffff !important;
}

/* Remove padding from main content to eliminate gap */
main {
    padding: 0 !important;
}

/* Add padding back to content inside main */
.data-table-layout,
.settings-container,
.page-content {
    padding: 1rem !important;
}

/* Fix create pages background in dark mode */
.dark .min-h-screen {
    background-color: #1f2937 !important;
}

.dark .bg-white {
    background-color: #374151 !important;
}

.dark .bg-gray-50 {
    background-color: #1f2937 !important;
}

/* Fix text colors in create pages for dark mode */
.dark .text-gray-900 {
    color: #f3f4f6 !important;
}

.dark .text-gray-700 {
    color: #d1d5db !important;
}

.dark .text-black {
    color: #ffffff !important;
}

/* Fix borders in dark mode */
.dark .border-gray-200 {
    border-color: #4b5563 !important;
}

.dark .border-gray-300 {
    border-color: #6b7280 !important;
}

.dark .border-gray-100 {
    border-color: #374151 !important;
}

/* Fix input fields in dark mode */
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark input[type="date"],
.dark input[type="time"],
.dark select,
.dark textarea {
    background-color: #374151 !important;
    border-color: #6b7280 !important;
    color: #f3f4f6 !important;
}

    .dark input[type="text"]:focus,
    .dark input[type="email"]:focus,
    .dark input[type="password"]:focus,
    .dark input[type="number"]:focus,
    .dark input[type="date"]:focus,
    .dark input[type="time"]:focus,
    .dark select:focus,
    .dark textarea:focus {
        border-color: var(--primary-color, #1D0C67) !important;
        background-color: #374151 !important;
    }

/* Fix column configuration modal styling */
.dark .column-config-dropdown {
    background: #374151 !important;
    border-color: #4b5563 !important;
}

.dark .dropdown-header {
    background-color: #4b5563 !important;
    border-bottom-color: #6b7280 !important;
}

.dark .dropdown-title {
    color: #f3f4f6 !important;
}

.dark .dropdown-footer {
    background-color: #4b5563 !important;
    border-top-color: #6b7280 !important;
}

.dark .columns-list {
    background-color: #374151 !important;
}

.dark .column-row {
    background-color: #374151 !important;
    border-bottom-color: #4b5563 !important;
}

    .dark .column-row:hover {
        background-color: #4b5563 !important;
    }

.dark .form-check-label {
    color: #f3f4f6 !important;
}

.dark .dot {
    background-color: #9ca3af !important;
}

.dark .drag-handle:hover .dot {
    background-color: #d1d5db !important;
}

/* Fix settings button styling in light mode */
.settings-btn {
    background-color: #f9fafb !important;
    border-color: #d1d5db !important;
    color: #374151 !important;
}

    .settings-btn:hover {
        background-color: #f3f4f6 !important;
        border-color: #9ca3af !important;
    }

    .settings-btn img {
        filter: none !important;
        opacity: 0.7 !important;
    }

    .settings-btn:hover img {
        opacity: 1 !important;
    }

/* Dark mode settings button */
.dark .settings-btn {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
}

    .dark .settings-btn:hover {
        background-color: #4b5563 !important;
        border-color: #6b7280 !important;
    }

    .dark .settings-btn img {
        filter: brightness(0) invert(1) !important;
    }

/* Fix checkbox colors to use primary color */
input[type="checkbox"]:checked {
    background-color: var(--primary-color, #1D0C67) !important;
    border-color: var(--primary-color, #1D0C67) !important;
}

input[type="checkbox"]:focus {
    border-color: var(--primary-color, #1D0C67) !important;
    box-shadow: 0 0 0 0.25rem rgba(29, 12, 103, 0.25) !important;
}

.form-check-input:checked {
    background-color: var(--primary-color, #1D0C67) !important;
    border-color: var(--primary-color, #1D0C67) !important;
}

.form-check-input:focus {
    border-color: var(--primary-color, #1D0C67) !important;
    box-shadow: 0 0 0 0.25rem rgba(29, 12, 103, 0.25) !important;
}

.dark main p {
    color: #d1d5db !important;
}

.dark main label {
    color: #ffffff !important;
}

.dark main span:not(.text-gray-900):not(.dark\:text-white) {
    color: #d1d5db !important;
}

.dark .sidebar-sublink:hover {
    background: rgba(29, 12, 103, 0.1);
    color: #2A1A75;
}

.sidebar-sublink.active {
    background: #1D0C67;
    color: white;
}

.dark .sidebar-sublink.active {
    background: #1D0C67;
    color: white;
}

/* Collapsed sidebar adjustments */
.sidebar.collapsed .sidebar-submenu {
    display: none;
}

.sidebar.collapsed .dropdown-arrow {
    display: block;
    transform: rotate(90deg);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Drag and Drop Column Reordering Styles */
.column-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.drag-handle {
    opacity: 0;
    cursor: grab;
    color: #9ca3af;
    font-size: 12px;
    transition: opacity 0.2s;
    padding: 2px;
}

.table-header-cell:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.column-title {
    flex: 1;
}

/* Dragging state */
.table-header-cell.dragging {
    opacity: 0.5;
    background: #f3f4f6 !important;
    transform: scale(0.98);
    transition: all 0.2s;
}

.dark .table-header-cell.dragging {
    background: #4b5563 !important;
}

/* Drag over state */
.table-header-cell.drag-over {
    background: #dbeafe !important;
    border-left: 3px solid #1D0C67;
    transform: translateX(2px);
    transition: all 0.2s;
}

.dark .table-header-cell.drag-over {
    background: #1e3a8a !important;
    border-left-color: #3b82f6;
}

/* Prevent text selection during drag */
.table-header-cell[draggable="true"] {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Enhanced visual feedback for sortable columns with drag handles */
.table-header-cell.sortable .column-title {
    cursor: pointer;
}

.table-header-cell.sortable:hover .column-title {
    color: #1D0C67;
}

.dark .table-header-cell.sortable:hover .column-title {
    color: #3b82f6;
}

/* ========================== */
/* Form Validation Styles     */
/* ========================== */

/* Invalid input field styling */
.validation-error,
input.invalid,
select.invalid,
textarea.invalid,
.invalid-field {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.dark .validation-error,
.dark input.invalid,
.dark select.invalid,
.dark textarea.invalid,
.dark .invalid-field {
    border-color: #dc2626 !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* Focus state for invalid fields */
input.invalid:focus,
select.invalid:focus,
textarea.invalid:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    border-color: #dc2626 !important;
}

.dark input.invalid:focus,
.dark select.invalid:focus,
.dark textarea.invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

/* Validation message styling */
.validation-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.dark .validation-message {
    color: #ef4444;
}

/* Validation summary styling */
.validation-summary-errors {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.dark .validation-summary-errors {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: #dc2626;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #dc2626;
}

.dark .validation-summary-errors ul {
    color: #ef4444;
}

/* Required field indicator */
.required-field::after {
    content: " *";
    color: #dc2626;
}

.dark .required-field::after {
    color: #ef4444;
}

/* Valid field indicator (optional) */
.valid-field {
    border-color: #10b981 !important;
}

.dark .valid-field {
    border-color: #059669 !important;
}
