/* Tables Page Specific Styles */

/* Fix scrollbar issue - override base.css min-height */
.app-layout {
    min-height: auto !important;
}

.tables-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 8px;
}

/* Responsive adjustments for tables container */
@media (max-width: 1450px) {
    .tables-container {
        max-width: 98%;
        padding: 0 8px;
    }
}

@media (max-width: 1200px) {
    .tables-container {
        max-width: 100%;
        padding: 0 4px;
    }
}

.table-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    overflow: hidden;
}

.table-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.table-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.table-header-left {
    flex: 1;
    min-width: 0;
}

.table-title {
    /* color: #0039A6; */
    color: #000;
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-title i {
    font-size: 20px;
    /* color: #0039A6; */
    color: #000;
}

.table-header-right {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

.control-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Table Wrapper */
.table-wrapper {
    overflow-x: auto;
    max-height: none;
    overflow-y: visible;
    min-width: 100%;
    padding-bottom: 8px;
}

/* Keep table area stable across pages with fewer rows (non-picks). */
.table-wrapper.fixed-table-height {
    min-height: 665px;
}

/* Only add scrolling when table actually has many rows */
.table-wrapper.scrollable {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 0;
    box-shadow: none;
    table-layout: auto; /* Allow columns to size according to content and specified widths */
    white-space: nowrap; /* Prevent text wrapping in cells */
    min-width: fit-content; /* Ensure table expands to fit all content */
}

/* Reduce cell padding for tables with many columns */
.modern-table th,
.modern-table td {
    padding: 8px 6px; /* Reduced from default padding */
    font-size: 13px; /* Slightly smaller font for more compact layout */
}

/* Fixed table layout - can be added to specific table containers when needed */
.fixed-table-width .modern-table {
    table-layout: fixed;
    width: 100%;
}

/* In fixed layout mode, allow cells to honor column widths */
.fixed-table-width .modern-table th,
.fixed-table-width .modern-table td {
    max-width: none;
}

/* Generic Column Width Classes */
.col-width-5 { width: 5% !important; }
.col-width-6 { width: 6% !important; }
.col-width-8 { width: 8% !important; }
.col-width-10 { width: 10% !important; }
.col-width-12 { width: 12% !important; }
.col-width-15 { width: 15% !important; }
.col-width-20 { width: 20% !important; }
.col-width-25 { width: 25% !important; }
.col-width-30 { width: 30% !important; }

/* Ensure width classes can override td default max-width */
.modern-table th[class^="col-width-"],
.modern-table td[class^="col-width-"] {
    max-width: none !important;
    min-width: auto;
}

.modern-table th {
    background-color: #f8f9fa;
    padding: 8px 12px;
    text-align: center;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help; /* headers now have tooltips */
}

.modern-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    vertical-align: middle;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
    cursor: help; /* Show help cursor for all cells (all have tooltips) */
}

/* Override help cursor for cells being actively selected */
.modern-table td:active {
    cursor: pointer;
}

/* Left-align specific data columns only (headers stay centered) */
.modern-table td.left-align {
    text-align: left;
}

/* Ensure all headers are always centered */
.modern-table th {
    text-align: center !important;
}

.modern-table tbody tr {
    transition: background-color 0.2s ease;
    cursor: pointer;
    user-select: none; /* Prevent text selection when multi-selecting */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Remove focus outline from table cells */
.modern-table td:focus,
.modern-table th:focus,
.modern-table tr:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Remove focus outline from any focused elements within table */
.modern-table *:focus {
    outline: none !important;
}

.modern-table tbody tr:hover {
    background-color: #f8f9fa;
}

.modern-table tbody tr.selected {
    background-color: rgba(0, 57, 166, 0.15) !important;
    box-shadow: inset 0 0 0 1px rgba(0, 57, 166, 0.2);
}

.modern-table tbody tr.selected:hover {
    background-color: rgba(0, 57, 166, 0.2) !important;
    box-shadow: inset 0 0 0 1px rgba(0, 57, 166, 0.3);
}

/* Specific cell styling */
.cell-date {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.cell-card {
    font-weight: 500;
    color: #333;
}

.card-image-hover-cell {
    cursor: zoom-in;
}

.card-image-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 3000;
    display: none;
    pointer-events: none;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.card-image-tooltip-img {
    width: 240px;
    height: 335px;
    object-fit: cover;
    display: block;
}

.card-image-tooltip-label {
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.2;
    color: #111;
    background: #fff;
    border-top: 1px solid #ececec;
    max-width: 240px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* No data state */
.no-data-row td.no-data {
    padding: 60px 20px;
    text-align: center;
    color: #666;
    background-color: #f8f9fa;
}

.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.no-data-message i {
    font-size: 48px;
    color: #ddd;
}

.no-data-message h4 {
    color: #666;
    margin: 0;
    font-size: 18px;
}

.no-data-message p {
    color: #999;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    max-width: 400px;
}

/* Pagination */
.pagination-container {
    padding: 0px 24px 20px;
    display: flex;
    justify-content: center;
}

/* Backward-compatible alias for older markup, safe to keep. */
.table-action-btn {
    display: flex;
    align-items: center;
    margin-right: 6px;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    width: 150px;
    justify-content: center;
    text-align: center;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-pagination-controls {
    justify-content: flex-end;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    width: 125px;
    justify-content: center;
    text-align: center;
}

/* Match modal action buttons to table action/pagination button sizing. */
.modal-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    min-width: 125px;
    justify-content: center;
    text-align: center;
}

.table-floating-actions {
    display: flex;
    justify-content: center;
    padding: 12px 0 4px 0;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: #000;
    font-size: 14px;
    font-weight: 500;
    padding: 0 16px;
    white-space: nowrap;
}

/* Revision Modal Specific Styles */
.revision-players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.player-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.player-name {
    background-color: #0039A6;
    color: white;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
}

.card-lists {
    padding: 16px;
    background-color: #f8f9fa;
    display: flex;
    gap: 16px;
}

.card-list {
    flex: 1;
    margin-bottom: 0;
}

.card-list h5 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center; /* Center Lands/Spells labels */
}

/* Icon spacing for ReviseModal h5 elements (matches DraftIdModal) */
.card-list h5 i {
    margin-right: 8px;
}

.card-content {
    border-radius: 6px;
    min-height: 275px;
    padding: 12px;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    overflow-y: auto;
    max-height: 120px;
}

/* Dropdown Styles moved to base.css for global availability */

/* Responsive Design */
@media (max-width: 1200px) {
    .table-header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .table-header-right {
        align-self: flex-start;
    }
    
    .revision-players {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .table-header {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .table-title {
        font-size: 17px;
        margin-bottom: 8px;
    }

    .table-title i {
        font-size: 17px;
    }
    
    .control-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .control-buttons .button {
        width: 100%;
        justify-content: center;
    }
    
    .modern-table th,
    .modern-table td {
        padding: 5px 8px;
        font-size: 11px;
    }

    .table-wrapper.fixed-table-height {
        min-height: 560px;
    }

    
    .pagination-container {
        padding: 16px 20px;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .page-info {
        order: -1;
    }
}

@media (max-width: 480px) {
    .table-header {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .table-title {
        font-size: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 6px;
    }

    .table-title i {
        font-size: 15px;
    }

    
    .modern-table th,
    .modern-table td {
        padding: 4px 6px;
        font-size: 10px;
    }

    .table-wrapper.fixed-table-height {
        min-height: 495px;
    }
    
    .card-lists {
        padding: 12px;
    }
    
    .card-content {
        min-height: 60px;
        max-height: 100px;
        padding: 8px;
        font-size: 12px;
    }
    
    .revise-form-row-4 {
        flex-direction: column;
        gap: 16px;
    }
    
    .revise-form-row-3-centered {
        flex-direction: column;
        gap: 16px;
        padding: 0 20%;
    }
}

/* ReviseModal Form Layout */

/* Center form labels in ReviseModal */
#ReviseModal .form-label {
    text-align: center;
}

/* Override stacking margins in ReviseModal */
#ReviseModal .form-group {
    margin-bottom: 0px; /* Remove form-group bottom margin */
}

.revise-form-row {
    display: flex;
    gap: 16px;
    align-items: end;
}

/* ReviseModal specific form row spacing */
#ReviseModal .revise-form-row {
    margin-bottom: 16px; /* Controlled spacing between form rows */
}

/* Override both the form row margin AND any modal-body div margin for last child */
#ReviseModal .modal-body > .revise-form-row:last-child,
#ReviseModal .revise-form-row:last-child {
    margin-bottom: 0 !important; /* Force remove margin from last form row */
}

/* .revise-form-row-4 inherits all styles from .revise-form-row */

.revise-form-row-4 .form-group {
    flex: 1;
}

.revise-form-row-3-centered {
    /* 3 equal columns, centered */
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

.revise-form-row-3-centered .form-group {
    flex: 1;
    max-width: 200px;
}

/* ReviseModal Dropdown Styling (similar to DraftIdModal) */
#ReviseModal .dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

#ReviseModal .dropdown-toggle {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#ReviseModal .dropdown-toggle:hover {
    border-color: #0039A6;
    box-shadow: 0 2px 4px rgba(0, 57, 166, 0.1);
}

#ReviseModal .dropdown-toggle i {
    margin-left: auto;
    transition: transform 0.2s ease;
    color: #666 !important;
}

#ReviseModal .dropdown-toggle span {
    color: #333 !important;
    flex: 1;
}

#ReviseModal .dropdown-toggle.active i {
    transform: rotate(180deg);
}

#ReviseModal .dropdown-toggle:disabled {
    background-color: #f5f5f5 !important;
    color: #333 !important;
    cursor: not-allowed;
    border-color: #ddd;
}

#ReviseModal .dropdown-toggle:disabled:hover {
    border-color: #ddd !important;
    box-shadow: none !important;
}

#ReviseModal .dropdown-toggle:disabled span {
    color: #333 !important;
}

#ReviseModal .dropdown-toggle:disabled i {
    color: #999 !important;
}

#ReviseModal .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    font-size: 14px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Make Format/Limited Format/Match Type dropdowns flow upward */
#ReviseModal .revise-form-row-3-centered .dropdown-menu {
    top: auto;
    bottom: 100%;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15); /* Flip shadow for upward flow */
}

#ReviseModal .dropdown-menu.show {
    display: block;
}

#ReviseModal .dropdown-menu li {
    list-style: none;
    margin: 0;
    padding: 8px 12px;
    color: #333 !important;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    display: block;
    text-align: left;
    background-color: transparent;
}

#ReviseModal .dropdown-menu li:last-child {
    border-bottom: none;
}

#ReviseModal .dropdown-menu li:hover {
    background-color: #0039A6 !important;
    color: white !important;
    font-weight: 500 !important;
}

/* ReviseMultiModal Dropdown Styling (same as ReviseModal) */
#ReviseMultiModal .dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

#ReviseMultiModal .dropdown-toggle {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#ReviseMultiModal .dropdown-toggle:hover {
    border-color: #0039A6;
    box-shadow: 0 2px 4px rgba(0, 57, 166, 0.1);
}

#ReviseMultiModal .dropdown-toggle i {
    margin-left: auto;
    transition: transform 0.2s ease;
    color: #666 !important;
}

#ReviseMultiModal .dropdown-toggle span {
    color: #333 !important;
    flex: 1;
}

#ReviseMultiModal .dropdown-toggle.active i {
    transform: rotate(180deg);
}

#ReviseMultiModal .dropdown-toggle:disabled {
    background-color: #f5f5f5 !important;
    color: #333 !important;
    cursor: not-allowed;
    border-color: #ddd;
}

#ReviseMultiModal .dropdown-toggle:disabled:hover {
    border-color: #ddd !important;
    box-shadow: none !important;
}

#ReviseMultiModal .dropdown-toggle:disabled span {
    color: #333 !important;
}

#ReviseMultiModal .dropdown-toggle:disabled i {
    color: #999 !important;
}

#ReviseMultiModal .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    /* font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; */
    font-size: 14px;
    padding: 0;
    margin: 0;
    list-style: none;
}

#ReviseMultiModal .dropdown-menu.show {
    display: block;
}

/* Allow dropdowns to extend beyond modal boundaries */
#ReviseMultiModal .modal-content {
    overflow: visible;
}

#ReviseMultiModal .dropdown-menu li {
    list-style: none;
    margin: 0;
    padding: 8px 12px;
    color: #333 !important;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    display: block;
    text-align: left;
    background-color: transparent;
}

#ReviseMultiModal .dropdown-menu li:last-child {
    border-bottom: none;
}

#ReviseMultiModal .dropdown-menu li:hover {
    background-color: #0039A6 !important;
    color: white !important;
    font-weight: 500 !important;
}

/* ReviseModal Form Input Styling - Match dropdown height exactly */
#ReviseModal .form-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    height: auto;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

#ReviseModal .form-input:hover {
    border-color: #0039A6;
    box-shadow: 0 2px 4px rgba(0, 57, 166, 0.1);
}

#ReviseModal .form-input:disabled:hover {
    border-color: #ddd !important;
    box-shadow: none !important;
}

#ReviseModal .form-input:focus {
    outline: none;
    border-color: #0039A6;
    box-shadow: 0 0 0 3px rgba(0, 57, 166, 0.1);
}

/* Override stacking margins in ReviseMultiModal */
#ReviseMultiModal .form-group {
    margin-bottom: 16px; /* Remove form-group bottom margin */
}

#ReviseMultiModal .modal-body > .revision-fields-section {
    margin-bottom: 0; /* Remove margin from revision fields section */
}

#ReviseMultiModal .modal-body > .revision-fields-section form {
    margin-bottom: 0; /* Remove margin from form element */
}

/* Set consistent height for all Step 2 field containers */
#ReviseMultiModal #P1FieldsContainer,
#ReviseMultiModal #P2FieldsContainer,
#ReviseMultiModal #FormatFieldsContainer,
#ReviseMultiModal #MatchTypeFieldsContainer {
    min-height: 140px; /* Consistent height for 1-2 form groups + spacing */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align content to top */
}

/* Target the last form-group in each container to remove double stacking */
#ReviseMultiModal #P1FieldsContainer .form-group:last-child,
#ReviseMultiModal #P2FieldsContainer .form-group:last-child,
#ReviseMultiModal #FormatFieldsContainer .form-group:last-child,
#ReviseMultiModal #MatchTypeFieldsContainer .form-group:last-child {
    margin-bottom: 0 !important; /* Remove margin from last form-group in each container */
}

#ReviseMultiModal .modal-body > div:last-child {
    margin-bottom: 0 !important; /* Force remove margin from last modal body child */
}

/* Subtle Step Labels Styling */
#ReviseMultiModal .field-selector-section .form-label,
#ReviseMultiModal .revision-fields-section > div .form-label {
    background: #f8f9fa;
    color: #333;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: left;
    border-left: 4px solid #0039A6;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Add space above Step 2 label */
#ReviseMultiModal .revision-fields-section > div .form-label {
    margin-top: 32px !important;
}

/* Add subtle step numbers */
#ReviseMultiModal .field-selector-section .form-label::before {
    content: "1";
    display: inline-block;
    background: #0039A6;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
}

#ReviseMultiModal .revision-fields-section > div .form-label::before {
    content: "2";
    display: inline-block;
    background: #0039A6;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
}

/* ReviseMultiModal Form Input Styling - Match dropdown height exactly */
#ReviseMultiModal .form-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    height: auto;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

#ReviseMultiModal .form-input:hover {
    border-color: #0039A6;
    box-shadow: 0 2px 4px rgba(0, 57, 166, 0.1);
}

#ReviseMultiModal .form-input:disabled:hover {
    border-color: #ddd !important;
    box-shadow: none !important;
}

#ReviseMultiModal .form-input:focus {
    outline: none;
    border-color: #0039A6;
    box-shadow: 0 0 0 3px rgba(0, 57, 166, 0.1);
}

/* Ensure Revise modals' footer button layout matches base modal footers */
#ReviseModal .modal-footer > div,
#ReviseMultiModal .modal-footer > div,
#RemoveModal .modal-footer > div,
#ReviseIgnoredModal .modal-footer > div {
    display: flex;
    gap: 12px; /* match .modal-footer gap in base.css */
    justify-content: flex-end; /* align buttons to the right like base */
    width: 100%;
}