/**
 * YoApy News Admin Styles
 *
 * @package YoApyNews
 * @since 1.0.0
 */

/* Header */
.yoapyne-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.yoapyne-header h1 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.6em;
    margin-bottom: 6px;
}

.yoapyne-header-icon {
    font-size: 28px;
    color: #2271b1;
}

.yoapyne-header-desc {
    color: #646970;
    font-size: 14px;
    margin: 0;
}

/* Layout */
.yoapyne-wrap {
    max-width: 1200px;
    margin-bottom: 60px;
}

.yoapyne-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.yoapyne-card-full {
    grid-column: 1 / -1;
}

@media (max-width: 960px) {
    .yoapyne-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.yoapyne-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-width: 0;
}

.yoapyne-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #f6f7f7;
    border-radius: 6px 6px 0 0;
}

.yoapyne-card-header .dashicons {
    color: #2271b1;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.yoapyne-card-header h2 {
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    border-bottom: none;
}

/* Form table inside cards */
.yoapyne-card .form-table {
    margin: 0 24px 24px 24px !important;
    width: calc(100% - 48px) !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.yoapyne-card .form-table th {
    padding: 16px 12px 16px 0 !important;
    width: 150px;
    font-size: 13px;
    vertical-align: top;
    font-weight: 600;
}

.yoapyne-card .form-table td {
    padding: 16px 0 !important;
    overflow-wrap: break-word;
    word-break: break-word;
}

.yoapyne-card .form-table tr:first-child th,
.yoapyne-card .form-table tr:first-child td {
    padding-top: 20px !important;
}

.yoapyne-card .form-table tr:last-child th,
.yoapyne-card .form-table tr:last-child td {
    padding-bottom: 20px !important;
}

.yoapyne-card .form-table td .description {
    margin-top: 6px;
    font-style: normal;
}

.yoapyne-card .form-table input[type="text"],
.yoapyne-card .form-table input[type="url"],
.yoapyne-card .form-table input[type="password"],
.yoapyne-card .form-table input[type="email"],
.yoapyne-card .form-table input[type="number"],
.yoapyne-card .form-table select,
.yoapyne-card .form-table textarea,
.yoapyne-card .regular-text {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.yoapyne-card .yoapyne-secret-field {
    width: 100%;
}

.yoapyne-card .yoapyne-secret-field input {
    flex: 1;
    min-width: 0;
}

@media (max-width: 782px) {
    .yoapyne-card .form-table {
        margin: 0 16px 16px 16px !important;
        width: calc(100% - 32px) !important;
    }

    .yoapyne-card .form-table th,
    .yoapyne-card .form-table td {
        display: block;
        width: 100%;
        padding: 6px 0 !important;
    }

    .yoapyne-card .form-table th {
        padding-bottom: 2px !important;
    }
}

/* Card actions bar */
.yoapyne-card-actions {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.yoapyne-card-actions .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
    margin-right: 3px;
}

/* Info box */
.yoapyne-info-box {
    display: flex;
    gap: 12px;
    margin: 20px 24px 4px 24px;
    padding: 14px 16px;
    background: #f0f6fc;
    border: 1px solid #c3daf5;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
}

.yoapyne-info-box>.dashicons {
    color: #2271b1;
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.yoapyne-info-box strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.yoapyne-info-box p {
    margin: 0;
    font-size: 13px;
    color: #3c434a;
    line-height: 1.5;
}

.yoapyne-info-box a {
    color: #2271b1;
    text-decoration: none;
}

.yoapyne-info-box a:hover {
    text-decoration: underline;
}

/* Secret field with toggle */
.yoapyne-secret-field {
    display: flex;
    gap: 4px;
    align-items: center;
}

.yoapyne-toggle-btn {
    padding: 0 6px !important;
    min-height: 30px;
    line-height: 28px;
}

.yoapyne-toggle-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    vertical-align: text-bottom;
}

/* Status grid */
.yoapyne-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 24px;
}

.yoapyne-status-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yoapyne-status-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #646970;
    font-weight: 600;
}

/* Status indicators */
.yoapyne-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.yoapyne-status .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.yoapyne-status-ok {
    background: #edfaef;
    color: #1a7a2e;
    border: 1px solid #c3e6cb;
}

.yoapyne-status-error {
    background: #fef0f0;
    color: #b32d2e;
    border: 1px solid #f5c6cb;
}

.yoapyne-status-warning {
    background: #fff8e5;
    color: #8a6d3b;
    border: 1px solid #ffeeba;
}

/* Inline messages */
.yoapyne-inline-msg {
    display: inline-block;
    margin-left: 4px;
    font-size: 13px;
    font-weight: 500;
}

.yoapyne-inline-msg.success {
    color: #1a7a2e;
}

.yoapyne-inline-msg.error {
    color: #b32d2e;
}

/* Tables — Imported News & Logs */
.yoapyne-table .column-id {
    width: 80px;
}

.yoapyne-table .column-date {
    width: 160px;
}

.yoapyne-table .column-source {
    width: 150px;
}

.yoapyne-table .column-post {
    width: 150px;
}

/* Logs table */
.yoapyne-logs-table .column-time {
    width: 160px;
}

.yoapyne-logs-table .column-event {
    width: 200px;
}

.yoapyne-log-event {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-family: monospace;
    background: #e9ecef;
}

.yoapyne-log-event-plugin_activated,
.yoapyne-log-event-news_imported,
.yoapyne-log-event-cron_end,
.yoapyne-log-event-settings_saved,
.yoapyne-log-event-image_set {
    background: #edfaef;
    color: #1a7a2e;
}

.yoapyne-log-event-cron_error,
.yoapyne-log-event-api_error,
.yoapyne-log-event-import_error,
.yoapyne-log-event-image_download_error,
.yoapyne-log-event-image_sideload_error,
.yoapyne-log-event-cron_api_error,
.yoapyne-log-event-cron_import_error {
    background: #fef0f0;
    color: #b32d2e;
}

.yoapyne-log-event-cron_start,
.yoapyne-log-event-client_init,
.yoapyne-log-event-api_request,
.yoapyne-log-event-api_response {
    background: #f0f6fc;
    color: #2271b1;
}

.yoapyne-log-event-skip_duplicate,
.yoapyne-log-event-cron_skip,
.yoapyne-log-event-cron_no_news {
    background: #fff8e5;
    color: #8a6d3b;
}

.yoapyne-log-data {
    display: block;
    max-width: 500px;
    max-height: 100px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 11px;
    background: #f8f9fa;
    padding: 6px 8px;
    border-radius: 3px;
    border: 1px solid #e9ecef;
}

/* Submit button */
.yoapyne-wrap .submit {
    padding-top: 0;
}

/* Buttons */
.yoapyne-wrap .button.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Placeholders */
.yoapyne-card input::placeholder {
    color: #a7aaad;
}

/* Fix for interference from other plugins (e.g. YoApy Social Poster modal leaking into layout) */
#yoapsopo-delete-modal {
    display: none !important;
}