/**
 * Alt-Text AI Admin Styles
 * Modern, clean design for WordPress admin interface
 */

:root {
    --primary-color: #2563EB;
    /* Modern Blue */
    --primary-hover: #1D4ED8;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --bg-light: #F3F4F6;
    --bg-white: #FFFFFF;
    --border-color: #E5E7EB;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ===== GLOBAL STYLES ===== */
.alt-text-pro-dashboard,
.alt-text-pro-settings,
.alt-text-pro-bulk-process,
.alt-text-pro-logs {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    max-width: 1200px;
    margin: 20px auto;
}

.alt-text-pro-dashboard *,
.alt-text-pro-settings *,
.alt-text-pro-bulk-process *,
.alt-text-pro-logs * {
    box-sizing: border-box;
}

/* ===== NOTICES ===== */
.alt-text-pro-notices-container {
    margin-bottom: 20px;
}

.alt-text-pro-notices-container .notice {
    margin: 5px 0 15px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/*
 * Safety-net: hide any admin notices that appear OUTSIDE our dedicated container.
 * These can leak from third-party plugins/themes or WordPress core despite
 * the PHP suppression (especially on WP 6.4+ where all_admin_notices was
 * deprecated). The selectors target notices at common WordPress injection
 * points while preserving notices inside our own container.
 */
.alt-text-pro-dashboard > .notice,
.alt-text-pro-dashboard > .updated,
.alt-text-pro-dashboard > .error,
.alt-text-pro-dashboard > .update-nag,
.alt-text-pro-settings > .notice,
.alt-text-pro-settings > .updated,
.alt-text-pro-settings > .error,
.alt-text-pro-settings > .update-nag,
.alt-text-pro-bulk-process > .notice,
.alt-text-pro-bulk-process > .updated,
.alt-text-pro-bulk-process > .error,
.alt-text-pro-bulk-process > .update-nag,
.alt-text-pro-logs > .notice,
.alt-text-pro-logs > .updated,
.alt-text-pro-logs > .error,
.alt-text-pro-logs > .update-nag {
    display: none !important;
}

/* ===== HEADER & NAVIGATION ===== */
.alt-text-pro-header {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alt-text-pro-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.alt-text-pro-logo img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
}

.alt-text-pro-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.alt-text-pro-nav {
    display: flex;
    gap: 8px;
    background: var(--bg-light);
    padding: 4px;
    border-radius: var(--radius-md);
}

.alt-text-pro-nav-item {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alt-text-pro-nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}

.alt-text-pro-nav-item.active {
    background: var(--bg-white);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.alt-text-pro-nav-item .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ===== CARDS & CONTAINERS ===== */
.alt-text-pro-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease;
}

.alt-text-pro-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-content {
    padding: 24px;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #EFF6FF;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Usage Progress */
.usage-progress-container {
    margin-top: 12px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Bulk Process Log Items */
.log-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    line-height: 1.4;
}

.log-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.log-item.success {
    color: var(--text-primary);
}

.log-item.error {
    color: var(--danger-color);
}

.log-item.skipped {
    color: var(--text-secondary);
    opacity: 0.8;
}

.log-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    margin-top: 2px;
    flex-shrink: 0;
}

.log-item.success .dashicons {
    color: var(--success-color);
}

.log-item.error .dashicons {
    color: var(--danger-color);
}

.log-item.skipped .dashicons {
    color: var(--text-secondary);
}

.log-filename {
    font-weight: 600;
    margin-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.log-error {
    font-size: 11px;
    opacity: 0.8;
    background: rgba(239, 68, 68, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== ACTION BUTTONS ===== */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    text-align: center;
    gap: 12px;
}

.action-btn:hover {
    border-color: var(--primary-color);
    background: #EFF6FF;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.action-btn .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.action-btn span {
    font-weight: 500;
}

/* ===== FORMS & INPUTS ===== */
.alt-text-pro-settings-form input[type="text"],
.alt-text-pro-settings-form input[type="password"],
.alt-text-pro-settings-form input[type="number"],
.alt-text-pro-settings-form select,
.alt-text-pro-settings-form textarea {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 14px;
    width: 100%;
    max-width: 400px;
    transition: border-color 0.2s ease;
}

.alt-text-pro-settings-form input:focus,
.alt-text-pro-settings-form select:focus,
.alt-text-pro-settings-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
    outline: none;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    cursor: pointer;
}

.checkbox-label {
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-left: 28px;
    margin-bottom: 16px;
}

/* ===== BUTTONS ===== */
.button-primary-custom {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: var(--radius-sm) !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
}

.button-primary-custom:hover {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

.button-secondary-custom {
    background: white !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: var(--radius-sm) !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
}

.button-secondary-custom:hover {
    background: var(--bg-light) !important;
    border-color: #D1D5DB !important;
}

/* ===== LOGS TABLE ===== */
.logs-table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.wp-list-table.logs-table {
    border: none;
    box-shadow: none;
}

.logs-table thead th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.logs-table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.logs-table tbody tr:last-child td {
    border-bottom: none;
}

.image-preview-small {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-light);
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.success {
    background: #D1FAE5;
    color: #065F46;
}

.status-badge.error {
    background: #FEE2E2;
    color: #991B1B;
}

.status-badge.warning {
    background: #FEF3C7;
    color: #92400E;
}

/* ===== LOADING SPINNER ===== */
.alt-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .alt-text-pro-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .alt-text-pro-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 8px;
    }

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

/* ===== ONBOARDING MODAL ===== */
.alt-text-pro-modal.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    overflow-y: auto;
    padding: 20px;
}

.alt-text-pro-modal.modal.active {
    display: flex;
}

.alt-text-pro-modal .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.alt-text-pro-modal .modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 0;
    max-width: 440px;
    width: 90%;
    z-index: 2;
    margin: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.alt-text-pro-modal .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.alt-text-pro-modal .modal-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

/* Modal Header */
.alt-text-pro-modal .modal-header {
    text-align: center;
    padding: 24px 24px 16px;
}

.alt-text-pro-modal .modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alt-text-pro-modal .modal-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Modal Body */
.alt-text-pro-modal .modal-body {
    padding: 16px 24px;
}

.alt-text-pro-modal .onboarding-step {
    position: relative;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all 0.2s;
}

.alt-text-pro-modal .onboarding-step:hover {
    border-color: #BFDBFE;
    background: #F8FAFC;
}

.alt-text-pro-modal .step-label {
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

.alt-text-pro-modal .onboarding-step p {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.alt-text-pro-modal .step-connector {
    text-align: center;
    position: relative;
    margin: 12px 0;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alt-text-pro-modal .step-connector::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
    transform: translateX(-50%);
    z-index: 0;
}

.alt-text-pro-modal .step-connector span {
    background: #fff;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

/* Fields & Inputs */
.alt-text-pro-modal .onboarding-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alt-text-pro-modal .onboarding-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.alt-text-pro-modal .input-wrapper {
    position: relative;
}

.alt-text-pro-modal .input-wrapper .input-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.alt-text-pro-modal .onboarding-field input {
    width: 100%;
    padding: 10px 12px 10px 34px;
    /* Space for icon */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
    background: #fff;
}

.alt-text-pro-modal .onboarding-field input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Buttons */
.alt-text-pro-modal .button-primary-custom.wide,
.alt-text-pro-modal .button-secondary-custom.wide {
    width: 100%;
    justify-content: center;
    padding: 10px 16px !important;
    height: 40px;
}

/* Footer */
.alt-text-pro-modal .modal-footer {
    padding: 0 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.alt-text-pro-modal .button-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.8;
}

.alt-text-pro-modal .button-link:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* Messages */
.alt-text-pro-modal .onboarding-message {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.alt-text-pro-modal .onboarding-message.success {
    color: var(--success-color);
    background: #ECFDF5;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #D1FAE5;
}

.alt-text-pro-modal .onboarding-message.error {
    color: var(--danger-color);
    background: #FEF2F2;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #FEE2E2;
}

/* Animations active state */
.alt-text-pro-modal.active .modal-overlay {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.alt-text-pro-modal.active .modal-content {
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== POSTS LIST - PER POST ALT TEXT ===== */
.column-alt_text_pro {
    width: 130px;
}

.atp-post-generate-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    font-size: 12px !important;
    padding: 2px 8px !important;
    height: auto !important;
    line-height: 1.6 !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: #EFF6FF !important;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.atp-post-generate-btn:hover {
    background: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

.atp-post-generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.atp-post-generate-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

@keyframes atp-spin {
    to {
        transform: rotate(360deg);
    }
}

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

.atp-post-badge {
    font-size: 11px;
    color: #9CA3AF;
}