/* 
 * ConverterMAX Prompt Enhancer - Premium Styles
 * Layout & colors matched to Image to Prompt Generator
 */

:root {
    --cmax-pe-primary: #0044cc;
    --cmax-pe-primary-hover: #003399;
    --cmax-pe-secondary: #ff6600;
    --cmax-pe-secondary-hover: #e65c00;
    --cmax-pe-border: #e5e7eb;
    --cmax-pe-text: #1f2937;
    --cmax-pe-text-light: #6b7280;
    --cmax-pe-error: #ef4444;
    --cmax-pe-success: #10b981;
    --cmax-pe-bg: #ffffff;
    --cmax-pe-radius: 12px;
    --cmax-pe-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --cmax-pe-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ─── Container ─────────────────────────────────────────────────── */
.cmax-pe-container {
    max-width: 1100px;
    margin: 0 auto 40px;
    background: var(--cmax-pe-bg);
    border-radius: var(--cmax-pe-radius);
    padding: 24px 32px;
    box-shadow: var(--cmax-pe-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--cmax-pe-text);
    box-sizing: border-box;
}

/* ─── Scoped Reset (neutralize WordPress/theme overrides) ────────── */
.cmax-pe-container *,
.cmax-pe-container *::before,
.cmax-pe-container *::after {
    box-sizing: border-box !important;
}

.cmax-pe-container div,
.cmax-pe-container label,
.cmax-pe-container span,
.cmax-pe-container p {
    max-width: none !important;
    margin: 0;
    padding: 0;
}

.cmax-pe-container button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.cmax-pe-container textarea,
.cmax-pe-container input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* ─── Header ────────────────────────────────────────────────────── */
.cmax-pe-header {
    text-align: center;
    margin-bottom: 24px;
}

.cmax-pe-title {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 700;
    color: #1455e6;
}

.cmax-pe-tagline {
    margin: 0 0 4px;
    color: var(--cmax-pe-text-light);
    font-size: 16px;
    font-weight: 400;
}

.cmax-pe-description {
    margin: 0;
    color: var(--cmax-pe-text-light);
    font-size: 14px;
}

/* ─── Two-Column Layout ─────────────────────────────────────────── */
.cmax-pe-main-layout {
    display: flex;
    gap: 24px;
    margin-bottom: 0;
    align-items: stretch;
    overflow: hidden;
    width: 100%;
}

.cmax-pe-column-left {
    flex: 40;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cmax-pe-column-right {
    flex: 60;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .cmax-pe-main-layout {
        flex-direction: column;
    }
    .cmax-pe-column-left,
    .cmax-pe-column-right {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* ─── Input Area (Left Column) ──────────────────────────────────── */
.cmax-pe-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

.cmax-pe-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--cmax-pe-text);
}

.cmax-pe-textarea {
    flex: 1;
    width: 100%;
    min-height: 250px;
    padding: 15px;
    border: 2px solid var(--cmax-pe-primary);
    border-radius: var(--cmax-pe-radius);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    background-color: #ff6600;
    color: #ffffff;
    transition: all 0.2s ease-in-out;
    line-height: 1.6;
}

.cmax-pe-textarea::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.cmax-pe-textarea:focus {
    outline: none;
    border-color: var(--cmax-pe-secondary);
    background-color: #ffe0b2;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.cmax-pe-character-counter {
    font-size: 12px;
    color: var(--cmax-pe-text-light);
    text-align: right;
}

.cmax-pe-error-message {
    font-size: 13px;
    color: var(--cmax-pe-error);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

/* ─── Controls (Right Column) ───────────────────────────────────── */
.cmax-pe-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
}

.cmax-pe-control-group {
    display: flex;
    flex-direction: column;
}

.cmax-pe-control-group > label {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
    color: var(--cmax-pe-text);
}

/* ─── Radio Pill Buttons ─────────────────────────────────────────── */
.cmax-pe-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cmax-pe-radio-pill input[type="radio"] {
    display: none;
}

.cmax-pe-radio-pill span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--cmax-pe-border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    background: #f8fafc;
    color: var(--cmax-pe-text);
    transition: all 0.2s;
    user-select: none;
}

.cmax-pe-radio-pill input[type="radio"]:checked + span {
    background: var(--cmax-pe-primary);
    color: white;
    border-color: var(--cmax-pe-primary);
}

.cmax-pe-radio-pill span:hover {
    background: #e6f0ff;
    border-color: var(--cmax-pe-primary);
    color: var(--cmax-pe-primary);
}

.cmax-pe-radio-pill input[type="radio"]:checked + span:hover {
    background: var(--cmax-pe-primary-hover);
    color: white;
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.cmax-pe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    width: 100%;
    font-family: inherit;
}

.cmax-pe-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cmax-pe-btn-primary {
    background-color: var(--cmax-pe-primary);
    color: white;
}

.cmax-pe-btn-primary:not(:disabled):hover {
    background-color: var(--cmax-pe-primary-hover);
    box-shadow: var(--cmax-pe-shadow-hover);
}

.cmax-pe-btn-icon {
    flex-shrink: 0;
    margin-right: 8px;
}

.cmax-pe-btn-secondary {
    background-color: var(--cmax-pe-secondary);
    color: white;
    border: 1px solid var(--cmax-pe-secondary-hover);
    width: auto;
}

.cmax-pe-btn-secondary:hover:not(:disabled) {
    background-color: var(--cmax-pe-secondary-hover);
    color: white;
}

.cmax-pe-btn-outline {
    background-color: transparent;
    color: var(--cmax-pe-text);
    border: 1px solid var(--cmax-pe-border);
    width: auto;
}

.cmax-pe-btn-outline:hover:not(:disabled) {
    background-color: var(--cmax-pe-secondary);
    color: white;
    border-color: var(--cmax-pe-secondary);
}

.cmax-pe-btn-text {
    background-color: transparent;
    color: var(--cmax-pe-primary);
    border: none;
    width: auto;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 4px 8px;
}

.cmax-pe-btn-text:hover:not(:disabled) {
    text-decoration: underline;
    color: var(--cmax-pe-primary-hover);
}

/* ─── Spinner ───────────────────────────────────────────────────── */
.cmax-pe-spinner {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 2px solid #ffffff;
    width: 18px;
    height: 18px;
    animation: cmax-pe-spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
    flex-shrink: 0;
}

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

/* ─── Daily Usage Badge ─────────────────────────────────────────── */
.cmax-pe-usage-badge {
    display: none;
    margin-top: 8px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    letter-spacing: 0.01em;
    line-height: 1.5;
}

.cmax-pe-usage-badge--low {
    background: #fff8e1;
    color: #e65100;
    border-color: #ffcc02;
}

.cmax-pe-usage-badge--empty {
    background: #fef2f2;
    color: #b71c1c;
    border: 1px solid #fecaca;
}

/* ─── Results Area ──────────────────────────────────────────────── */
.cmax-pe-results {
    margin-top: 24px;
    border-top: 1px solid var(--cmax-pe-border);
    padding-top: 24px;
    animation: cmax-pe-fade-in 0.4s ease-out;
}

@keyframes cmax-pe-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cmax-pe-comparison {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.cmax-pe-result-card {
    background-color: #f8fafc;
    border: 1px solid var(--cmax-pe-border);
    border-radius: 8px;
    padding: 20px;
}

.cmax-pe-enhanced-card {
    background-color: #eff6ff;
    border-color: #bfdbfe;
}

.cmax-pe-card-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--cmax-pe-text);
}

.cmax-pe-content-display {
    font-size: 15px;
    line-height: 1.6;
    color: var(--cmax-pe-text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ─── Action Buttons ────────────────────────────────────────────── */
.cmax-pe-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .cmax-pe-container {
        padding: 16px;
    }

    .cmax-pe-title {
        font-size: 24px;
    }

    .cmax-pe-actions {
        flex-direction: column;
    }

    .cmax-pe-btn-secondary,
    .cmax-pe-btn-outline {
        width: 100%;
    }
}
