/**
 * RankWiz Dashboard Widget Styles
 *
 * Follows WordPress admin UI patterns with responsive layout for dashboard widgets.
 * Uses .rankwiz-* prefixed classes to avoid conflicts.
 */

/* Main Widget Container */
.rankwiz-dashboard-widget {
    font-size: 13px;
    line-height: 1.5;
}

/* Disconnected State */
.rankwiz-widget-disconnected {
    padding: 12px 0;
}

.rankwiz-widget-disconnected p {
    margin: 8px 0;
}

.rankwiz-widget-disconnected .button {
    margin-top: 8px;
}

/* Loading State */
.rankwiz-widget-loading {
    padding: 12px 0;
    display: flex;
    align-items: center;
}

.rankwiz-widget-loading p {
    margin: 0;
    display: flex;
    align-items: center;
}

/* Widget Sections */
.rankwiz-widget-section {
    padding: 12px 0;
    border-bottom: 1px solid #dcdcde;
}

.rankwiz-widget-section:last-child {
    border-bottom: none;
}

.rankwiz-widget-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

/* Status Section */
.rankwiz-widget-status-line {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.rankwiz-widget-last-sync {
    font-size: 12px;
    color: #646970;
}

/* Count Line */
.rankwiz-widget-count {
    margin: 0 0 8px 0;
    color: #646970;
}

.rankwiz-widget-count strong {
    color: #1d2327;
    font-size: 18px;
}

/* Widget Lists */
.rankwiz-widget-list {
    margin: 0 0 8px 0;
    padding-left: 20px;
    list-style: disc;
}

.rankwiz-widget-list li {
    margin: 6px 0;
    padding: 0;
    line-height: 1.4;
}

.rankwiz-widget-list a {
    color: #2271b1;
    text-decoration: none;
}

.rankwiz-widget-list a:hover {
    color: #135e96;
    text-decoration: underline;
}

.rankwiz-widget-empty {
    margin: 8px 0;
    color: #646970;
    font-style: italic;
}

/* ROI Summary */
.rankwiz-roi-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 8px 0;
}

.rankwiz-roi-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #f6f7f7;
    border-radius: 3px;
}

.rankwiz-roi-label {
    color: #646970;
    font-size: 12px;
}

.rankwiz-roi-value {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
}

.rankwiz-roi-value.positive {
    color: #00a32a;
}

.rankwiz-roi-value.negative {
    color: #d63638;
}

/* Widget Footer */
.rankwiz-widget-footer {
    padding-top: 12px;
    margin: 0;
    border-top: 1px solid #dcdcde;
}

.rankwiz-view-dashboard {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.rankwiz-view-dashboard:hover {
    color: #135e96;
}

/* Error State */
.rankwiz-widget-error {
    padding: 12px 0;
}

.rankwiz-widget-error .notice {
    margin: 0 0 12px 0;
    padding: 8px 12px;
}

.rankwiz-widget-error .notice p {
    margin: 4px 0;
}

.rankwiz-error-message {
    font-size: 12px;
    color: #646970;
}

.rankwiz-retry-load {
    margin-top: 8px;
}

/* Badges (reuse from admin.css patterns) */
.rankwiz-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.rankwiz-badge--connected {
    background-color: #d4edda;
    color: #155724;
}

.rankwiz-badge--disconnected {
    background-color: #f8d7da;
    color: #721c24;
}


/* Impact Score Badges */
.rankwiz-impact-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
    white-space: nowrap;
    margin-left: 4px;
}

.rankwiz-impact-high {
    background-color: #d4edda;
    color: #155724;
}

.rankwiz-impact-medium {
    background-color: #fff3cd;
    color: #856404;
}

.rankwiz-impact-low {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Responsive Layout for Narrower Widgets */
@media screen and (max-width: 782px) {
    .rankwiz-widget-status-line {
        flex-direction: column;
        align-items: flex-start;
    }

    .rankwiz-roi-stats {
        grid-template-columns: 1fr;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .rankwiz-badge--connected {
        border: 1px solid #155724;
    }

    .rankwiz-badge--disconnected {
        border: 1px solid #721c24;
    }

    .rankwiz-roi-stat {
        border: 1px solid #dcdcde;
    }
}

/* Dark Mode: Impact Badges */
@media (prefers-color-scheme: dark) {
    .rankwiz-impact-high {
        background-color: #1a3c24;
        color: #75c990;
    }

    .rankwiz-impact-medium {
        background-color: #3d2f00;
        color: #f5c842;
    }

    .rankwiz-impact-low {
        background-color: #2c3035;
        color: #c3c4c7;
    }
}

/* Dark Mode Support (for WordPress 5.7+) */
@media (prefers-color-scheme: dark) {
    .rankwiz-widget-section {
        border-bottom-color: #3c434a;
    }

    .rankwiz-widget-section h4 {
        color: #f0f0f1;
    }

    .rankwiz-widget-last-sync,
    .rankwiz-widget-count,
    .rankwiz-widget-empty,
    .rankwiz-roi-label {
        color: #c3c4c7;
    }

    .rankwiz-widget-count strong,
    .rankwiz-roi-value {
        color: #f0f0f1;
    }

    .rankwiz-roi-stat {
        background: #1e1e1e;
        border: 1px solid #3c434a;
    }

    .rankwiz-widget-footer {
        border-top-color: #3c434a;
    }
}
