/**
 * Boba Checklist Styles
 *
 * Minimal, clean CSS that avoids conflicts with existing WordPress themes.
 * Uses .boba- prefix for all classes to prevent style collisions.
 */

/* ==========================================================================
   Container & Base Styles
   ========================================================================== */

.boba-checklist {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.boba-checklist *,
.boba-checklist *::before,
.boba-checklist *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Controls Section (Search & Filters)
   ========================================================================== */

.boba-checklist-controls {
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.boba-controls-row {
    margin-bottom: 16px;
}

.boba-controls-row:last-child {
    margin-bottom: 0;
}

/* Search Input */
.boba-search-wrapper {
    position: relative;
    max-width: 500px;
}

.boba-search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.boba-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.boba-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.boba-search-clear:hover {
    background: #f3f4f6;
    color: #374151;
}

.boba-search-input:not(:placeholder-shown) + .boba-search-clear {
    display: flex;
}

/* Filter Row */
.boba-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.boba-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.boba-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.boba-filter-select {
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.boba-filter-select:focus {
    outline: none;
    border-color: #2563eb;
}

/* Power Range Inputs */
.boba-filter-power {
    min-width: 180px;
}

.boba-power-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.boba-power-input {
    width: 70px;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    text-align: center;
}

.boba-power-input:focus {
    outline: none;
    border-color: #2563eb;
}

.boba-power-separator {
    color: #9ca3af;
    font-weight: 500;
}

/* Actions Row */
.boba-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* Action Buttons Group */
.boba-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.boba-results-count {
    font-size: 14px;
    color: #6b7280;
}

.boba-results-count span {
    font-weight: 600;
    color: #374151;
}

/* Buttons */
.boba-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.boba-btn:active {
    transform: scale(0.98);
}

.boba-btn-primary {
    background: #2563eb;
    color: #fff;
}

.boba-btn-primary:hover {
    background: #1d4ed8;
}

.boba-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.boba-btn-secondary:hover {
    background: #d1d5db;
}

/* ==========================================================================
   Table Header (Desktop Only)
   ========================================================================== */

.boba-table-header {
    display: none;
    background: #1f2937;
    color: #fff;
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.boba-header-cell {
    padding: 12px 16px;
    color: #ffffff;
}

/* Sortable Column Headers */
.boba-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s;
}

.boba-sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.boba-sortable::after {
    content: '';
    display: inline-block;
    margin-left: 8px;
    width: 0;
    height: 0;
    opacity: 0.3;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #fff;
    vertical-align: middle;
}

.boba-sortable.boba-sort-asc::after {
    opacity: 1;
    border-top: none;
    border-bottom: 4px solid #fff;
}

.boba-sortable.boba-sort-desc::after {
    opacity: 1;
    border-top: 4px solid #fff;
    border-bottom: none;
}

/* ==========================================================================
   Card List & Items
   ========================================================================== */

.boba-card-list {
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    overflow: hidden;
}

/* Individual Card Item - Mobile First (Stacked Layout) */
.boba-card-item {
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
}

.boba-card-item:last-child {
    border-bottom: none;
}

.boba-card-item:nth-child(even) {
    background: #f9fafb;
}

.boba-card-item.boba-hidden {
    display: none;
}

/* Mobile Card Layout */
.boba-card-mobile {
    display: block;
}

.boba-card-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.boba-card-number {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.boba-card-power {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.boba-card-hero {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.boba-card-variation {
    font-size: 12px;
    font-style: italic;
    font-weight: normal;
    color: #6b7280;
    margin-top: 2px;
}

.boba-card-athlete {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 12px;
}

.boba-card-athlete::before {
    content: "Athlete Inspiration: ";
    font-weight: 700;
    color: #374151;
}

.boba-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.boba-card-tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
}

.boba-card-tag-variation {
    background: #dbeafe;
    color: #1e40af;
}

.boba-card-tag-treatment {
    background: #dcfce7;
    color: #166534;
}

.boba-card-tag-weapon {
    background: #fce7f3;
    color: #9d174d;
}

.boba-card-tag-notation {
    background: #fef3c7;
    color: #92400e;
}

/* Desktop Table Layout (Hidden on mobile) */
.boba-card-desktop {
    display: none;
}

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */

.boba-loading {
    text-align: center;
    padding: 60px 20px;
}

.boba-loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: boba-spin 0.8s linear infinite;
}

@keyframes boba-spin {
    to {
        transform: rotate(360deg);
    }
}

.boba-loading p {
    color: #6b7280;
    margin: 0;
}

.boba-no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f9fafb;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
}

.boba-no-results p {
    color: #6b7280;
    margin: 0;
    font-size: 16px;
}

/* ==========================================================================
   Desktop Styles (min-width: 768px)
   ========================================================================== */

@media (min-width: 768px) {
    .boba-checklist {
        padding: 30px;
    }

    .boba-filter-group {
        min-width: 150px;
    }

    /* Show table header on desktop */
    .boba-table-header {
        display: grid;
        grid-template-columns: 110px 1fr 180px 110px 80px 95px 0.9fr;
        gap: 0;
    }

    .boba-card-list {
        border-radius: 0 0 8px 8px;
        border-top: none;
    }

    /* Hide mobile layout, show desktop */
    .boba-card-mobile {
        display: none;
    }

    .boba-card-desktop {
        display: grid;
        grid-template-columns: 110px 1fr 180px 110px 80px 95px 0.9fr;
        gap: 0;
        align-items: center;
    }

    .boba-card-item {
        padding: 0;
    }

    .boba-card-cell {
        padding: 12px 16px;
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .boba-card-cell.boba-col-number {
        font-weight: 500;
        color: #6b7280;
    }

    .boba-card-cell.boba-col-hero {
        font-weight: 600;
        color: #111827;
        white-space: normal;
    }

    .boba-card-cell.boba-col-treatment {
        white-space: normal;
    }

    .boba-col-power {
        text-align: center;
    }

    .boba-card-cell.boba-col-athlete {
        color: #4b5563;
        white-space: normal;
    }
}

/* ==========================================================================
   Large Desktop Styles (min-width: 1200px)
   ========================================================================== */

@media (min-width: 1200px) {
    .boba-table-header,
    .boba-card-desktop {
        grid-template-columns: 120px 1.2fr 200px 120px 90px 105px 1.1fr;
    }
}

/* ==========================================================================
   Play Card Specific Styles
   ========================================================================== */

/* Mobile: Play Cost Badge */
.boba-card-cost {
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Mobile: Play Ability Text */
.boba-card-ability {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
}

/* Desktop: Play cards - ability spans last 4 columns (Weapon, Notation, PWR, Athlete) */
@media (min-width: 768px) {
    .boba-card-cell.boba-col-play-ability {
        grid-column: span 4;
        white-space: normal;
        font-size: 13px;
        line-height: 1.4;
        color: #475569;
    }

    /* Desktop: Cost Badge (pill style) */
    .boba-card-cost-badge {
        display: inline-block;
        background: #dbeafe;
        color: #1e40af;
        padding: 3px 10px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 600;
        margin-top: 4px;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.boba-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
