/**
 * translate.press.zone Admin Styles
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
    --presszone-translate-color-success: #46b450;
    --presszone-translate-color-error: #dc3232;
    --presszone-translate-color-warning: #ffb900;
    --presszone-translate-color-info: #00a0d2;
}

.dark-mode {
    --presszone-translate-color-success: #5cb85c;
    --presszone-translate-color-error: #e74c3c;
    --presszone-translate-color-warning: #f39c12;
    --presszone-translate-color-info: #3498db;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.presszone-translate-hidden {
    display: none !important;
}

.presszone-translate-modal--hidden {
    display: none;
}

.presszone-translate-col-datetime {
    width: 180px;
}

.presszone-translate-col-type {
    width: 200px;
}

.presszone-translate-col-severity {
    width: 100px;
}

.presszone-translate-col-ip {
    width: 150px;
}

.presszone-translate-icon-success {
    color: var(--presszone-translate-color-success);
}

.presszone-translate-icon-error {
    color: var(--presszone-translate-color-error);
}

.presszone-translate-progress-bar {
    width: 0%;
    transition: width 0.3s ease;
}

.presszone-translate-usage-bar {
    width: var(--presszone-translate-usage-percentage, 0%);
}

.presszone-translate-cursor-default {
    cursor: default;
}

.presszone-translate-inline-form {
    display: inline-block;
}

.presszone-translate-fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.presszone-translate-settings {
    max-width: 1200px;
}

.presszone-translate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    gap: 20px;
    flex-wrap: wrap;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.status-indicator.status-connected {
    background-color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.status-indicator.status-disconnected {
    background-color: #ef4444;
}

.status-indicator.status-verifying {
    background-color: #eab308;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-weight: 500;
    font-size: 14px;
}

/* Credit Balance Display */
.credit-balance-header {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.credit-balance-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 4px;
    font-size: 14px;
}

.credit-balance-display.credit-balance-low {
    background: #fef3c7;
    border-color: #f59e0b;
}

.credit-balance-label {
    font-weight: 500;
    color: #334155;
}

.credit-balance-value {
    font-weight: 700;
    font-size: 16px;
    color: #0369a1;
}

.credit-balance-display.credit-balance-low .credit-balance-value {
    color: #d97706;
}

.credit-balance-unit {
    font-size: 13px;
    color: #64748b;
}

.credit-balance-tier {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
}

.credit-balance-warning {
    margin: 0;
    padding: 6px 10px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    color: #92400e;
    font-size: 12px;
    font-weight: 500;
}

.presszone-translate-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.presszone-translate-section h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 18px;
}

.presszone-translate-section .description {
    color: #646970;
    font-size: 13px;
    margin-top: 5px;
}

.api-key-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-key-wrapper input[type="password"],
.api-key-wrapper input[type="text"] {
    flex: 1;
    max-width: 400px;
}

#api-key-status {
    margin-top: 8px;
    font-weight: 500;
}

#api-key-status.success {
    color: #22c55e;
}

#api-key-status.error {
    color: #ef4444;
}



/* Usage progress bar */
.usage-progress {
    width: 100%;
    max-width: 500px;
    height: 24px;
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    border: 1px solid #e5e7eb;
}

.usage-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.usage-bar.high-usage {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.usage-bar.critical-usage {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

#usage-stats p {
    margin: 8px 0;
}

#usage-stats strong {
    font-weight: 600;
    color: #1e293b;
}

/* Button states */
.button.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.button.loading::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Admin notices */
.notice.presszone-translate-notice {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notice.presszone-translate-notice::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.notice.notice-success.presszone-translate-notice::before {
    content: "✓";
    color: #22c55e;
    font-weight: bold;
    font-size: 18px;
}

.notice.notice-error.presszone-translate-notice::before {
    content: "✕";
    color: #ef4444;
    font-weight: bold;
    font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .presszone-translate-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .credit-balance-header {
        align-items: flex-start;
        width: 100%;
    }

    .credit-balance-display {
        flex-wrap: wrap;
    }

    .api-key-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .api-key-wrapper input {
        max-width: none;
    }

    .form-table th,
    .form-table td {
        display: block;
        width: 100%;
    }

    .form-table th {
        padding-bottom: 5px;
    }

    .form-table td {
        padding-top: 0;
    }
}

/* Accessibility */
.button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Dark mode support (if WordPress adds it) */
@media (prefers-color-scheme: dark) {
    .presszone-translate-section {
        background: #1e1e1e;
        border-color: #3e3e3e;
        color: #e0e0e0;
    }

    .presszone-translate-section h2 {
        border-bottom-color: #3e3e3e;
        color: #fff;
    }

    .form-table fieldset label {
        background: #2a2a2a;
        border-color: #3e3e3e;
        color: #e0e0e0;
    }

    .form-table fieldset label:hover {
        background: #333;
        border-color: #4a9eff;
    }

    .usage-progress {
        background: #2a2a2a;
        border-color: #3e3e3e;
    }

    #usage-stats strong {
        color: #fff;
    }

    .credit-balance-display {
        background: #1e3a4c;
        border-color: #0ea5e9;
    }

    .credit-balance-display.credit-balance-low {
        background: #3a351e;
        border-color: #f59e0b;
    }

    .credit-balance-label {
        color: #cbd5e1;
    }

    .credit-balance-value {
        color: #7dd3fc;
    }

    .credit-balance-display.credit-balance-low .credit-balance-value {
        color: #fbbf24;
    }

    .credit-balance-unit,
    .credit-balance-tier {
        color: #94a3b8;
    }

    .credit-balance-warning {
        background: #3a351e;
        border-color: #f59e0b;
        color: #fde68a;
    }
}

/* ==========================================================================
   WPML Editor Integration Styles
   ========================================================================== */

/* Auto-fill button in WPML editor */
.presszone-autofill-btn {
    margin-left: 10px;
    position: relative;
    min-width: 140px;
    transition: all 0.2s ease;
}

.presszone-autofill-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.presszone-autofill-btn.loading {
    padding-right: 35px;
}

.presszone-autofill-btn.loading::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: presszone-spin 0.6s linear infinite;
}

.presszone-autofill-btn.success {
    background-color: #22c55e;
    border-color: #16a34a;
    color: #fff;
}

@keyframes presszone-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Floating button container */
.presszone-autofill-floating {
    position: fixed;
    top: 50px;
    right: 20px;
    z-index: 9999;
    padding: 10px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Notification styles */
.presszone-notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    animation: presszone-slideIn 0.3s ease;
}

.presszone-notification--success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.presszone-notification--error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.presszone-notification--fadeout {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.presszone-notification__close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 16px;
    color: inherit;
    opacity: 0.7;
}

.presszone-notification__close:hover {
    opacity: 1;
}

.presszone-notification__close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

@keyframes presszone-slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Editor integration dark mode support */
@media (prefers-color-scheme: dark) {
    .presszone-autofill-floating {
        background: #1e1e1e;
        border-color: #3e3e3e;
    }

    .presszone-notification--success {
        background-color: #1e3a2a;
        border-color: #22c55e;
        color: #86efac;
    }

    .presszone-notification--error {
        background-color: #3a1e1e;
        border-color: #ef4444;
        color: #fca5a5;
    }
}

/* ==========================================================================
   Jobs Page Styles
   ========================================================================== */

.presszone-translate-jobs .wp-list-table {
    margin-top: 20px;
}

.presszone-translate-jobs .column-job-id {
    width: 120px;
}

.presszone-translate-jobs .column-languages {
    width: 120px;
}

.presszone-translate-jobs .column-model {
    width: 100px;
}

.presszone-translate-jobs .column-status {
    width: 150px;
}

.presszone-translate-jobs .column-tokens {
    width: 100px;
}

.presszone-translate-jobs .column-created,
.presszone-translate-jobs .column-completed {
    width: 140px;
}

/* Job Status Badges */
.job-status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.job-status-queued,
.job-status-sent,
.job-status-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.job-status-processing {
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #3b82f6;
}

.job-status-completed {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.job-status-failed {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.job-status-cancelled {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.job-error-message {
    color: #dc2626;
    font-style: italic;
}

/* Filters Section */
.presszone-translate-jobs .tablenav.top {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.presszone-translate-jobs .tablenav .alignleft.actions {
    flex: 1;
    min-width: 300px;
}

.presszone-translate-jobs .tablenav .alignright.actions {
    flex: 0 0 auto;
}

.presszone-translate-jobs #presszone-jobs-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.presszone-translate-jobs #presszone-jobs-filters select,
.presszone-translate-jobs #presszone-jobs-filters input[type="date"] {
    padding: 4px 8px;
    font-size: 13px;
}

.presszone-translate-jobs #presszone-jobs-search {
    display: flex;
    gap: 6px;
    align-items: center;
}

.presszone-translate-jobs #jobs-search-input {
    min-width: 200px;
}

/* Sortable Column Headers */
.presszone-translate-jobs .wp-list-table th.sortable a,
.presszone-translate-jobs .wp-list-table th.sorted a {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
}

.presszone-translate-jobs .wp-list-table th.sortable a:hover,
.presszone-translate-jobs .wp-list-table th.sortable a:focus {
    color: #2271b1;
}

.presszone-translate-jobs .wp-list-table th.sorted a {
    color: #2271b1;
}

.presszone-translate-jobs .wp-list-table .sorting-indicator::before {
    content: "↕";
    font-size: 14px;
    color: #646970;
    opacity: 0.5;
}

.presszone-translate-jobs .wp-list-table th.sorted.asc .sorting-indicator::before {
    content: "↑";
    opacity: 1;
    color: #2271b1;
}

.presszone-translate-jobs .wp-list-table th.sorted.desc .sorting-indicator::before {
    content: "↓";
    opacity: 1;
    color: #2271b1;
}

/* Pagination */
.presszone-translate-jobs .tablenav.bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

.presszone-translate-jobs .tablenav-pages {
    display: flex;
    align-items: center;
}

.presszone-translate-jobs .displaying-num {
    margin-left: 10px;
    font-size: 13px;
    color: #646970;
}

.presszone-translate-jobs .pagination-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.presszone-translate-jobs .pagination-links .button {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.presszone-translate-jobs .pagination-links .button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.presszone-translate-jobs .paging-input {
    margin: 0 8px;
}

.presszone-translate-jobs .tablenav-paging-text {
    font-size: 13px;
    color: #646970;
}

/* Responsive */
@media (max-width: 768px) {
    .presszone-translate-jobs .tablenav.top {
        flex-direction: column;
    }

    .presszone-translate-jobs .tablenav .alignleft.actions,
    .presszone-translate-jobs .tablenav .alignright.actions {
        width: 100%;
    }

    .presszone-translate-jobs #presszone-jobs-filters select,
    .presszone-translate-jobs #presszone-jobs-filters input[type="date"],
    .presszone-translate-jobs #jobs-search-input {
        width: 100%;
    }

    .presszone-translate-jobs .tablenav.bottom {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .presszone-translate-jobs .tablenav-pages {
        width: 100%;
        justify-content: center;
    }
}

/* Jobs page dark mode support */
@media (prefers-color-scheme: dark) {

    .presszone-translate-jobs .tablenav.top,
    .presszone-translate-jobs .tablenav.bottom {
        background: #1e1e1e;
        border-color: #3e3e3e;
    }

    .job-status-queued,
    .job-status-sent,
    .job-status-pending {
        background: #3a351e;
        color: #fbbf24;
        border-color: #92400e;
    }

    .job-status-processing {
        background: #1e293b;
        color: #93c5fd;
        border-color: #1e3a8a;
    }

    .job-status-completed {
        background: #1e3a2e;
        color: #6ee7b7;
        border-color: #065f46;
    }

    .job-status-failed {
        background: #3a1e1e;
        color: #fca5a5;
        border-color: #991b1b;
    }

    .job-status-cancelled {
        background: #2a2a2a;
        color: #9ca3af;
        border-color: #4b5563;
    }

    .job-error-message {
        color: #fca5a5;
    }

    .presszone-translate-jobs .displaying-num,
    .presszone-translate-jobs .tablenav-paging-text {
        color: #9ca3af;
    }
}

/* ==========================================================================
   Security Log Styles
   ========================================================================== */

/* Severity badges */
.tpz-severity-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tpz-severity-badge--low {
    background-color: #d4edda;
    color: #155724;
}

.tpz-severity-badge--medium {
    background-color: #fff3cd;
    color: #856404;
}

.tpz-severity-badge--high {
    background-color: #f8d7da;
    color: #721c24;
}

/* Details element */
.tpz-details {
    margin: 0;
}

.tpz-details-summary {
    cursor: pointer;
    color: #2271b1;
    text-decoration: none;
    font-size: 13px;
}

.tpz-details-summary:hover {
    color: #135e96;
    text-decoration: underline;
}

.tpz-details-content {
    margin: 8px 0 0 0;
    padding: 10px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Security log dark mode support */
@media (prefers-color-scheme: dark) {
    .tpz-severity-badge--low {
        background-color: #1e4620;
        color: #9be29d;
    }

    .tpz-severity-badge--medium {
        background-color: #5c4813;
        color: #f9e79f;
    }

    .tpz-severity-badge--high {
        background-color: #5a1a1a;
        color: #f8a5a9;
    }

    .tpz-details-content {
        background: #1e1e1e;
        border-color: #3c3c3c;
        color: #e0e0e0;
    }

    .tpz-details-summary {
        color: #72aee6;
    }

    .tpz-details-summary:hover {
        color: #9cc2e5;
    }
}

/* Responsive table */
@media screen and (max-width: 782px) {
    .wp-list-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .wp-list-table th {
        display: none;
    }

    .wp-list-table td:before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        margin-right: 10px;
    }
}