/* Post2Podcast Admin Styles */
.post2podcast-credits-info-metabox p {
    margin-bottom: 0.5em;
}
.post2podcast-credits-info-metabox strong {
    font-weight: bold;
}

/* =============================================
   TIER STATUS CARDS
   Modern, clean design for user tiers display
   ============================================= */

/* Base Card Styles */
.post2podcast-tier-card {
    background: #ffffff;
    max-width: 550px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin: 20px 0;
    overflow: hidden;
    border: 1px solid #e1e4e8;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post2podcast-tier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

/* Card Header */
.post2podcast-tier-header {
    display: flex;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #f0f2f5;
}

/* Tier Badge */
.post2podcast-tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Card Content */
.post2podcast-tier-content {
    padding: 20px 24px;
}

/* Credits Display */
.post2podcast-credits-display {
    margin: 20px 0;
}

.post2podcast-credits-count {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.post2podcast-credits-label {
    font-size: 13px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    display: block;
}

/* Progress Bar */
.post2podcast-credits-meter {
    height: 10px;
    background: #f0f2f5;
    border-radius: 10px;
    margin: 15px 0 20px;
    overflow: hidden;
    position: relative;
}

.post2podcast-credits-progress {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.post2podcast-credits-progress:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.1) 0%, 
        rgba(255,255,255,0.3) 50%, 
        rgba(255,255,255,0.1) 100%);
    animation: shimmer 2s infinite linear;
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Tier Features */
.post2podcast-tier-features {
    margin: 20px 0;
    padding: 0;
    list-style: none;
}

.post2podcast-tier-feature {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
}

.post2podcast-tier-feature:before {
    content: '✓';
    color: #48bb78;
    margin-right: 10px;
    font-weight: bold;
    font-size: 16px;
    margin-top: 1px;
}

.post2podcast-tier-feature-negative {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.post2podcast-tier-feature-negative:before {
    content: '✗';
    color: #ef4444;
    margin-right: 10px;
    font-weight: bold;
    font-size: 16px;
    margin-top: 1px;
}

/* Action Buttons */
.post2podcast-tier-actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f0f2f5;
}

/* =============================================
   PRO TIER SPECIFIC STYLES
   ============================================= */
.post2podcast-pro-tier-status .post2podcast-tier-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.post2podcast-pro-tier-status .post2podcast-credits-progress {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.post2podcast-pro-tier-status .post2podcast-tier-header {
    background: linear-gradient(135deg, #f8f9ff 0%, #f5f0ff 100%);
}

/* =============================================
   FREE TIER SPECIFIC STYLES
   ============================================= */
.post2podcast-free-tier-status .post2podcast-tier-badge {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    color: white;
}

.post2podcast-free-tier-status .post2podcast-credits-progress {
    background: linear-gradient(90deg, #a0aec0 0%, #718096 100%);
}

.post2podcast-free-tier-status .post2podcast-tier-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f5f9 100%);
}

/* =============================================
   BUTTON STYLES
   ============================================= */
.post2podcast-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.post2podcast-button:active {
    transform: translateY(1px);
}

.post2podcast-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.post2podcast-button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.post2podcast-button-secondary {
    background: #f8f9fa;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.post2podcast-button-secondary:hover {
    background: #edf2f7;
    transform: translateY(-1px);
}

.post2podcast-button .dashicons {
    margin-right: 6px;
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* =============================================
   OPTIONS CONTAINER (THREE-COLUMN LAYOUT)
   ============================================= */
.post2podcast-options-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.post2podcast-options-container .post2podcast-tier-card {
    flex: 1;
    min-width: 280px;
    max-width: none;
}

/* Self-hosted tier specific styles */
.post2podcast-self-hosted-tier .post2podcast-tier-badge {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
}

.post2podcast-self-hosted-tier .post2podcast-tier-header {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

/* Current option indicator */
.post2podcast-tier-card[style*="border: 2px solid"] {
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.15);
}

/* =============================================
   RESPONSIVE ADJUSTMENTS
   ============================================= */
@media screen and (max-width: 1200px) {
    .post2podcast-options-container {
        flex-direction: column;
    }
    
    .post2podcast-options-container .post2podcast-tier-card {
        min-width: auto;
        max-width: 100%;
    }
}

@media screen and (max-width: 782px) {
    .post2podcast-tier-card {
        margin: 15px 0;
    }
    
    .post2podcast-tier-content {
        padding: 16px;
    }
    
    .post2podcast-credits-count {
        font-size: 24px;
    }
    
    .post2podcast-options-container {
        gap: 15px;
    }
}
.post2podcast-error-text {
    color: #d63638; /* WordPress error red */
}
.post2podcast-success-text {
    color: #46b450; /* WordPress success green */
}
.post2podcast-hosted-notice {
    font-style: italic;
    color: #555;
    margin-top: 5px !important; /* Ensure it's below the checkbox/switch */
}
.ptp-self-hosted-description {
    margin-bottom: 1em; /* Add some space below the section description */
}

/* Meta Box Styles */
#post2podcast_meta .inside {
    padding-top: 10px;
}
#post2podcast_meta .speaker-controls {
    display: block; /* Changed from flex to block */
    margin-bottom: 15px;
}
#post2podcast_meta .speaker-control {
    margin-bottom: 15px; /* Add margin between stacked speaker controls */
    flex: 1;
    padding: 10px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    background-color: #fdfdfd;
}
#post2podcast_meta label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
#post2podcast_meta select,
#post2podcast_meta textarea {
    width: 100%;
    margin-bottom: 10px;
}
#post2podcast_meta .spinner {
    float: none;
    vertical-align: middle;
    margin-left: 5px;
    /* visibility: visible; */ /* Let display property handle it */
    display: none; /* Hide by default */
}
.post2podcast-regenerate-spinner.is-active,
.post2podcast-delete-podcast-spinner.is-active,
.audio-generation-actions .spinner.is-active {
    display: inline-block !important; /* Make sure spinner shows when active */
}

/* Generation Status & Preview in Meta Box */
.post2podcast-generation-status {
    border: 1px solid #ccd0d4;
    padding: 10px;
    margin-top: 15px;
    background-color: #fff;
}
.post2podcast-status-log {
    max-height: 150px;
    overflow-y: auto;
    background-color: #f9f9f9;
    border: 1px solid #e5e5e5;
    padding: 8px;
    margin-bottom: 10px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.6;
}
.post2podcast-status-log .status-message {
    margin-bottom: 5px;
    word-break: break-all;
}
.post2podcast-status-log .status-message .timestamp {
    color: #777;
    margin-right: 5px;
}
.post2podcast-status-log .status-message.error .message {
    color: #d63638;
}
.post2podcast-status-log .status-message.success .message {
    color: #46b450;
}
.post2podcast-status-log .status-message.info .message {
    color: #007cba;
}

.post2podcast-progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden; /* Ensures the inner bar respects the border radius */
}
.post2podcast-progress-bar {
    width: 0%;
    height: 20px;
    background-color: #4CAF50;
    text-align: center;
    line-height: 20px;
    color: white;
    font-weight: bold;
    border-radius: 4px;
    transition: width 0.3s ease-in-out;
}
.post2podcast-audio-preview-container {
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ccd0d4;
    background-color: #fff;
}
.post2podcast-audio-preview-player audio {
    width: 100%;
    margin-bottom: 5px;
}
.post2podcast-download-preview-link-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}
.post2podcast-audio-duration {
    color: #555;
}
.post2podcast-existing-audio-player {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    background-color: #f9f9f9;
}
.post2podcast-existing-audio-player audio {
    width: 100%;
    margin-bottom: 5px;
}
.post2podcast-delete-podcast-para {
    margin-top: 10px;
}

/* Instructions Section on Settings Page */
.post2podcast-instructions {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ccd0d4;
    background-color: #fff;
    border-radius: 4px;
}
.post2podcast-instructions h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.post2podcast-instructions .api-instruction {
    margin-bottom: 20px;
}
.post2podcast-instructions .api-instruction h4 {
    margin-bottom: 8px;
}
.post2podcast-instructions ol {
    margin-left: 20px;
    margin-bottom: 10px;
}
.post2podcast-instructions ol li {
    margin-bottom: 5px;
}
.post2podcast-instructions .description {
    font-size: 0.9em;
    color: #555;
}

/* Apple-style Switch for Self-Hosted Option */
.post2podcast-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  vertical-align: middle;
}
.post2podcast-switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.post2podcast-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}
.post2podcast-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}
input:checked + .post2podcast-slider {
  background-color: #2196F3; /* WordPress Blue or other preferred color */
}
input:focus + .post2podcast-slider {
  box-shadow: 0 0 1px #2196F3;
}
input:checked + .post2podcast-slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}
/* Rounded sliders */
.post2podcast-slider.round {
  border-radius: 34px;
}
.post2podcast-slider.round:before {
  border-radius: 50%;
}

/* Settings page specific styles for self-hosted section */
/* This class will be added/removed by JS to control visibility of fields */
.post2podcast-self-hosted-fields-hidden .form-table tr:not(:first-child) { /* Hide all but the first row (the switch itself) */
    display: none;
}
/* Ensure the description for the switch itself is always visible */
#self_hosted_enabled + .post2podcast-slider + .description {
    display: inline-block !important; 
}
#post2podcast-hosted-notice {
    margin-top: 5px;
}

/* Spinner for subscribe button */
.post2podcast-subscribe-spinner {
    display: none; /* Hidden by default */
    vertical-align: middle;
    margin-left: 5px;
}

/* Keyframe animation for spinning */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.post2podcast-subscribe-spinner.is-active {
    display: inline-block !important; /* Show when active */
}

/* Disabled switch styling */
.post2podcast-switch-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.post2podcast-switch-disabled input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.post2podcast-switch-disabled .post2podcast-slider {
    background-color: #ccc !important;
    cursor: not-allowed;
}

#post2podcast-bulk-generation-ui .post2podcast-podcast-options {
    margin-bottom: 20px;
}

.post2podcast-preview-column .post2podcast-status {
    font-style: italic;
}

.post2podcast-preview-column .post2podcast-status.processing {
    color: #ffb900;
}

.post2podcast-preview-column .post2podcast-status.completed {
    color: #46b450;
}

.post2podcast-preview-column .post2podcast-status.failed {
    color: #d63638;
}

/* =============================================
   RSS-TO-POST GENERATOR PROMO BANNER
   Modern, attractive cross-promotion design
   ============================================= */

.post2podcast-promo-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 0;
    margin: 30px 0;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post2podcast-promo-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 1;
}

.post2podcast-promo-banner:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.4);
}

.promo-banner-header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 24px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.promo-icon {
    width: 40px;
    height: 40px;
    stroke: #ffffff;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.promo-banner-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.promo-banner-content {
    background: #ffffff;
    padding: 32px;
    position: relative;
    z-index: 1;
}

.promo-description {
    color: #4a5568;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 24px;
}

.promo-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}

.promo-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #2d3748;
    font-size: 14px;
    line-height: 1.5;
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.promo-features li:hover {
    background: #edf2f7;
    transform: translateX(4px);
}

.check-icon {
    width: 20px;
    height: 20px;
    stroke: #48bb78;
    stroke-width: 3;
    flex-shrink: 0;
}

.promo-cta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.promo-button {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    padding: 14px 28px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 10px !important;
    text-decoration: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.3s ease !important;
    cursor: pointer;
}

.promo-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5) !important;
    color: #ffffff !important;
}

.promo-button:active {
    transform: translateY(0) !important;
}

.external-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.promo-rating {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stars {
    color: #f59e0b;
    font-size: 18px;
    letter-spacing: 2px;
}

.rating-text {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 6px;
}

/* Responsive Design */
@media screen and (max-width: 782px) {
    .promo-banner-header {
        padding: 20px 24px;
        flex-direction: column;
        text-align: center;
    }

    .promo-banner-header h3 {
        font-size: 20px;
    }

    .promo-banner-content {
        padding: 24px;
    }

    .promo-features {
        grid-template-columns: 1fr;
    }

    .promo-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .promo-button {
        width: 100%;
        justify-content: center;
    }

    .promo-rating {
        justify-content: center;
    }
}
