/**
 * Admin styles for Crypto Articles Plugin v2.0
 */

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

.crypto-articles-admin {
    max-width: 1400px;
}

.crypto-articles-admin h1 {
    margin-bottom: 5px;
}

.crypto-articles-admin > .description {
    margin-bottom: 20px;
    color: #666;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.crypto-articles-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.crypto-articles-card h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 18px;
}

.crypto-articles-card h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 16px;
}

.crypto-articles-card code {
    background: #f0f0f1;
    padding: 5px 10px;
    border-radius: 3px;
    display: inline-block;
    margin: 5px 0;
    font-family: monospace;
}

/* ==========================================================================
   Health Status Card
   ========================================================================== */

.crypto-articles-health-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

.health-status {
    padding: 15px;
    background: #fff;
    border-radius: 4px;
    margin-top: 15px;
}

.health-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.health-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.health-label {
    font-size: 18px;
    font-weight: 600;
}

.health-details p {
    margin: 5px 0;
    color: #666;
}

.health-warning {
    color: #d63638 !important;
}

/* ==========================================================================
   Statistics Grid
   ========================================================================== */

.crypto-articles-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 20px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: #f0f0f1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.stat-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #2271b1;
}

.stat-content h3 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #666;
    font-weight: 400;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    color: #1d2327;
}

/* ==========================================================================
   Quick Actions
   ========================================================================== */

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.quick-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.quick-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   License Badges
   ========================================================================== */

.license-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.license-exclusive {
    background: #fef3cd;
    color: #856404;
}

.license-non-exclusive {
    background: #d1e7dd;
    color: #0f5132;
}

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

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-accepted, .status-active, .status-healthy {
    background: #d1e7dd;
    color: #0f5132;
}

.status-rejected, .status-suspended {
    background: #f8d7da;
    color: #842029;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-critical {
    background: #f8d7da;
    color: #842029;
}

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

.crypto-articles-filters {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
}

.filter-group input[type="text"],
.filter-group select {
    min-width: 180px;
}

.filter-actions {
    flex-direction: row;
    gap: 8px;
}

.filter-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ==========================================================================
   Marketplace Grid
   ========================================================================== */

.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.marketplace-article-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
}

.marketplace-article-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.marketplace-article-card.is-purchased {
    border-color: #0f5132;
    border-width: 2px;
}

.marketplace-article-card .purchased-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #0f5132;
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.marketplace-article-card .purchased-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.marketplace-article-card .article-image {
    height: 160px;
    overflow: hidden;
    background: #f0f0f1;
}

.marketplace-article-card .article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.marketplace-article-card .article-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.marketplace-article-card .article-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.4;
}

.marketplace-article-card .article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.marketplace-article-card .article-meta .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 3px;
}

.marketplace-article-card .article-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    flex: 1;
}

.marketplace-article-card .article-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #666;
}

.marketplace-article-card .article-stats .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 3px;
}

.marketplace-article-card .article-pricing {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.marketplace-article-card .price-option {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.marketplace-article-card .price-option:last-child {
    margin-bottom: 0;
}

.marketplace-article-card .price-label {
    color: #666;
    font-size: 13px;
}

.marketplace-article-card .price-value {
    font-weight: 600;
    color: #2271b1;
}

.marketplace-article-card .article-actions {
    display: flex;
    gap: 10px;
}

.marketplace-article-card .article-actions .button {
    flex: 1;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ==========================================================================
   Submissions List
   ========================================================================== */

.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.submission-card {
    padding: 20px;
}

.submission-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.submission-title {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.submission-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

.submission-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.submission-meta .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.submission-excerpt {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.submission-excerpt p {
    margin: 0;
    color: #444;
    line-height: 1.6;
}

.submission-details {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.submission-details .detail-item {
    font-size: 14px;
}

.submission-details .detail-label {
    color: #666;
    margin-right: 5px;
}

.submission-details .detail-value {
    font-weight: 600;
}

.submission-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.submission-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.submission-feedback {
    margin-top: 15px;
    padding: 15px;
    background: #f0f6fc;
    border-radius: 4px;
    border-left: 4px solid #2271b1;
}

.submission-feedback p {
    margin: 5px 0 0 0;
}

/* ==========================================================================
   Server Warnings
   ========================================================================== */

.server-warnings {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.server-warnings li {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.server-warnings .warning-info {
    background: #d1ecf1;
    color: #0c5460;
}

.server-warnings .warning-warning {
    background: #fff3cd;
    color: #856404;
}

.server-warnings .warning-error {
    background: #f8d7da;
    color: #842029;
}

.server-warnings .warning-time {
    font-size: 12px;
    color: inherit;
    opacity: 0.7;
}

/* ==========================================================================
   Analytics Charts
   ========================================================================== */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 300px;
}

.analytics-period-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.period-btn {
    padding: 8px 16px;
    background: #f0f0f1;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s, color 0.2s;
}

.period-btn:hover {
    background: #e0e0e0;
}

.period-btn.active {
    background: #2271b1;
    color: #fff;
}

/* ==========================================================================
   Content Table
   ========================================================================== */

.content-table {
    width: 100%;
    border-collapse: collapse;
}

.content-table th,
.content-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.content-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.content-table tr:hover {
    background: #f8f9fa;
}

.content-table .article-title-cell {
    max-width: 300px;
}

.content-table .article-title-cell strong {
    display: block;
    margin-bottom: 3px;
}

.content-table .article-title-cell .article-id {
    font-size: 11px;
    color: #999;
    font-family: monospace;
}

.content-table .actions-cell {
    white-space: nowrap;
}

.content-table .actions-cell .button {
    margin-right: 5px;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.crypto-articles-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
}

.crypto-articles-modal .modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.crypto-articles-modal .modal-content.modal-large {
    max-width: 900px;
}

.crypto-articles-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crypto-articles-modal .modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.crypto-articles-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.crypto-articles-modal .modal-close:hover {
    color: #d63638;
}

.crypto-articles-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.crypto-articles-modal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* License Options */
.license-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.license-option {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.license-option:hover {
    border-color: #2271b1;
}

.license-option input[type="radio"] {
    margin-right: 15px;
    margin-top: 3px;
}

.license-option input[type="radio"]:checked + .option-content {
    color: #2271b1;
}

.license-option .option-content {
    flex: 1;
}

.license-option .option-content strong {
    display: block;
    margin-bottom: 5px;
}

.license-option .option-description {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.license-option .option-price {
    display: block;
    font-weight: 600;
    color: #2271b1;
}

.license-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f0f6fc;
    border-radius: 4px;
    font-size: 13px;
    color: #1d2327;
}

.license-notice .dashicons {
    color: #2271b1;
}

/* Submission Full Content */
.submission-full-content .submission-header-info {
    display: flex;
    gap: 20px;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    color: #666;
    font-size: 14px;
}

.submission-full-content .content-body {
    line-height: 1.8;
}

.submission-full-content .content-body h1,
.submission-full-content .content-body h2,
.submission-full-content .content-body h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}

.submission-full-content .content-body p {
    margin-bottom: 15px;
}

/* ==========================================================================
   Settings Page
   ========================================================================== */

.crypto-articles-settings {
    max-width: 1200px;
}

.crypto-articles-settings .form-table th {
    width: 250px;
}

.crypto-articles-settings .form-table td p.description {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

/* ==========================================================================
   No Results State
   ========================================================================== */

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* ==========================================================================
   Error and Success States
   ========================================================================== */

.crypto-articles-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
}

.crypto-articles-success {
    padding: 15px;
    background: #d1e7dd;
    border: 1px solid #badbcc;
    border-radius: 4px;
    color: #0f5132;
}

/* ==========================================================================
   Spinner
   ========================================================================== */

.crypto-articles-modal .spinner {
    float: none;
    margin: 0;
}

#preview-loading,
#submission-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

#preview-loading .spinner,
#submission-loading .spinner {
    float: none;
    margin: 0 10px 0 0;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* ==========================================================================
   Button Variants
   ========================================================================== */

.button-danger {
    background: #d63638 !important;
    border-color: #d63638 !important;
    color: #fff !important;
}

.button-danger:hover {
    background: #b32d2e !important;
    border-color: #b32d2e !important;
}

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

@media screen and (max-width: 782px) {
    .crypto-articles-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .marketplace-grid {
        grid-template-columns: 1fr;
    }

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

    .filter-group input[type="text"],
    .filter-group select {
        min-width: 100%;
    }

    .submission-header {
        flex-direction: column;
        gap: 10px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .crypto-articles-modal .modal-content {
        max-height: 90vh;
    }
}

@media screen and (max-width: 600px) {
    .crypto-articles-stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .button {
        width: 100%;
        justify-content: center;
    }
}
