/* ============================================
   PopCash Advertiser — Admin Styles
   ============================================ */

.pcat-wrap {
    max-width: 1100px;
}

/* Campaign Monitor page - wider panel */
.pcat-wrap.pcat-monitor {
    max-width: 1320px;
}

/* Header banner */
.pcat-header-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5f8a 100%);
    color: #fff;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.pcat-header-banner p {
    margin: 0;
    font-size: 14px;
    opacity: 0.95;
}

/* Cards */
.pcat-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pcat-card-title {
    margin: 0 0 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pcat-card-title .dashicons {
    color: #2271b1;
    font-size: 22px;
    width: 22px;
    height: 22px;
}

/* Form table inside cards */
.pcat-card .form-table {
    margin-top: 0;
}

.pcat-card .form-table th {
    padding-left: 0;
    width: 200px !important;
    max-width: 200px !important;
}

.pcat-card .form-table td {
    padding-right: 0;
    width: auto !important;
}

/* API key field */
#pcat_api_key {
    font-family: monospace;
    letter-spacing: 0.5px;
}

#pcat-toggle-key {
    vertical-align: middle;
    margin-left: 4px;
}

#pcat-toggle-key .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

/* Connect/Disconnect buttons */
#pcat-connect,
#pcat-disconnect {
    margin-left: 8px !important;
}

#pcat-disconnect:hover {
    background: #c12a2c !important;
    border-color: #c12a2c !important;
}

#pcat-connection-status {
    display: inline-block;
    margin-left: 0;
    font-weight: 600;
    vertical-align: middle;
}

#pcat-connection-status.success {
    color: #00a32a;
}

#pcat-connection-status.error {
    color: #d63638;
}

#pcat-connection-status.loading {
    color: #996800;
}

/* Refresh button in targeting header */
#pcat-refresh-options {
    font-size: 12px;
}

#pcat-refresh-options .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Select2 overrides */
.pcat-wrap .select2-container {
    max-width: 600px;
}

.pcat-wrap .select2-container--default .select2-selection--multiple {
    border: 1px solid #8c8f94;
    border-radius: 4px;
    min-height: 38px;
    padding: 4px 6px;
}

.pcat-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #2271b1;
    border: none;
    color: #fff;
    border-radius: 3px;
    padding: 4px 8px 4px 10px;
    padding-right: 24px !important;
    font-size: 12px;
    position: relative;
    line-height: 1.4;
}

.pcat-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0 !important;
    padding: 2px 4px;
    font-weight: bold;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: end;
    border-right: none;
}

.pcat-wrap .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

/* Warning notices inside form */
.pcat-notice-warn {
    color: #996800 !important;
    font-style: italic;
}

/* Status badges */
.pcat-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Running (1) - Green */
.pcat-status-running {
    background: #e6f5ea;
    color: #00a32a;
}

/* Pending (0) - Orange/Yellow */
.pcat-status-pending {
    background: #fcf0e3;
    color: #996800;
}

/* Paused (3) - Gray */
.pcat-status-paused {
    background: #f0f0f1;
    color: #50575e;
}

/* Out of Funds (2) - Red */
.pcat-status-out-of-funds {
    background: #fce4e4;
    color: #d63638;
}

/* Out of Daily Funds (7) - Orange */
.pcat-status-out-of-daily-funds {
    background: #fff4e5;
    color: #cc6d00;
}

/* Scheduled Pause (8) - Blue/Gray */
.pcat-status-scheduled-pause {
    background: #e5f5fa;
    color: #0071a1;
}

/* Blocked (4) - Dark Red */
.pcat-status-blocked {
    background: #fce4e4;
    color: #8b0000;
}

/* System Blocked (9) - Dark Red */
.pcat-status-system-blocked {
    background: #fce4e4;
    color: #8b0000;
}

/* Deleted (5) - Dark Gray */
.pcat-status-deleted {
    background: #dcdcde;
    color: #2c3338;
}

/* Rejected (6) - Red */
.pcat-status-rejected {
    background: #fce4e4;
    color: #d63638;
}

/* Held (10) - Purple */
.pcat-status-held {
    background: #f0e5f5;
    color: #7e3fb8;
}

/* System Freezed (11) - Blue */
.pcat-status-system-freezed {
    background: #e5f0fa;
    color: #0066a0;
}

/* Legacy/fallback status classes */
.pcat-status-pending-approval {
    background: #fcf0e3;
    color: #996800;
}

.pcat-status-active {
    background: #e6f5ea;
    color: #00a32a;
}

.pcat-status-error {
    background: #fce4e4;
    color: #d63638;
}

/* Campaign log table */
.pcat-card .wp-list-table {
    border: none;
}

.pcat-card .wp-list-table thead th {
    font-weight: 600;
}

/* Submit button area */
.pcat-card .button-primary.button-large {
    padding: 6px 30px;
    height: auto;
    font-size: 14px;
}

/* Content Flags Checkboxes */
.pcat-content-flags {
    border: none;
    padding: 0;
}

.pcat-content-flags > div {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 500px;
    margin-bottom: 12px;
}

.pcat-checkbox-label {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #f6f7f7;
    cursor: pointer;
    transition: all 0.2s;
}

.pcat-checkbox-label:hover {
    background: #fff;
    border-color: #2271b1;
}

.pcat-checkbox-label input[type="checkbox"] {
    margin-right: 6px;
    vertical-align: middle;
}

.pcat-checkbox-label input[type="checkbox"]:checked + .pcat-flag-icon {
    color: #2271b1;
}

.pcat-flag-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: middle;
    color: #646970;
    transition: color 0.2s;
}

.pcat-content-flags .description {
    margin-top: 12px;
    margin-bottom: 0;
}

/* Title Tags */
.pcat-title-tags {
    border: none;
    padding: 0;
}

.pcat-title-tags-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 500px;
    margin-bottom: 12px;
}

.pcat-tag-label {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #f6f7f7;
    cursor: pointer;
    transition: all 0.2s;
}

.pcat-tag-label:hover {
    background: #fff;
    border-color: #2271b1;
}

.pcat-tag-label input[type="checkbox"] {
    margin-right: 6px;
    vertical-align: middle;
}

.pcat-tag-label input[type="checkbox"]:checked + .pcat-tag-icon {
    color: #2271b1;
}

.pcat-tag-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: middle;
    color: #646970;
    transition: color 0.2s;
}

.pcat-title-tags .description {
    margin-top: 0;
    margin-bottom: 0;
}

.pcat-tag-label.pcat-tag-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f1;
}

.pcat-tag-label.pcat-tag-disabled:hover {
    background: #f0f0f1;
    border-color: #dcdcde;
}

/* Budget, Targeting, and Delivery Sections - Disabled State */
.pcat-budget-section,
.pcat-targeting-section,
.pcat-delivery-section {
    position: relative;
}

.pcat-targeting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(3px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.pcat-targeting-message {
    text-align: center;
    padding: 40px 20px;
    max-width: 400px;
}

.pcat-targeting-message .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #996800;
    margin-bottom: 15px;
}

.pcat-targeting-message p {
    margin: 8px 0;
    color: #50575e;
}

.pcat-targeting-message strong {
    font-size: 16px;
    color: #1d2327;
}

/* Blur effect for budget, targeting, and delivery content when disabled */
.pcat-budget-section:has(.pcat-targeting-overlay) table,
.pcat-targeting-section:has(.pcat-targeting-overlay) table,
.pcat-delivery-section:has(.pcat-targeting-overlay) table {
    filter: blur(2px);
    pointer-events: none;
}

/* Campaign Monitor table adjustments */
.pcat-campaign-table {
    table-layout: auto;
    width: 100%;
    max-width: none;
}

.pcat-campaign-table th,
.pcat-campaign-table td {
    white-space: nowrap;
}

.pcat-campaign-table th:nth-child(1),
.pcat-campaign-table td:nth-child(1) {
    width: 50%;
    white-space: normal;
}

.pcat-campaign-table th:nth-child(2),
.pcat-campaign-table td:nth-child(2) {
    width: 25%;
}

.pcat-campaign-table th:nth-child(3),
.pcat-campaign-table td:nth-child(3) {
    width: 25%;
}

/* Bid and CPM field group */
.pcat-bid-cpm-group {
    display: flex !important;
    flex-direction: row !important;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.pcat-field-wrapper {
    flex: 0 0 auto;
    display: inline-block;
}

.pcat-field-wrapper label {
    margin-right: 10px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: #646970;
    vertical-align: middle;
}

.pcat-cpm-readonly {
    background-color: #f5f5f5 !important;
    border-color: #ddd !important;
    color: #555 !important;
    cursor: not-allowed !important;
    width: 80px !important;
}

/* Day Parting Container */
#pcat-day-parting-container {
    max-width: 100%;
    overflow-x: auto;
}

/* Day Parting Table */
.pcat-day-parting-table {
    border-collapse: collapse;
    width: auto !important;
    max-width: none !important;
    margin: 0;
    background: #fff;
    border: 1px solid #c3c4c7;
    table-layout: auto !important;
}

.pcat-day-parting-table thead th {
    padding: 8px 4px !important;
    text-align: center !important;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s ease;
    width: auto !important;
}

.pcat-day-parting-table thead th:first-child {
    width: 80px !important;
    cursor: pointer;
}

.pcat-day-parting-table thead th:hover {
    background: #e5e5e5;
}

.pcat-day-parting-table tbody td {
    padding: 8px 4px !important;
    text-align: center !important;
    border: 1px solid #c3c4c7;
    cursor: pointer;
    transition: background 0.2s ease;
    width: auto !important;
}

.pcat-day-parting-table tbody td.pcat-toggle-day {
    font-weight: 600;
    text-transform: capitalize;
    background: #f6f7f7;
    text-align: left !important;
    padding-left: 12px !important;
    width: 80px !important;
}

.pcat-day-parting-table tbody td.pcat-toggle-day:hover {
    background: #e5e5e5;
}

.pcat-day-parting-table tbody td.pcat-parting-cell:hover {
    background: #e5e5e5;
}

.pcat-day-parting-table .dashicons-yes.pcat-active {
    color: #00a32a;
    font-size: 18px;
}

.pcat-day-parting-table .dashicons-dismiss.pcat-inactive {
    color: #c3c4c7;
    font-size: 18px;
}

.pcat-toggle-all .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .pcat-bid-cpm-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .pcat-day-parting-table {
        font-size: 10px;
    }
    
    .pcat-day-parting-table thead th,
    .pcat-day-parting-table tbody td {
        padding: 4px 2px !important;
    }
}
    .pcat-card .form-table th {
        width: 100%;
        padding-bottom: 5px;
    }

    .pcat-card-title {
        flex-wrap: wrap;
    }
    
    .pcat-targeting-message {
        padding: 20px 15px;
    }
    
    .pcat-targeting-message .dashicons {
        font-size: 36px;
        width: 36px;
        height: 36px;
    }
}
