/**
 * TBF Bulk User Manager - Main Stylesheet
 * Version: 8.1
 *
 * This file contains all the general UI styling for the plugin's admin pages.
 * It has been consolidated and streamlined to remove redundancies.
 */

/* ==========================================================================
   1. Core Layout & Wrapper
   ========================================================================== */

.tbfbuusm-wrap {
    margin: 20px 20px 20px 0;
    max-width: 1200px;
}

.tbfbuusm-header {
    padding-bottom: 10px;
    border-bottom: 1px solid #c8d7e1;
    margin-bottom: 20px;
}

.tbfbuusm-header h1,
.tbfbuusm-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

/* ==========================================================================
   2. Card & Grid System
   ========================================================================== */

.tbfbuusm-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
    display: flex;
    flex-direction: column;
}

.tbfbuusm-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.tbfbuusm-card-header h3 {
    margin: 0;
    font-size: 16px;
}

.tbfbuusm-card-header svg {
    width: 20px;
    height: 20px;
    fill: #50575e;
}

.tbfbuusm-card-body {
    padding: 20px;
    flex-grow: 1; /* Allows body to fill space in flex column */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tbfbuusm-card-body ul {
    margin: 0;
    padding-left: 20px;
    color: #555;
}

.tbfbuusm-card-body ul li {
    margin-bottom: 8px;
}

.tbfbuusm-card-footer {
    padding: 15px 20px;
    background: #f6f7f7;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 4px 4px;
}

/* Specific Grid Layouts */
.tbfbuusm-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.tbfbuusm-grid-container {
    display: grid;
    /* Default to single column for mobile-first */
    grid-template-columns: 1fr;
    gap: 20px;
}

.tbfbuusm-full-width {
    grid-column: 1 / -1;
}

/* ==========================================================================
   3. Form Elements & Fields
   ========================================================================== */

.tbfbuusm-card textarea {
    width: 100%;
    min-height: 120px;
    border-color: #c8d7e1;
    border-radius: 4px;
}

.tbfbuusm-field-group {
    margin: 0;
}

.tbfbuusm-field-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.tbfbuusm-field-group .description,
.tbfbuusm-card .description {
    margin-top: -10px;
    color: #646970;
    font-style: italic;
}

/* Comment Generator has a larger gap in its card body */
.tbfbuusm-card-body.comment-generator-body {
    gap: 25px;
}

/* ==========================================================================
   4. Interactive Components (Tables, Modals, Stats, Buttons)
   ========================================================================== */

/* --- Tables --- */
.tablenav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 10px;
}

/* Name/Gender Editor Specific Table Styles */
.tbfbuusm-results-table .tbfbuusm-lock-icon {
    cursor: pointer;
    opacity: 0.5;
    margin-left: 5px;
    vertical-align: middle;
}

.tbfbuusm-results-table .tbfbuusm-lock-icon.unlocked {
    opacity: 1;
    color: #d63638;
}

.tbfbuusm-name-input {
    width: 95%;
    border: 1px dashed #ccc;
    padding: 2px 4px;
}

.tbfbuusm-save-button {
    margin-left: 10px;
}

.tbfbuusm-save-button.saving .spinner {
    visibility: visible;
}

tr.inactive {
    opacity: 0.6;
    background-color: #f9f9f9;
}

tr.inactive .new_username {
    text-decoration: line-through;
}


/* --- Stats Cards --- */
.tbfbuusm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.tbfbuusm-stat-card {
    background: #f0f6fc;
    padding: 15px;
    border-left: 4px solid #0073aa;
}

.tbfbuusm-stat-card strong {
    display: block;
    font-size: 20px;
}

/* Dashboard Specific Stat Box */
.tbfbuusm-stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.tbfbuusm-stat {
    background: #f0f6fc;
    padding: 10px;
    border-radius: 4px;
}

.tbfbuusm-stat strong {
    font-size: 18px;
}


/* --- Modals --- */
.tbfbuusm-modal-overlay {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    /* For username changer modal */
    align-items: center;
    justify-content: center;
}

.tbfbuusm-modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* Default margin */
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.tbfbuusm-modal-header {
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tbfbuusm-modal-header h3 {
    margin: 0;
}

.tbfbuusm-modal-close {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 10px;
}

.tbfbuusm-modal-body {
    padding-top: 10px;
}

.tbfbuusm-modal-footer {
    padding-top: 20px;
    text-align: right;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

/* Comment Generator uses a different footer bg */
.tbfbuusm-modal-footer.comment-generator-footer {
     background: #f6f7f7;
}

/* --- Go Live / Action Containers --- */
#tbfbuusm-go-live-container {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tbfbuusm-back-form {
    margin-left: auto;
}

.tbfbuusm-results-container {
    margin-top: 20px;
}

.tbfbuusm-card-footer.right-aligned {
    text-align: right;
}

.tbfbuusm-card-footer .button-secondary {
    float: left;
}


/* ==========================================================================
   5. Responsive Adjustments
   ========================================================================== */

/* For two-column layouts */
@media (min-width: 961px) {
    .tbfbuusm-grid-container.two-column {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 782px) {
    #tbfbuusm-go-live-container {
        flex-direction: column;
        align-items: stretch;
    }

    #tbfbuusm-go-live-container .tbfbuusm-back-form {
        margin-left: 0;
        margin-top: 10px;
    }

    #tbfbuusm-go-live-container .tbfbuusm-back-form .button {
        width: 100%;
        text-align: center;
    }
}

/* Responsive Table */
@media (max-width: 768px) {
    table.widefat {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}


/* Responsive Table */
@media (max-width: 768px) {
    table.widefat {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* --- Added from history.php --- */
#tbfbuusm-history-modal .tbfbuusm-modal-content {
    width: 90%;
    max-width: 1400px;
}