/* =====================================================
   Bulk Page Analyzer — Shared Styles (Admin + Frontend)
   Works inside .wrap (admin) or .bpa-sc-wrap (shortcode)
   ===================================================== */

/* ---- Root scope: works in both contexts ---- */
.bpa-wrap,
.bpa-sc-wrap {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    max-width: 1200px;
}

/* Admin-context adjustments */
.bpa-wrap { /* inherits WP .wrap */ }

/* Shortcode context reset (isolate from theme) */
.bpa-sc-wrap *,
.bpa-sc-wrap *::before,
.bpa-sc-wrap *::after { box-sizing: border-box; }

/* ---- Header ---- */
.bpa-header { margin-bottom: 20px; }

.bpa-title {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-size: 24px !important;
    margin-top: 0 !important;
    margin-bottom: 4px !important;
    line-height: 1.3 !important;
    color: #1d2327 !important;
}

.bpa-title .dashicons {
    font-size: 26px;
    width: 26px;
    height: 26px;
    color: #2271b1;
    flex-shrink: 0;
}

.bpa-subtitle {
    color: #666;
    margin: 0 0 0 36px;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Card ---- */
.bpa-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ---- Tabs ---- */
.bpa-tabs {
    display: flex;
    margin-bottom: 18px;
    border-bottom: 2px solid #e0e0e0;
}

.bpa-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: color .2s, border-color .2s;
    outline: none;
}

.bpa-tab:hover  { color: #2271b1; }
.bpa-tab:focus  { color: #2271b1; }
.bpa-tab.active { color: #2271b1; border-bottom-color: #2271b1; }

.bpa-tab-content label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 13px;
}

/* ---- Textarea ---- */
#bpa-urls {
    width: 100%;
    height: 160px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    resize: vertical;
    transition: border-color .2s, box-shadow .2s;
    color: #333;
    background: #fff;
    line-height: 1.6;
}

#bpa-urls:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
}

/* ---- Upload zone ---- */
.bpa-upload-zone {
    border: 2px dashed #bbb;
    border-radius: 8px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.bpa-upload-zone:hover,
.bpa-upload-zone.drag-over {
    border-color: #2271b1;
    background: #f0f7ff;
}

.bpa-upload-zone p { margin: 6px 0; color: #666; font-size: 14px; }

.bpa-file-label {
    color: #2271b1;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

.bpa-file-name { font-size: 13px; color: #2271b1; font-weight: 600; }

/* ---- Login notice ---- */
.bpa-login-notice { font-size: 15px; }
.bpa-login-notice a { color: #2271b1; }

/* ---- Buttons (theme-agnostic) ---- */
.bpa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.4;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.bpa-btn .dashicons { font-size: 16px; width: 16px; height: 16px; flex-shrink: 0; }

.bpa-btn-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff !important;
}
.bpa-btn-primary:hover { background: #135e96; border-color: #135e96; color: #fff !important; }
.bpa-btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.bpa-btn-secondary {
    background: #f6f7f7;
    border-color: #ccc;
    color: #333 !important;
}
.bpa-btn-secondary:hover { background: #ececec; color: #333 !important; }

/* ---- Actions row ---- */
.bpa-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.bpa-url-count { font-size: 13px; color: #888; }

/* ---- Progress ---- */
.bpa-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.bpa-progress-bar-track {
    height: 10px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.bpa-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2271b1, #4ea6dc);
    border-radius: 6px;
    transition: width .3s ease;
}

.bpa-current-url {
    font-size: 12px;
    color: #999;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Results header ---- */
.bpa-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.bpa-results-title {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #1d2327 !important;
}

.bpa-export-btns { display: flex; gap: 8px; }

.bpa-export-btn { font-size: 13px !important; padding: 6px 12px !important; }

/* ---- Summary stat cards ---- */
.bpa-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.bpa-stat-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: center;
}

.bpa-stat-card .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #2271b1;
    display: block;
    line-height: 1.2;
}

.bpa-stat-card .stat-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: block;
    margin-top: 3px;
}

/* ---- Filter bar ---- */
.bpa-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.bpa-filter-input,
.bpa-status-filter {
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    background: #fff;
}

.bpa-filter-input { flex: 1; min-width: 180px; }

.bpa-filter-input:focus,
.bpa-status-filter:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.12);
}

/* ---- Table ---- */
.bpa-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.bpa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.bpa-table thead th {
    background: #f0f4f8;
    color: #333;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 2px solid #dde3ea;
    white-space: nowrap;
    text-align: left;
}

.bpa-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.bpa-table thead th.sortable:hover { background: #e4eaf2; }
.bpa-table thead th.sort-asc  .sort-icon::after { content: ' ↑'; }
.bpa-table thead th.sort-desc .sort-icon::after { content: ' ↓'; }

.bpa-table tbody tr:nth-child(even) { background: #fafbfc; }
.bpa-table tbody tr:hover { background: #f0f7ff; }

.bpa-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    color: #333;
}

.col-num    { width: 38px; color: #aaa !important; text-align: center !important; }
.col-url    { max-width: 300px; }
.col-status { text-align: right !important; }
.col-words  { text-align: right !important; }
.col-ratio  { text-align: right !important; }
.col-dom    { text-align: right !important; }
.col-time   { text-align: right !important; }

.bpa-url-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bpa-url-cell a { color: #2271b1; text-decoration: none; }
.bpa-url-cell a:hover { text-decoration: underline; }

/* ---- Badges ---- */
.bpa-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    line-height: 1.6;
}

.bpa-badge-success  { background: #d4edda; color: #155724; }
.bpa-badge-redirect { background: #fff3cd; color: #856404; }
.bpa-badge-error    { background: #f8d7da; color: #721c24; }

/* ---- Ratio bar ---- */
.bpa-ratio-wrap { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

.bpa-ratio-mini {
    width: 44px;
    height: 6px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.bpa-ratio-fill { height: 100%; background: #2271b1; border-radius: 4px; }

/* ---- Error rows ---- */
.bpa-row-error td { color: #721c24 !important; }
.bpa-row-error .bpa-url-cell a { color: #721c24 !important; }
.bpa-row-msg td { font-size: 12px; color: #999 !important; padding-top: 2px !important; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .bpa-card { padding: 16px; }
    .bpa-title { font-size: 18px !important; }
    .bpa-summary { grid-template-columns: repeat(2, 1fr); }
    .bpa-results-header { flex-direction: column; align-items: flex-start; }
}
