/**
 * Admin Stylesheet
 *
 * Contains styles for the AINP: AI Native Publisher admin pages, ensuring a consistent
 * look and feel integrated with the WordPress dashboard.
 *
 * @package           AINP_AI_Native_Publisher
 * @author            AI News Publisher
 * @copyright         2025, AI News Publisher
 * @license           GPL-2.0+
 */

/* --- General Structure & Layout --- */
.ainp-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 1200px; /* Limit max width for better readability */
    margin: 20px auto; /* Add some top/bottom margin */
}

/* Standard form table styling */
.ainp-wrap .form-table {
    margin-bottom: 25px;
}

.ainp-wrap .form-table th {
    width: 250px; /* Consistent label width */
    font-weight: 600;
    padding-right: 20px; /* Space between label and field */
}

.ainp-wrap .form-table p.description {
    font-size: 13px;
    color: #50575e; /* WP standard description color */
}

/* Horizontal rule for separating sections */
.ainp-wrap hr {
    margin: 35px 0;
    border: 0;
    border-top: 1px solid #ddd;
}

/* --- Buttons & Controls --- */
/* Spinner inside buttons */
.ainp-wrap button.button .spinner {
    visibility: hidden; /* Hide spinner by default */
    display: none;
    float: none; /* Override WP default float */
    vertical-align: middle; /* Align spinner with text */
    margin: 0 0 0 5px !important; /* Adjust spacing */
}

.ainp-wrap button.button .spinner.is-active {
    visibility: visible !important;
    display: inline-block !important;
}

/* Disabled button state */
.ainp-wrap button.button:disabled,
.ainp-wrap button.button.is-busy {
    cursor: wait;
    opacity: 0.7;
}

/* --- Welcome Panel & Dashboard --- */
.ainp-welcome-panel {
    position: relative;
    background-color: #fff;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #007cba; /* Accent color */
    border-radius: 4px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.ainp-welcome-panel h2 {
    margin-top: 0;
    font-size: 1.5em;
    margin-bottom: 15px;
}

.ainp-welcome-panel ul {
    list-style-type: disc;
    margin: 0 0 15px 25px;
}
.ainp-welcome-panel li {
    margin-bottom: 8px;
}

/* Dismiss button for welcome panel */
.ainp-welcome-panel .notice-dismiss {
    position: absolute;
    top: 10px;
    right: 10px;
    text-decoration: none;
}

/* Dashboard Statistics Cards */
.ainp-dashboard-stat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.ainp-stat-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ainp-stat-card .stat-icon .dashicons {
    font-size: 32px;
    color: #007cba;
    line-height: 1;
}

.ainp-stat-card .stat-value {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.1;
    color: #1d2327;
}

.ainp-stat-card .stat-label {
    font-size: 13px;
    color: #50575e;
}

/* Dashboard Main Content Layout */
.ainp-dashboard-main-content {
    display: grid;
    grid-template-columns: 1fr 340px; /* Main column and sidebar */
    gap: 30px;
}

@media (max-width: 960px) {
    .ainp-dashboard-main-content {
        grid-template-columns: 1fr;
    }
}

.dashboard-column-actions,
.dashboard-column-settings {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
}

.ainp-dashboard-main-content h3 {
    margin-top: 0;
    font-size: 1.3em;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* Action/Control item layout */
.action-item,
.control-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f1;
}
.action-item:last-child,
.control-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.action-label h4,
.control-label h4 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.action-label .description,
.control-label .description {
    font-size: 13px;
    color: #50575e;
    margin: 0;
}

/* Quick Links buttons */
.ainp-quick-links .button {
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
}
.ainp-quick-links h3 {
    margin-top: 30px;
}

/* Search Depth Options */
.search-depth-options {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f1;
}

/* --- Status & Logs Page --- */
.top-section-wrapper {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .top-section-wrapper {
        grid-template-columns: 1fr;
    }
}

.status-area-container,
.maintenance-actions-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 25px;
    border-radius: 8px;
}

.maintenance-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.maintenance-actions-grid .action-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    border: none;
    padding: 0;
    margin: 0;
}

.maintenance-actions-grid .action-item .button {
    width: 100%;
    text-align: center;
}

.maintenance-actions-grid .action-item p {
    margin: 0;
    font-size: 12px;
    text-align: center;
}

/* Status display grid */
.status-grid {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 10px 15px;
    align-items: center;
}

.status-label { font-weight: 600; color: #3c434a; }
.status-value { font-weight: 500; }
.status-bar { grid-column: 1 / -1; margin: 5px 0; }
.status-cancel-button { justify-self: end; }

.status-message-text {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f1;
    color: #50575e;
    font-size: 13px;
}

/* Progress Bar */
.progress-bar-wrapper {
    background-color: #e0e0e0;
    border-radius: 4px;
    height: 14px;
    overflow: hidden;
}

.progress-bar-inner {
    background-color: #007cba;
    height: 100%;
    width: 0%;
    transition: width 0.4s ease-in-out;
    border-radius: 4px;
}

/* Log Area */
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#ainp-log-area {
    background-color: #f6f7f7;
    border: 1px solid #e0e0e0;
    padding: 10px 15px;
    height: 500px;
    overflow-y: scroll;
    font-family: monospace;
    font-size: 13px;
    border-radius: 6px;
    color: #3c434a;
}

#ainp-log-area ul.ainp-log-list { list-style: none; margin: 0; padding: 0; }
#ainp-log-area li.log-entry { padding: 8px 5px; border-bottom: 1px dotted #dcdcde; }
#ainp-log-area li.log-entry:last-child { border-bottom: none; }

.log-main-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.log-timestamp { color: #787c82; white-space: nowrap; }

.log-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.log-type-info { background-color: #007cba; }
.log-type-success { background-color: #008a20; }
.log-type-warning { background-color: #dba617; color: #1d2327; }
.log-type-error { background-color: #d63638; }

.log-message { flex-grow: 1; }
.log-details { margin-left: 10px; margin-top: 4px; color: #787c82; font-size: 12px; }

/* Toggle Switch */
.control-switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.control-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #007cba; }
input:focus + .slider { box-shadow: 0 0 1px #007cba; }
input:checked + .slider:before { transform: translateX(26px); }

/* --- AJAX Status --- */
.ainp-ajax-status .notice { margin: 5px 0 15px 0 !important; padding: 10px 15px !important; }

/* =========================================================
   AINP - PRO Features & Info Panels (Refactored)
   ========================================================= */

/* Informational Panel (Replaces Locked Forms) */
.ainp-pro-wrapper {
    background: #fcfcfc;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-top: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

/* Use this specifically when you want to block content, not text */
.ainp-pro-content.is-blocked {
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
    filter: blur(1px);
}

.ainp-pro-content {
    padding: 20px;
}

/* Informational "Available in Pro" Box (Upsell) */
.ainp-pro-box {
    background: #f0f6fc; /* Light blue tint */
    border: 1px solid #cce5ff;
    border-radius: 6px;
    padding: 20px;
    margin-top: 25px;
    text-align: center;
}
.ainp-pro-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #1d2327;
}
.ainp-pro-box p {
    margin-bottom: 15px;
    color: #50575e;
}

/* Simple Status Panel (For Advanced Settings Status) */
.ainp-status-panel {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 0 20px; /* Table inside handles spacing */
    margin-bottom: 20px;
}
.ainp-status-panel .form-table th {
    padding: 20px 10px 20px 0;
}
.ainp-status-panel .form-table td {
    padding: 20px 0;
}

/* API Settings Panels */
.ainp-panel-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}
.ainp-status-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f1;
}
.ainp-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Code Preview Box (Refined to match removed inline style) */
.ainp-code-preview {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 10px;
    max-height: 150px;
    max-width: 800px;
    overflow-y: auto;
    font-family: monospace;
    margin-bottom: 8px;
    font-size: 12px;
}

/* Source Limit Notice (Replaces inline style in tab-sources-settings.php) */
.source-limit-reached-notice {
    background: #fff8e5;
    border-left: 4px solid #dba617;
    padding: 10px 15px;
    margin-bottom: 15px;
}

/* --- Badges & Buttons --- */
.ainp-pro-badge-small {
    background: #2271b1;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 6px;
}

.ainp-upgrade-link {
    font-size: 12px;
    text-decoration: none;
    margin-left: 5px;
    color: #2271b1;
    font-weight: 600;
}
.ainp-upgrade-link:hover { text-decoration: underline; }

/* --- Modules Tab Specifics --- */
.ainp-modules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.module-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.module-card-inner {
    padding: 20px 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Locked Card Style (Info Only) */
.module-card.ainp-pro-card {
    background: #f9f9f9;
    border-style: dashed;
}
.module-card.ainp-pro-card h3 .dashicons {
    font-size: 18px;
    color: #999;
    vertical-align: text-bottom;
}

.module-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 10px;
}

.module-card .description {
    font-size: 13px;
    color: #50575e;
    margin-bottom: 15px;
    flex-grow: 1;
}

.module-card label {
    margin-top: auto;
    display: block;
    cursor: pointer;
}

/* Dashboard Fetch Pro Wrapper */
.ainp-fetch-pro-wrapper {
    margin-top: 10px;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 4px;
    padding: 10px;
    font-size: 13px;
}
.ainp-fetch-pro-badge {
    font-size: 10px;
    font-weight: bold;
    color: #2271b1;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}
.ainp-fetch-pro-content {
    opacity: 0.7;
}