/**
 * Gu&Co AI Blog Writer - Admin Stylesheet
 * Premium UI Design System as specified in plugin.md
 */

.aisbw-admin {
    --wp-dark: #1d2327;
    --wp-primary-blue: #2271b1;
    --wp-hover-blue: #135e96;
    --solv-navy: #002E63;
    --solv-blue: #0077C8;
    --solv-cyan: #00B5E2;
    --background-gray: #f0f2f5;
    --card-white: #ffffff;
    --border-gray: #e2e8f0;
    --text-slate-500: #64748b;
    --text-dark: #1e293b;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.5;
    max-width: 1200px;
    margin: 20px auto 40px;
    padding: 0 15px;
}

/* Typography & Headings */
.aisbw-admin h1,
.aisbw-admin h2,
.aisbw-admin h3,
.aisbw-admin h4 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--solv-navy);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.aisbw-admin h1 {
    font-size: 26px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aisbw-admin h1::before {
    content: '\f309'; /* dashicons-welcome-write-blog */
    font-family: dashicons;
    color: var(--solv-blue);
    font-size: 28px;
}

.aisbw-admin h2 {
    font-size: 18px;
    margin-top: 30px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-gray);
    padding-bottom: 8px;
}

.aisbw-admin .wp-heading-inline {
    margin-right: 15px;
}

.aisbw-admin .page-title-action {
    background: #ffffff !important;
    border: 1px solid var(--border-gray) !important;
    color: var(--solv-blue) !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    padding: 6px 14px !important;
    transition: all 0.2s ease-in-out !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}

.aisbw-admin .page-title-action:hover {
    background: var(--solv-blue) !important;
    color: #ffffff !important;
    border-color: var(--solv-blue) !important;
    box-shadow: 0 4px 6px rgba(0, 119, 200, 0.15) !important;
}

/* Card Containers */
.aisbw-panel,
.aisbw-admin .postbox,
.aisbw-admin .card {
    background: var(--card-white);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease;
}

.aisbw-panel:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.aisbw-panel h2 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 16px;
    color: var(--solv-navy);
}

.aisbw-panel-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--text-slate-500);
    margin-bottom: 8px;
    display: block;
}

/* Tables (List views) */
.aisbw-table.wp-list-table {
    border: 1px solid var(--border-gray) !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
    border-radius: 8px !important;
    overflow: hidden;
    background: var(--card-white);
    border-collapse: collapse;
    margin-top: 20px;
}

.aisbw-table th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-gray) !important;
    font-weight: 700 !important;
    color: var(--solv-navy) !important;
    padding: 14px 12px !important;
}

.aisbw-table td {
    padding: 14px 12px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid var(--border-gray) !important;
}

.aisbw-table tbody tr:hover {
    background-color: #f8fafc;
}

.aisbw-admin .column-id {
    width: 60px;
}

/* Navigation tabs */
.aisbw-settings-tabs.nav-tab-wrapper {
    border-bottom: 2px solid var(--border-gray) !important;
    margin-bottom: 24px !important;
    padding-top: 0 !important;
}

.aisbw-settings-tabs .nav-tab {
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    color: var(--text-slate-500) !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    padding: 10px 16px !important;
    margin: 0 8px 0 0 !important;
    transition: all 0.2s ease !important;
}

.aisbw-settings-tabs .nav-tab:hover {
    color: var(--solv-blue) !important;
    border-bottom-color: var(--solv-blue) !important;
}

.aisbw-settings-tabs .nav-tab-active {
    color: var(--solv-blue) !important;
    border-bottom: 2px solid var(--solv-blue) !important;
    background: transparent !important;
}

/* Form Tables & Fields */
.aisbw-admin .form-table th {
    font-weight: 600;
    color: var(--solv-navy);
    width: 200px;
    padding: 20px 10px 20px 0;
}

.aisbw-admin .form-table td {
    padding: 15px 10px;
}

.aisbw-admin input[type="text"],
.aisbw-admin input[type="number"],
.aisbw-admin input[type="password"],
.aisbw-admin select,
.aisbw-admin textarea {
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 8px 12px;
    background: #ffffff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.aisbw-admin input[type="text"]:focus,
.aisbw-admin input[type="number"]:focus,
.aisbw-admin input[type="password"]:focus,
.aisbw-admin select:focus,
.aisbw-admin textarea:focus {
    border-color: var(--solv-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 119, 200, 0.15) !important;
    outline: none !important;
}

/* Toggle Switches */
.aisbw-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    vertical-align: middle;
    margin-right: 8px;
}

.aisbw-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.aisbw-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 22px;
}

.aisbw-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.aisbw-switch input:checked + .aisbw-slider {
    background-color: #10b981; /* Green */
}

.aisbw-switch input:focus + .aisbw-slider {
    box-shadow: 0 0 1px #10b981;
}

.aisbw-switch input:checked + .aisbw-slider:before {
    transform: translateX(22px);
}

/* Radio Cards (Autocomplete/cron settings) */
.aisbw-radio-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.aisbw-radio-card {
    position: relative;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    padding: 20px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.aisbw-radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.aisbw-radio-card:hover {
    border-color: #cbd5e1;
}

.aisbw-radio-card.active {
    border-color: var(--solv-blue);
    background-color: #f8fafc;
}

.aisbw-radio-card .card-icon {
    font-size: 28px;
    color: var(--solv-blue);
    margin-bottom: 12px;
}

.aisbw-radio-card .card-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--solv-navy);
}

.aisbw-radio-card .card-description {
    font-size: 12px;
    color: var(--text-slate-500);
}

/* Buttons */
.aisbw-admin .button-primary {
    background: var(--solv-blue) !important;
    border-color: var(--solv-blue) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    padding: 6px 18px !important;
    height: auto !important;
    line-height: normal !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    text-shadow: none !important;
    transition: all 0.2s ease !important;
}

.aisbw-admin .button-primary:hover {
    background: var(--wp-hover-blue) !important;
    border-color: var(--wp-hover-blue) !important;
    box-shadow: 0 4px 6px rgba(0, 119, 200, 0.15) !important;
}

.aisbw-admin .button-secondary {
    background: #ffffff !important;
    border: 1px solid var(--border-gray) !important;
    color: var(--text-dark) !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    padding: 6px 14px !important;
    height: auto !important;
    line-height: normal !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease !important;
}

.aisbw-admin .button-secondary:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: var(--solv-blue) !important;
}

/* Modern Status Badges */
.aisbw-status {
    display: inline-block;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
}

/* W kolejce / Pomysł / Queued */
.aisbw-status-idea,
.aisbw-status-queued {
    background: #cfe2ff !important;
    color: #084298 !important;
    border: 1px solid #b6d4fe !important;
}

/* Szkic WP / Szkic gotowy */
.aisbw-status-wp_draft_created,
.aisbw-status-draft_ready {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    border: 1px solid #badbcc !important;
}

/* Do weryfikacji / Do recenzji */
.aisbw-status-review_required,
.aisbw-status-review {
    background: #fff3cd !important;
    color: #664d03 !important;
    border: 1px solid #ffecb5 !important;
}

/* Approved */
.aisbw-status-approved {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    border: 1px solid #badbcc !important;
}

/* Failed */
.aisbw-status-failed,
.aisbw-status-rejected {
    background: #f8d7da !important;
    color: #842029 !important;
    border: 1px solid #f5c2c7 !important;
}

/* Connections Badges */
.aisbw-api-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    margin-top: 8px;
    font-size: 13px;
}

.aisbw-api-status.connected {
    color: #10b981;
}

.aisbw-api-status.disconnected {
    color: #ef4444;
}

/* Inline / Actions List */
.aisbw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.aisbw-actions a {
    color: var(--solv-blue);
    text-decoration: none;
    font-weight: 600;
}

.aisbw-actions a:hover {
    color: var(--solv-navy);
    text-decoration: underline;
}

.aisbw-actions .aisbw-confirm-delete {
    color: #ef4444;
}

.aisbw-actions .aisbw-confirm-delete:hover {
    color: #b91c1c;
}

.aisbw-inline-form {
    display: inline;
    margin: 0;
}

/* Progress bar & load loading animation */
.aisbw-progress-container {
    width: 100%;
    background-color: var(--border-gray);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-top: 15px;
}

.aisbw-progress-bar {
    height: 100%;
    width: 0;
    background-color: var(--solv-cyan);
    transition: width 0.4s ease;
}

/* Creator Columns */
.aisbw-creator-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.aisbw-code {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border-gray);
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    white-space: pre-wrap;
}

.aisbw-error-text {
    color: #ef4444;
    margin-top: 6px;
    font-size: 12px;
}

/* Responsive styles */
@media (max-width: 960px) {
    .aisbw-creator-columns {
        grid-template-columns: 1fr;
    }
    .aisbw-radio-cards {
        grid-template-columns: 1fr;
    }
    .aisbw-admin .form-table th {
        width: auto;
        display: block;
        padding-bottom: 5px;
    }
    .aisbw-admin .form-table td {
        display: block;
        padding-left: 0;
    }
}

/* Hide external notices from other plugins on our pages */
#wpbody-content > .notice,
#wpbody-content > .update-nag,
#wpbody-content > .error,
#wpbody-content > .updated,
#wpbody-content > .update-message,
.update-nag {
    display: none !important;
}

/* Ensure our own notices inside the plugin wrapper are still visible */
.aisbw-admin .notice,
.aisbw-admin .error,
.aisbw-admin .updated {
    display: block !important;
}

.aisbw-switch-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.aisbw-switch-disabled .aisbw-slider {
    background-color: #cbd5e1;
}
