/* Projects Section - Metronic Style */
.projects-section {
    grid-column: 1 / span 12;
    align-self: start;
}

/* Card Styling */
.card-flush {
    box-shadow: none;
    border: none;
}

.card-header .card-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

    .card-header .card-title h2.card-title {
        font-weight: 600;
        font-size: 1.275rem;
        color: #181c32;
        margin: 0;
        width: 100%;
    }

    .card-header .card-title .text-muted {
        font-size: 0.95rem;
        color: #64748b !important;
        margin-top: 0.25rem;
        display: block;
        width: 100%;
        margin-left: 2px;
    }

    [data-theme="dark"] .card-header .card-title .text-muted {
        color: #99A1B7 !important;
    }
    


.card-subtitle {
    font-size: 0.95rem;
    color: #a1a5b7;
    margin-top: 0.25rem;
    display: block; /* Ensure it's on its own line */
}

.card-body {
    padding: 2.25rem;
}

/* Search Input Styling */
.search-wrapper {
    position: relative;
    width: 250px;
}

    .search-wrapper .form-control {
        padding-left: 2.5rem;
        background-color: #f5f8fa;
        border: 1px solid #767676;
        color: #5e6278;
        transition: background-color 0.2s ease;
    }

        .search-wrapper .form-control:focus {
            background-color: #eef3f7;
            box-shadow: none;
        }

        .search-wrapper .form-control::placeholder {
            color: #6b7280;
        }

    .search-wrapper .search-icon {
        position: absolute;
        left: 13px;
        top: 50%;
        transform: translateY(-50%);
        color: #a1a5b7;
    }

#projectTypeFilter {
    background-color: #f5f8fa;
    border: 1px solid #767676;
    color: #5e6278;
    font-size: 0.925rem;
    padding: 0.55rem 2.5rem 0.55rem 1rem;
    border-radius: 0.475rem;
    transition: background-color 0.2s ease;
}

    #projectTypeFilter:focus {
        background-color: #eef3f7;
        box-shadow: none;
    }

/* Visible keyboard focus on the search box and type filter */
.search-wrapper .form-control:focus-visible,
#projectTypeFilter:focus-visible {
    outline: 2px solid var(--phs-accent-link);
    outline-offset: 1px;
}

[data-theme="dark"] #projectTypeFilter {
    background-color: #1e1e2e;
    color: #92929f;
    border-color: #8a8a9e;
}

    [data-theme="dark"] #projectTypeFilter:focus {
        background-color: #2b2b40;
    }

/* Table Styling */
#projectsTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.925rem;
}

    #projectsTable thead th {
        background-color: #f5f8fa !important;
        color: #5e6278 !important;
        font-weight: 600 !important;
        font-size: 0.85rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px;
        padding: 1rem 1rem !important;
        border: none !important;
        text-align: left !important;
    }

        #projectsTable thead th:first-child {
            border-top-left-radius: 0.475rem;
        }

        #projectsTable thead th:last-child {
            border-top-right-radius: 0.475rem;
        }

    #projectsTable tbody tr {
        background-color: #ffffff;
        transition: background-color 0.15s ease;
    }

        #projectsTable tbody tr:hover {
            background-color: #f5f8fa;
        }

    #projectsTable tbody td {
        padding: 1rem 1rem !important;
        color: #5e6278;
        font-size: 0.95rem;
        border-top: 1px solid #eff2f5;
        vertical-align: middle;
        text-align: left !important;
    }

        #projectsTable tbody td:first-child {
            font-weight: 600;
            color: #181c32;
        }

        /* Link Styling */
        #projectsTable tbody td a {
            color: #0072ce !important;
            text-decoration: none !important;
            font-weight: 600 !important;
            transition: color 0.2s ease;
        }

            #projectsTable tbody td a:hover {
                color: #005bb0 !important;
            }

/* DataTables Override Styling */
.dataTables_wrapper {
    padding: 0;
}

    .dataTables_wrapper .dataTables_filter {
        display: none; /* Hide default search since we have custom */
    }

    .dataTables_wrapper .dataTables_length {
        display: none; /* Hide length selector */
    }

    .dataTables_wrapper .dataTables_info {
        color: #a1a5b7;
        font-size: 0.875rem;
        padding: 1rem 0;
    }

    /* Pagination Styling - Updated for circular page numbers */
    .dataTables_wrapper .dataTables_paginate {
        padding: 1rem 0;
    }

        .dataTables_wrapper .dataTables_paginate .pagination {
            margin: 0;
            gap: 0.25rem;
            display: flex;
            align-items: center;
        }

        .dataTables_wrapper .dataTables_paginate .page-item {
            margin: 0 2px;
        }

        /* Page number links - circular style */
        .dataTables_wrapper .dataTables_paginate .page-link {
            padding: 0;
            width: 32px;
            height: 32px;
            min-width: 32px;
            border: none;
            border-radius: 50%; /* Makes it circular */
            color: #5e6278;
            background-color: transparent;
            font-weight: 500;
            font-size: 0.875rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--phs-transition);
            line-height: 1;
        }

            .dataTables_wrapper .dataTables_paginate .page-link:hover {
                background-color: #f5f8fa;
                color: #0072ce;
            }

        /* Active page - blue circular background */
        .dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
            background-color: #2563eb !important; /* Blue background matching your image */
            color: #ffffff !important;
            font-weight: 600;
            box-shadow: none;
        }

        .dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
            color: #b5b5c3;
            cursor: not-allowed;
            background-color: transparent;
            opacity: 0.5;
        }

        /* Previous/Next buttons - keep rectangular with icons */
        .dataTables_wrapper .dataTables_paginate .page-item.previous .page-link,
        .dataTables_wrapper .dataTables_paginate .page-item.next .page-link {
            width: auto;
            padding: 0 12px;
            border-radius: 0.375rem; /* Rectangular shape for prev/next */
            min-width: 32px;
            font-size: 0.875rem;
        }

        /* Icon styling for prev/next */
        .dataTables_wrapper .dataTables_paginate .previous .page-link i,
        .dataTables_wrapper .dataTables_paginate .next .page-link i {
            font-size: 0.875rem;
        }

        /* Mouse focus stays quiet; keyboard focus gets a visible ring */
        .dataTables_wrapper .dataTables_paginate .page-link:focus:not(:focus-visible) {
            box-shadow: none;
            outline: none;
        }

        .dataTables_wrapper .dataTables_paginate .page-link:focus-visible,
        #projectsTable_wrapper .dt-paging .page-link:focus-visible {
            outline: 2px solid var(--phs-accent-link);
            outline-offset: 2px;
            box-shadow: none;
        }

/* Dark Mode Styles */
[data-theme="dark"] .card-header {
    border-bottom-color: #2b2b40;
}

[data-theme="dark"] .card-title {
    color: #ffffff;
}

[data-theme="dark"] .card-subtitle {
    color: #9494a8;
}

[data-theme="dark"] .search-wrapper .form-control {
    background-color: #1e1e2e;
    color: #92929f;
    border-color: #8a8a9e;
}

    [data-theme="dark"] .search-wrapper .form-control:focus {
        background-color: #2b2b40;
    }

    [data-theme="dark"] .search-wrapper .form-control::placeholder {
        color: #99A1B7;
    }

[data-theme="dark"] #projectsTable thead th {
    background-color: #1e1e2e !important;
    color: #92929f !important;
}

[data-theme="dark"] #projectsTable tbody tr {
    background-color: #1a1a27;
}

    [data-theme="dark"] #projectsTable tbody tr:hover {
        background-color: #1e1e2e;
    }

[data-theme="dark"] #projectsTable tbody td {
    color: #92929f;
    border-top-color: #2b2b40;
}

    [data-theme="dark"] #projectsTable tbody td:first-child {
        color: #ffffff;
    }

    [data-theme="dark"] #projectsTable tbody td a {
        color: #3699ff !important;
    }

        [data-theme="dark"] #projectsTable tbody td a:hover {
            color: #187de4 !important;
        }

[data-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: #9494a8;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-link {
    color: #92929f;
}

    [data-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-link:hover {
        background-color: #1e1e2e;
        color: #3699ff;
    }

/* Keep blue active state in dark mode too */
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    color: #565674;
    opacity: 0.5;
}

/* DataTables Info and Pagination Row Layout */
.dataTables_wrapper .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin: 0;
}

.dataTables_wrapper .dt-info,
.dataTables_wrapper .dataTables_info {
    margin-bottom: 0 !important;
    display: inline-block;
}

.dataTables_wrapper .dt-paging,
.dataTables_wrapper .dataTables_paginate {
    margin-bottom: 0 !important;
    display: inline-block;
}

/* Alternative approach if dom config doesn't work */
.dt-container .dt-layout-row:last-child,
.dataTables_wrapper > div:last-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.dt-container .dt-info {
    flex: 0 0 auto;
    margin-right: auto;
}

.dt-container .dt-paging {
    flex: 0 0 auto;
}

/* Ensure consistent spacing for pagination */
.dt-paging.paging_simple_numbers {
    display: flex;
    align-items: center;
}
.dt-paging-button.page-item.active {
    background-color: #2563eb;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: .95rem;
    height: 2.5rem;
    min-width: 2.5rem;
    font-weight: 500;
    font-size: 1.075rem;
}
.dt-paging.paging_simple_numbers nav {
    width: 100%;
}

    .dt-paging.paging_simple_numbers .pagination {
        justify-content: flex-end;
    }

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1.5rem;
    }

    .search-wrapper {
        width: 100%;
        margin-bottom: 1rem;
    }

    #projectsTable {
        font-size: 0.875rem;
    }

        #projectsTable thead th,
        #projectsTable tbody td {
            padding: 0.75rem 0.5rem !important;
        }
}

@media (max-width: 576px) {
    .dataTables_wrapper .row,
    .dt-container .dt-layout-row:last-child {
        flex-direction: column;
        align-items: flex-start;
    }

    .dt-container .dt-info,
    .dt-container .dt-paging {
        width: 100%;
        text-align: center;
        margin: 0.5rem 0;
    }

    .dt-paging.paging_simple_numbers .pagination {
        justify-content: center;
    }
}


.btn-dark {
    background-color: #111827 !important;
    color: white !important;
    border: none;
    border-radius: 0.5rem;
}

    .btn-dark:hover {
        background-color: #1f2937 !important;
        color: #ffffff !important;
    }

[data-theme="dark"] .btn-dark {
    background-color: #374151 !important;
    color: #f9fafb !important;
}
