/**
 * Tidy Posts - Admin CSS
 * Inline Editing, Dashboard Widget, Clickable Tiles, Rate Banner
 */

/* ============================================
   1. Inline Editor
   ============================================ */

.tp-editor-wrapper {
    position: relative;
    width: 100%;
}

.tp-inline-editor {
    width: 100% !important;
    min-height: 95px !important;
    margin: 0 !important;
    padding: 10px 10px 25px 10px !important;
    border: 2px solid #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #3c434a !important;
    display: block !important;
    background: #fff !important;
    z-index: 10;
}

.tp-char-count {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 10px;
    font-weight: bold;
    color: #646970;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 5px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 11;
}

/* ============================================
   2. Cell States (Hover, Saving, Success)
   ============================================ */

td[data-column*="seo"]:hover, 
td[data-column*="meta_desc"]:hover,
td[data-column*="meta-desc"]:hover,
td[data-column="meta_description"]:hover,
td[data-column="meta-description"]:hover {
    background-color: #f0f6fb !important;
    cursor: pointer;
}

.tp-success-flash {
    background-color: #edfaef !important;
    transition: background-color 1.2s;
}

.tp-saving {
    color: #646970;
    font-style: italic;
    background: #f6f7f7;
}

.tp-loading-value {
    color: #646970;
    font-style: italic;
}

/* ============================================
   3. Support Tab in Navigation
   ============================================ */

.tp-tabs {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
}

.tp-tabs .tp-support-tab {
    margin-left: auto;
    background: #2271b1;
    color: white !important;
    border-radius: 4px;
    padding: 8px 16px !important;
    transition: all 0.2s ease;
    border-bottom: none !important;
}

.tp-tabs .tp-support-tab:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.4);
    color: white !important;
}

.tp-tabs .tp-support-tab .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: middle;
    line-height: 1;
}

/* ============================================
   4. Clickable Overview Tiles
   ============================================ */

.tp-stat-box.tp-tile-clickable {
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    position: relative;
}

.tp-stat-box.tp-tile-clickable:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-color: #2271b1 !important;
}

.tp-stat-box.tp-tile-clickable:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

.tp-stat-box.tp-tile-clickable::after {
    content: '\2192';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease-in-out, right 0.2s ease-in-out;
    font-size: 16px;
    color: #2271b1;
}

.tp-stat-box.tp-tile-clickable:hover::after {
    opacity: 1;
    right: 10px;
}

/* ============================================
   5. Rate This Plugin Banner
   ============================================ */

.tp-rate-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #2271b1;
    padding: 12px 16px;
    margin: 15px 0;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tp-rate-icon {
    color: #f0b849;
    font-size: 20px !important;
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
}

.tp-rate-banner p {
    margin: 0;
    flex: 1;
    font-size: 13px;
    color: #1d2327;
}

.tp-rate-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.tp-rate-btn {
    white-space: nowrap;
}

.tp-rate-dismiss {
    color: #646970;
    text-decoration: none;
    font-size: 12px;
    white-space: nowrap;
}

.tp-rate-dismiss:hover {
    color: #d63638;
}

@media screen and (max-width: 782px) {
    .tp-rate-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    .tp-rate-actions {
        width: 100%;
    }
    .tp-rate-btn {
        flex: 1;
        text-align: center;
    }
}

/* ============================================
   6. Dashboard Widget
   ============================================ */

.tp-dashboard-widget {
    margin: 0;
}

#tidy_posts_dashboard {
    border: 1px solid #c3c4c7;
}

#tidy_posts_dashboard .postbox-header {
    border-bottom: 1px solid #c3c4c7;
}

#tidy_posts_dashboard .inside {
    padding: 0;
    margin: 0;
}

.tp-widget-loading {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

.tp-widget-loading .spinner {
    float: none;
    margin: 0 10px 0 0;
}

.tp-widget-error {
    text-align: center;
    padding: 20px;
    color: #d63638;
}

.tp-widget-error .dashicons {
    margin-right: 5px;
}

/* Health Score */
.tp-health-score-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-bottom: 1px solid #e2e4e7;
    gap: 20px;
}

.tp-health-score {
    width: 80px;
    height: 80px;
}

.tp-circular-chart {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.tp-circle-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 3;
}

.tp-circle {
    fill: none;
    stroke: #28a745;
    stroke-width: 3;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dasharray 0.6s ease;
}

.tp-percentage {
    fill: #333;
    font-size: 8px;
    font-weight: bold;
    text-anchor: middle;
}

.tp-health-label {
    text-align: left;
}

.tp-health-label strong {
    display: block;
    font-size: 14px;
    color: #1d2327;
    margin-bottom: 4px;
}

.tp-health-grade {
    font-size: 13px;
    font-weight: 600;
    color: #28a745;
}

/* Widget Stats Grid */
.tp-widget-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #e2e4e7;
}

.tp-widget-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tp-widget-stat:hover {
    background: #f6f7f7;
}

.tp-widget-stat:active {
    background: #f0f0f1;
}

.tp-widget-stat .tp-stat-icon {
    font-size: 20px;
    width: 20px;
    height: 20px;
    margin-bottom: 5px;
    color: #646970;
}

.tp-widget-stat .tp-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.2;
}

.tp-widget-stat .tp-stat-label {
    font-size: 11px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tp-widget-stat.has-issues .tp-stat-value {
    color: #d63638;
}

.tp-widget-stat.has-issues .tp-stat-icon {
    color: #d63638;
}

.tp-widget-stat.warning.has-issues .tp-stat-value,
.tp-widget-stat.warning.has-issues .tp-stat-icon {
    color: #dba617;
}

/* Priority Actions */
.tp-priority-actions {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e2e4e7;
}

.tp-priority-actions:last-child {
    padding-bottom: 15px;
}

.tp-priority-actions h4 {
    margin: 0 0 12px 0;
    font-size: 12px;
    text-transform: uppercase;
    color: #646970;
    letter-spacing: 0.5px;
}

.tp-priority-actions h4 .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 5px;
    vertical-align: middle;
    color: #d63638;
}

.tp-action-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tp-action-list li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f1;
    gap: 8px;
}

.tp-action-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tp-action-list .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #646970;
    flex-shrink: 0;
}

.tp-action-title {
    flex: 1;
    font-weight: 500;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-action-issue {
    font-size: 11px;
    color: #d63638;
    background: #fcf0f1;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.tp-action-edit {
    font-size: 12px;
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.tp-action-edit:hover {
    color: #135e96;
    text-decoration: underline;
}

/* ============================================
   7. Inline Edit Tooltip Indicator
   ============================================ */

.tp-col-tooltip {
    display: inline-block;
    font-size: 14px;
    color: #2271b1;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.tp-col-tooltip:hover {
    opacity: 1;
}

.tp-seo-col-header {
    white-space: nowrap;
}

/* ============================================
   8. Undo Banner
   ============================================ */

.tp-undo-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #fff3cd;
    border-left: 4px solid #f0b849;
    margin-bottom: 10px;
    font-size: 13px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tp-undo-banner .dashicons {
    color: #f0b849;
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tp-undo-banner .button {
    margin: 0;
}

.tp-undo-banner .tp-undo-dismiss {
    color: #646970;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    margin-left: auto;
    cursor: pointer;
}

.tp-undo-banner .tp-undo-dismiss:hover {
    color: #d63638;
}
