/**
 * Tonechaser Backstage Dashboard Styles
 * 
 * Styles for RM listing dashboard, selection view, and all related UI
 */

/* ==========================================================================
   Dashboard Base Styles
   ========================================================================== */

.tc-rm-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ==========================================================================
   Header Section
   ========================================================================== */

.tc-rm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.tc-rm-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.tc-rm-header p {
    margin: 5px 0 0;
    color: #666;
    font-size: 15px;
}

.tc-rm-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tc-rm-col-date {
    white-space: nowrap;
}

.tc-rm-listings-table th {
    white-space: nowrap;
}

.tc-rm-col-title strong {
    line-height: 1.4;
    display: block;
}

/* ==========================================================================
   Notices
   ========================================================================== */

.tc-rm-notice {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.tc-rm-notice p {
    margin: 5px 0;
}

.tc-rm-notice-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.tc-rm-notice-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.tc-rm-notice-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.tc-rm-notice-info {
    background: #e7f3ff;
    border-color: #0073aa;
    color: #004085;
}

/* ==========================================================================
   Filters Section
   ========================================================================== */

.tc-rm-filters {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.tc-rm-filter-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.tc-rm-search {
    flex: 2;
    min-width: 250px;
}

.tc-rm-search input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.tc-rm-search input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.tc-rm-filter {
    flex: 1;
    min-width: 150px;
}

.tc-rm-filter select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.tc-rm-filter select:focus {
    outline: none;
    border-color: #0073aa;
}

.tc-rm-bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tc-rm-selected-count {
    font-weight: 600;
    margin-left: 15px;
    color: #0073aa;
    font-size: 15px;
}

/* ==========================================================================
   Listings Grid (Selection View)
   ========================================================================== */

.tc-rm-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tc-rm-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.tc-rm-item:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.tc-rm-item.selected {
    border-color: #0073aa;
    background: #f0f7fc;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
}

.tc-rm-item.tc-rm-hidden {
    display: none;
}

.tc-rm-item-image {
    height: 180px;
    overflow: hidden;
    background: #f0f0f0;
}

.tc-rm-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tc-rm-no-image {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    font-weight: 500;
}

.tc-rm-item-details {
    padding: 15px;
}

.tc-rm-item-title {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}

.tc-rm-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.tc-rm-item-make {
    font-weight: 500;
}

.tc-rm-item-price {
    font-weight: 700;
    color: #2e7d32;
}

.tc-rm-item-condition {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

.tc-rm-item-geartype {
    margin-top: 10px;
}

.tc-rm-geartype-select {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.tc-rm-geartype-select:focus {
    outline: none;
    border-color: #0073aa;
}

.tc-rm-item-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tc-rm-item-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
}

/* ==========================================================================
   Actions Bar
   ========================================================================== */

.tc-rm-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 20px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.tc-rm-actions .button-primary {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
}

.tc-rm-actions .button-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#tc-rm-status {
    font-weight: 600;
}

/* ==========================================================================
   Listings Table
   ========================================================================== */

.tc-rm-listings-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.tc-rm-listings-table th,
.tc-rm-listings-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.tc-rm-listings-table th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tc-rm-listings-table tr:hover {
    background: #fafafa;
}

.tc-rm-listings-table tr:last-child td {
    border-bottom: none;
}

.tc-rm-col-image {
    width: 100px;
}

.tc-rm-col-image img {
    max-width: 80px;
    height: auto;
    border-radius: 4px;
    display: block;
}

.tc-rm-no-thumb {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.tc-rm-col-title strong {
    font-size: 15px;
    color: #333;
}

.tc-rm-col-price,
.tc-rm-col-date {
    font-size: 14px;
    color: #666;
}

.tc-rm-col-price {
    font-weight: 600;
    color: #2e7d32;
}

.tc-rm-col-actions {
    white-space: nowrap;
}

.tc-rm-col-actions .button {
    margin-right: 5px;
}

/* ==========================================================================
   Published Section
   ========================================================================== */

.tc-rm-published-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.tc-rm-published-section h3 {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 600;
    color: #333;
}

/* ==========================================================================
   Edit Form
   ========================================================================== */

.tc-rm-edit-form {
    max-width: 800px;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tc-rm-form-row {
    margin-bottom: 20px;
}

.tc-rm-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.tc-rm-form-row input,
.tc-rm-form-row textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.tc-rm-form-row input:focus,
.tc-rm-form-row textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.tc-rm-form-row textarea {
    resize: vertical;
    min-height: 120px;
}

.tc-rm-form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.tc-rm-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .tc-rm-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tc-rm-header-actions {
        width: 100%;
    }

    .tc-rm-filter-row {
        flex-direction: column;
    }

    .tc-rm-search,
    .tc-rm-filter {
        width: 100%;
        min-width: 100%;
    }

    .tc-rm-listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .tc-rm-form-row-half {
        grid-template-columns: 1fr;
    }

    .tc-rm-listings-table {
        font-size: 13px;
    }

    .tc-rm-listings-table th,
    .tc-rm-listings-table td {
        padding: 10px;
    }

    .tc-rm-col-image {
        width: 60px;
    }

    .tc-rm-col-image img {
        max-width: 50px;
    }
}

@media (max-width: 480px) {
    .tc-rm-dashboard {
        padding: 15px;
    }

    .tc-rm-header h2 {
        font-size: 22px;
    }

    .tc-rm-listings-grid {
        grid-template-columns: 1fr;
    }

    .tc-rm-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .tc-rm-actions .button-primary {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.tc-rm-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.tc-rm-loading::after {
    content: "...";
    animation: tc-loading-dots 1.5s infinite;
}

@keyframes tc-loading-dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

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

.tc-rm-text-center {
    text-align: center;
}

.tc-rm-text-muted {
    color: #666;
}

.tc-rm-mt-20 {
    margin-top: 20px;
}

.tc-rm-mb-20 {
    margin-bottom: 20px;
}

/* ==========================================================================
   Dropdown Menu
   ========================================================================== */

.tc-rm-dropdown {
    position: relative;
    display: inline-block;
}

.tc-rm-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s ease;
}

.tc-rm-dropdown-toggle:hover {
    background: #e8e8e8;
    border-color: #999;
}

.tc-rm-caret {
    font-size: 10px;
    opacity: 0.7;
}

.tc-rm-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 160px;
    margin-top: 4px;
    padding: 6px 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
}

.tc-rm-dropdown.open .tc-rm-dropdown-menu {
    display: block;
}

.tc-rm-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

.tc-rm-dropdown-item:hover {
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
}

.tc-rm-dropdown-item-danger {
    color: #dc3545;
}

.tc-rm-dropdown-item-danger:hover {
    background: #fff0f0;
    color: #dc3545;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.tc-rm-status-badge {
    white-space: nowrap;
}

.tc-rm-col-status {
    width: 100px;
}

.tc-rm-status-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tc-rm-status-listed {
    background: #d4edda;
    color: #155724;
}

.tc-rm-status-delisted {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

/* ==========================================================================
   De-listed Row Styling
   ========================================================================== */

.tc-rm-listings-table tr.tc-rm-delisted {
    background: #fafafa;
}

.tc-rm-listings-table tr.tc-rm-delisted td {
    opacity: 0.7;
}

.tc-rm-listings-table tr.tc-rm-delisted .tc-rm-col-actions,
.tc-rm-listings-table tr.tc-rm-delisted .tc-rm-col-status {
    opacity: 1;
}

.tc-rm-listings-table tr.tc-rm-delisted .tc-rm-col-price {
    color: #999;
}

/* ==========================================================================
   Header Actions (Reverb/Shopify grouping)
   ========================================================================== */

.tc-rm-import-actions {
    display: flex;
    gap: 8px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid #ddd;
}