/* ===================================================================
   GridContainer.css - Global Grid Management Styling
   
   Purpose: Centralized CSS for all grid-based management pages
   Used by: ManageMovies/Index, ManageBooks/Index, Books, Movies, and future grid pages
   =================================================================== */

/* Page title styling */
h1 {
    color: #0d6efd;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Search input styling */
.search-container {     
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    padding: 0.5rem 1rem;
    border: 2px solid #b8d4f1;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

    .search-input:focus {
        outline: none;
        border-color: #0d6efd;
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    }

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

/* Genre filter dropdown styling */
.genre-filter {
    padding: 0.5rem 1rem;
    border: 2px solid #b8d4f1;
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 180px;
}

    .genre-filter:focus {
        outline: none;
        border-color: #0d6efd;
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    }

    .genre-filter:hover {
        border-color: #0d6efd;
    }

/* Create New button styling */
.create-new-container {
    margin-bottom: 1.5rem;
}

.btn-create {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    background-color: #198754;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

    .btn-create:hover {
        background-color: #157347;
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    }

    .btn-create:active {
        transform: translateY(0);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

/* QuickGrid container styling */
.grid-container {
    background-color: #f0f7ff;
    border: 2px solid #b8d4f1;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.1);
    overflow-x: auto;
}

/* Table styling */
.grid-container .table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: white;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Table header styling */
.grid-container .table thead {
    background-color: #0d6efd;
    color: white;
}

.grid-container .table thead th {
    padding: 1rem;
    font-weight: 600;
    border: none;
    text-align: left;
    vertical-align: middle;
}

/* Column width control */
/*.grid-container .table col:nth-child(1) {
    width: 15%;*/  /* or whatever width you prefer */
/*}*/

.grid-container .table col:nth-child(6) {
    width: 200px;
}

    .grid-container .table thead th:first-child {
        border-top-left-radius: 6px;
    }

    .grid-container .table thead th:last-child {
        border-top-right-radius: 6px;
    }

/* Sortable column styling - first column (Title) only */
/*.grid-container .table thead th:first-child[aria-sort] {
    cursor: pointer;
    user-select: none;
    color: white !important;
    text-decoration: underline;
    text-decoration-color: white;
    text-underline-offset: 3px;
}*/

    /*.grid-container .table thead th:first-child[aria-sort]:hover {
        background-color: #0b5ed7;
        color: white !important;
        text-decoration: underline;
    }*/

/* Also target by class name if col-title is being used */
/*.grid-container .table thead th.col-title[aria-sort] {
    cursor: pointer;
    user-select: none;
    color: white !important;
    text-decoration: underline;
    text-decoration-color: white;
    text-underline-offset: 3px;
}*/

    /*.grid-container .table thead th.col-title[aria-sort]:hover {
        background-color: #0b5ed7;
        color: white !important;
        text-decoration: underline;
    }*/

/* Other sortable columns (default styling) */
.grid-container .table thead th[aria-sort] {
    cursor: pointer;
    user-select: none;
}

/* Table body styling with alternating row colors */
.grid-container .table tbody tr {
    height: 3em;
    transition: background-color 0.2s ease;
}

    /* White rows (odd rows) */
    .grid-container .table tbody tr:nth-child(odd) {
        background-color: white;
    }

    /* Light grey rows (even rows) */
    .grid-container .table tbody tr:nth-child(even) {
        background-color: #f8f9fa;
    }

    /* Hover effect */
    .grid-container .table tbody tr:hover {
        background-color: #e7f1ff;
    }

/* Table cell styling */
.grid-container .table tbody td {
    padding: 0.875rem 1rem;
    border: none;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

    .grid-container .table tbody tr:last-child td {
        border-bottom: none;
    }

/* Action buttons styling */
.grid-container .table .btn {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 0 0.15rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Primary button (Details) */
.grid-container .table .btn-primary {
    background-color: #0d6efd;
    color: white;
}

    .grid-container .table .btn-primary:hover {
        background-color: #0b5ed7;
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
    }

    .grid-container .table .btn-primary:active {
        background-color: #0a58ca;
        transform: translateY(0);
    }

/* Secondary button (Edit) */
.grid-container .table .btn-secondary {
    background-color: #6c757d;
    color: white;
}

    .grid-container .table .btn-secondary:hover {
        background-color: #5c636a;
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
    }

    .grid-container .table .btn-secondary:active {
        background-color: #565e64;
        transform: translateY(0);
    }

/* Danger button (Delete) */
.grid-container .table .btn-danger {
    background-color: #dc3545;
    color: white;
}

    .grid-container .table .btn-danger:hover {
        background-color: #bb2d3b;
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
    }

    .grid-container .table .btn-danger:active {
        background-color: #b02a37;
        transform: translateY(0);
    }

/* Paginator styling */
.grid-container .paginator {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* Empty state styling */
.grid-container .table tbody tr td[colspan] {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 2rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input,
    .genre-filter {
        max-width: 100%;
        width: 100%;
    }

    .grid-container {
        padding: 1rem;
    }

    .grid-container .table thead th,
    .grid-container .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }

    /* Stack buttons vertically on small screens */
    .grid-container .table .btn {
        display: block;
        margin: 0.25rem 0;
        width: 100%;
    }
}

/* ===================================================================
   QuickGrid Sortable Column Override
   HIGH SPECIFICITY - Must override Blazor QuickGrid styles
   =================================================================== */

/* Sortable columns with col-sort class - make text white */
.grid-container .table thead th.col-sort[aria-sort],
.grid-container .table thead th.col-sort[aria-sort] a,
.grid-container .table thead th.col-sort[aria-sort] button,
.grid-container .table thead th.col-sort[aria-sort] span {
    color: white !important;
    text-decoration: underline;
    text-decoration-color: white;
    text-underline-offset: 3px;
}

/* Hover state for sortable columns */
.grid-container .table thead th.col-sort[aria-sort]:hover,
.grid-container .table thead th.col-sort[aria-sort]:hover a,
.grid-container .table thead th.col-sort[aria-sort]:hover button,
.grid-container .table thead th.col-sort[aria-sort]:hover span {
    color: white !important;
    background-color: #0b5ed7;
}

/* Active/clicked state */
.grid-container .table thead th.col-sort[aria-sort]:active,
.grid-container .table thead th.col-sort[aria-sort]:active a,
.grid-container .table thead th.col-sort[aria-sort]:active button {
    color: white !important;
}

/*.grid-container .table thead {
    background-color: #0d6efd;
    color: white;
}*/

.grid-container .table thead button.col-title,
.grid-container .table thead button.col-title .col-title-text,
.grid-container .table thead button.col-title .sort-indicator {
    color: white !important;
    text-decoration: underline;
}

    .grid-container .table thead button.col-title:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
