/**
 * Plugin Name: Contest Winners Management
 * Filename: assets/css/admin-style.css
 * Version: cwm-2.10.0c
 * Description: Verwaltung und E-Mail-Versand an Contest-Gewinner mit WP Voting Contest PRO Integration
 * 1.2.0 CR: overhaul mailing and feedback token system 
 * 1.2.8 FIX: Feedback status display
 * 1.2.9 CR: Replacement templates and handling
 * 1.2.10 CR: Enhanced replacement status handling
 * 1.2.10b FIX: Nachnominiert badge to green
 * 1.2.11 CR: SMS button
 * 1.2.15 CR: bulk actions for status reset
 * 2.2.0 CR: Change status bar on sandbox system
 */

/* ===========================
   Layout & Container
   =========================== */

.cwm-admin-wrap {
    margin-top: 20px;
}

.cwm-version {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
    font-weight: normal;
}

.cwm-admin-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.cwm-content {
    flex: 1;
    min-width: 0;
}

.cwm-sidebar {
    width: 300px;
    flex-shrink: 0;
}

@media (max-width: 1200px) {
    .cwm-admin-layout {
        flex-direction: column;
    }
    
    .cwm-sidebar {
        width: 100%;
    }
}

/* ===========================
   Sections & Boxes
   =========================== */

.cwm-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
}

.cwm-filter-box,
.cwm-email-box {
    padding: 20px;
}

.cwm-filter-box h2,
.cwm-email-box h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #dcdcde;
}

/* ===========================
   Filter Section
   =========================== */

.cwm-filter-content {
    margin-top: 15px;
}

.cwm-year-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    background: #f6f7f7;
    border-radius: 4px;
}

.cwm-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.cwm-checkbox-label input {
    margin-right: 5px;
}

.cwm-checkbox-label span {
    font-weight: 500;
}

.cwm-filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.cwm-filter-submit {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.cwm-filter-info {
    color: #666;
    font-size: 13px;
    font-style: italic;
}

/* ===========================
   Winners Tables
   =========================== */

.cwm-winners-section {
    padding: 20px;
}

.cwm-winners-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cwm-winners-section h3 .count {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

.cwm-winners-section table {
    margin-top: 0;
}

.cwm-winners-section tbody tr:hover {
    background: #f0f8ff;
}

.cwm-winners-section tbody tr.updating {
    opacity: 0.6;
    pointer-events: none;
}

.cwm-placeholder,
.cwm-loading-placeholder {
    padding: 40px;
    text-align: center;
    background: #f6f7f7;
    border: 2px dashed #dcdcde;
    border-radius: 4px;
    color: #666;
}

.no-winners {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ===========================
   Status Badges
   =========================== */

.cwm-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.cwm-status.pending {
    background: #f0f0f1;
    color: #50575e;
}

.cwm-status.contacted {
    background: #f5e6d3;
    color: #8a6d3b;
}

.cwm-status.reminded {
    background: #fff3cd;
    color: #856404;
}

.cwm-status.confirmed {
    background: #d4edda;
    color: #155724;
}

.cwm-status.declined {
    background: #f8d7da;
    color: #721c24;
}

.cwm-status.nachnominiert {
    background: #d4edda;
    color: #155724;
}

.cwm-status.nr_contacted {
    background: #e3f2fd;
    color: #1565c0;
}

.cwm-status.nr_reminded {
    background: #fff3cd;
    color: #856404;
}

.cwm-status.nn_contacted {
    background: #e8f5e9;
    color: #2e7d32;
}

.cwm-status.nachgerueckt {
    background: #c8e6c9;
    color: #1b5e20;
}

/* ===========================
   E-Mail Form
   =========================== */

.cwm-email-content {
    margin-top: 15px;
}

.cwm-recipients-info {
    background: #f0f8ff;
    border: 1px solid #2271b1;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 20px;
}

.cwm-recipients-info p {
    margin: 0;
    font-size: 14px;
}

.cwm-recipients-info strong {
    color: #2271b1;
    font-size: 18px;
    margin-left: 5px;
}

#cwm-recipient-list {
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
}

#cwm-recipient-list ul {
    margin: 5px 0;
    padding-left: 20px;
}

.cwm-form-group {
    margin-bottom: 20px;
}

.cwm-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.cwm-form-group .required {
    color: #d63638;
}

.cwm-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
}

.cwm-select {
    min-width: 200px;
    padding: 5px;
}

.cwm-placeholders-info {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.cwm-placeholders-info p {
    margin: 0 0 5px 0;
    font-size: 13px;
    font-weight: 600;
}

.cwm-placeholder-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cwm-placeholder-tags code {
    background: #fff;
    border: 1px solid #2271b1;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.cwm-placeholder-tags code:hover {
    background: #2271b1;
    color: #fff;
}

.cwm-preview-box {
    background: #fff;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.cwm-preview-box h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #dcdcde;
}

.cwm-preview-content {
    padding: 15px;
    background: #f6f7f7;
    border-radius: 4px;
    margin-top: 10px;
}

.cwm-preview-subject {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dcdcde;
}

.cwm-form-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
}

.cwm-test-mode {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.cwm-imessage-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    margin-left: 20px;
}

#cwm-send-emails.test-mode {
    background: #ff9800;
    border-color: #ff9800;
}

/* iMessage Button */
#cwm-send-imessage {
    margin-left: 10px;
}

#cwm-send-imessage .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 5px;
}

#cwm-send-imessage:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===========================
   Sidebar Widgets
   =========================== */

.cwm-widget {
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
}

.cwm-widget h3 {
    margin: 0;
    padding: 12px 15px;
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
    font-size: 14px;
}

.cwm-widget-content {
    padding: 15px;
}

.cwm-widget-content ul {
    margin: 0;
    padding-left: 20px;
}

.cwm-widget-content li {
    margin-bottom: 5px;
}

.cwm-widget-content .button {
    width: 100%;
    margin-bottom: 10px;
}

.cwm-widget-content .description {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* ===========================
   Modal Dialog
   =========================== */

.cwm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.cwm-modal {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
}

.cwm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dcdcde;
}

.cwm-modal-header h3 {
    margin: 0;
}

.cwm-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cwm-modal-close:hover {
    color: #000;
}

.cwm-modal-content {
    padding: 20px;
}

.cwm-modal-content textarea {
    width: 100%;
    resize: vertical;
}

.cwm-status-update {
    margin-top: 15px;
}

.cwm-status-update label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cwm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
}

/* ===========================
   Loading Overlay
   =========================== */

.cwm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.cwm-loading-overlay .spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: cwm-spin 1s linear infinite;
}

@keyframes cwm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 782px) {
    .cwm-year-checkboxes {
        flex-direction: column;
    }
    
    .cwm-filter-submit {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cwm-form-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cwm-winners-section {
        padding: 10px;
    }
    
    .cwm-winners-section table {
        font-size: 12px;
    }
    
    .cwm-modal {
        width: 95%;
    }
}

/* ===========================
   Template Management
   =========================== */

.cwm-template-field {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
    border: 1px solid #e1e1e1;
}

.cwm-template-field:hover {
    background: #fff;
    border-color: #2271b1;
}

.cwm-template-subject {
    margin-bottom: 20px;
}

.cwm-template-subject label,
.cwm-template-body label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #23282d;
}

.cwm-template-body {
    margin-bottom: 15px;
}

.cwm-attachment-field {
    background: #fff;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.cwm-attachment-field label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 600;
}

.cwm-attachment-name {
    display: inline-block;
    margin-left: 10px;
    color: #0073aa;
    font-weight: 500;
}

.cwm-placeholder-bar {
    padding: 8px;
    background: #f0f0f1;
    border-radius: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cwm-placeholder-btn {
    background: #fff;
    border: 1px solid #2271b1;
    padding: 2px 8px;
    border-radius: 3px;
    color: #2271b1;
    text-decoration: none;
    transition: all 0.2s;
}

.cwm-placeholder-btn:hover {
    background: #2271b1;
    color: #fff;
}

/* Token Status Badges erweitert */
.cwm-status.token_sent {
    background: #e3f2fd;
    color: #1565c0;
}

.cwm-status.confirmed {
    background: #e8f5e9;
    color: #2e7d32;
}

.cwm-status.declined {
    background: #ffebee;
    color: #c62828;
}

/* Template Info Boxes */
.cwm-template-field .description {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 4px;
}

.cwm-template-field .description .dashicons {
    margin-right: 5px;
    vertical-align: middle;
}

/* Confirmation Page Styles */
.cwm-confirmation-page {
    background: #f5f5f5;
    min-height: 400px;
    padding: 40px 20px;
}

.cwm-confirmation-box {
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cwm-confirmation-success {
    padding: 20px;
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    margin: 20px 0;
}

.cwm-confirmation-error {
    padding: 20px;
    background: #ffebee;
    border-left: 4px solid #f44336;
    margin: 20px 0;
}

.cwm-confirmation-waiting {
    padding: 20px;
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    margin: 20px 0;
}

/* ===========================
   Bulk-Aktionen
   =========================== */

.cwm-bulk-actions-bar {
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 12px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cwm-bulk-actions-bar label {
    font-weight: 600;
    margin: 0;
}

.cwm-bulk-actions-bar select {
    min-width: 200px;
}

.cwm-bulk-actions-bar .button {
    margin: 0;
}

@media (max-width: 782px) {
    .cwm-bulk-actions-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cwm-bulk-actions-bar select {
        width: 100%;
    }
}

/* ===========================
   Sandbox Environment Marker
   =========================== */

body.cwm-sandbox-env #wpadminbar {
    background: #dc3232 !important;
}

body.cwm-sandbox-env #wpadminbar .ab-item,
body.cwm-sandbox-env #wpadminbar a.ab-item,
body.cwm-sandbox-env #wpadminbar > #wp-toolbar span.ab-label,
body.cwm-sandbox-env #wpadminbar > #wp-toolbar span.noticon {
    color: #fff !important;
}

body.cwm-sandbox-env #wpadminbar .ab-top-menu > li.hover > .ab-item,
body.cwm-sandbox-env #wpadminbar .ab-top-menu > li:hover > .ab-item,
body.cwm-sandbox-env #wpadminbar .ab-top-menu > li > .ab-item:focus {
    background: #a00 !important;
    color: #fff !important;
}