/* P&S Generator Public Styles */

/* Namespace all styles to avoid conflicts */
.ps-posters-form {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Template Selector */
.ps-template-selector {
    margin-bottom: 30px;
}

.ps-template-selector h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.ps-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.ps-template-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.ps-template-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.ps-template-card.selected {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
}

.ps-template-card h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2em;
}

.ps-template-card p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

.ps-select-template {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.ps-select-template:hover {
    background: #005a87;
}

/* Form Section */
.ps-form-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ps-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.ps-form-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.4em;
}

.ps-change-template {
    color: #0073aa;
    text-decoration: none;
    font-size: 0.9em;
    background: none;
    border: none;
    cursor: pointer;
}

.ps-change-template:hover {
    text-decoration: underline;
}

/* Form Fields */
.ps-form-fields {
    margin-bottom: 25px;
}

.ps-field-group {
    margin-bottom: 20px;
}

.ps-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.ps-field-group label.required:after {
    content: " *";
    color: #d63638;
}

.ps-field-group input,
.ps-field-group textarea,
.ps-field-group select {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.ps-field-group input:focus,
.ps-field-group textarea:focus,
.ps-field-group select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
}

.ps-field-group textarea {
    min-height: 80px;
    resize: vertical;
}

.ps-field-group input[type="color"] {
    max-width: 80px;
    height: 40px;
    padding: 0;
    cursor: pointer;
}

.ps-field-group .field-description {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.ps-field-error {
    color: #d63638;
    font-size: 0.85em;
    margin-top: 5px;
}

/* Form Actions */
.ps-form-actions {
    text-align: center;
    margin-top: 25px;
}

/* Layout adjustments for form and preview */
#ps-form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

#ps-form-container .psg-form {
    flex: 1 1 45%;
    min-width: 300px;
}

/* hide placeholder only when we have an image */
#ps-preview.has-image #ps-preview-placeholder { display:none; }
#ps-preview.has-image img { display:block; }


#ps-form-container #ps-preview {
    flex: 1 1 45%;
    min-width: 300px;
    /* Ensure the preview container has at least some height even when
       no preview image is loaded. This prevents the layout from
       jumping when the preview appears. */
    min-height: 400px;
    position: relative;
}

/* Placeholder styling for the preview. Center the text and draw a dashed border
   around the area to visually indicate that a preview will appear here. */
#ps-preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #777;
    border: 2px dashed #ccc;
    border-radius: 4px;
    padding: 20px;
    box-sizing: border-box;
    font-size: 0.95em;
    text-align: center;
}


@media (max-width: 768px) {
    #ps-form-container {
        flex-direction: column;
    }
    #ps-form-container .psg-form,
    #ps-form-container #ps-preview {
        min-width: 100%;
    }
}



/* Loading State */
.ps-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

/* Spinner (shared) */

.ps-spinner{
  width:16px; height:16px;
  border:2px solid #c9c9c9;
  border-top-color:#333;
  border-radius:50%;
  display:none;
  animation:psspin .8s linear infinite;
}

/* show spinner when busy */
.ps-actions.is-loading .ps-spinner,
.ps-loading.is-active .ps-spinner { display:inline-block; }

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


.ps-loading-text {
    color: #666;
    font-size: 0.9em;
}

/* Result Section */
.ps-result {
    margin-top: 25px;
    padding: 20px;
    border-radius: 4px;
}

.ps-success {
    background: #f0f9ff;
    border: 1px solid #0073aa;
    color: #333;
}

.ps-success h4 {
    margin: 0 0 15px 0;
    color: #0073aa;
}

.ps-download-section {
    margin-bottom: 20px;
}


.ps-error {
    background: #fcf0f1;
    border: 1px solid #d63638;
    color: #333;
}

.ps-error h4 {
    margin: 0 0 10px 0;
    color: #d63638;
}

.ps-error-message {
    margin: 0;
    color: #666;
}

/* CTA Banner */
.ps-cta-banner {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.ps-cta-banner h5 {
    margin: 0 0 10px 0;
    color: #856404;
}

.ps-cta-banner p {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 0.9em;
}

.ps-cta-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ps-cta-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.ps-cta-primary {
    background: #007cba;
    color: #fff;
}

.ps-cta-primary:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.ps-cta-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.ps-cta-secondary:hover {
    background: #e9ecef;
    color: #333;
    text-decoration: none;
}

/* Gates */
.ps-password-gate,
.ps-token-gate,
.ps-wc-gate {
    max-width: 400px;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.ps-gate-content h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.ps-gate-content p {
    margin: 0 0 20px 0;
    color: #666;
    line-height: 1.5;
}

.ps-gate-form {
    text-align: left;
}

.ps-gate-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 16px;
}

.ps-gate-form button {
    width: 100%;
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.ps-gate-form button:hover {
    background: #005a87;
}

.ps-gate-error {
    background: #fcf0f1;
    border: 1px solid #d63638;
    color: #d63638;
    padding: 10px;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ps-posters-form {
        margin: 0 15px;
    }
    
    .ps-template-grid {
        grid-template-columns: 1fr;
    }
    
    .ps-form-section {
        padding: 20px;
    }
    
    .ps-form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ps-field-group input,
    .ps-field-group textarea,
    .ps-field-group select {
        max-width: 100%;
    }
    
    .ps-cta-actions {
        flex-direction: column;
    }
    
    .ps-cta-btn {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .ps-template-card {
        padding: 15px;
    }
    
    .ps-form-section {
        padding: 15px;
    }
}

/* Print styles */
@media print {
    .ps-posters-form {
        display: none;
    }
/* Make only the field area scroll */
.ps-fields-scroll{
  max-height: 65vh;
  overflow: auto;
  padding-right: 12px; /* room for scrollbar */
}

/* Keep the action bar visible at the bottom of the form column */
.ps-actions{
  position: sticky;
  top: 15px;
  /*bottom: 0;
  display: flex;
  gap: 15px;
  align-items: center;
  background: #fff;
  padding: 12px 0;
  border-top: 1px solid #eee;
  z-index: 3;
}


/* (Only if your theme is still forcing odd input heights) */
#ps-form-container .ps-form-fields input,
#ps-form-container .ps-form-fields select,
#ps-form-container .ps-form-fields textarea{
  height:auto !important;
  line-height:1.4 !important;
  padding:10px 12px !important;
  border-radius:4px !important;
  box-shadow:none !important;
}

