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

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

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

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

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

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

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

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

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

.cmax-hero p {
    margin: 0;
    color: var(--cmax-text-light);
    font-size: 16px;
}

/* ─── Tool Body (no extra border — matches ITP) ─────────────────── */
.cmax-tool-body {
    /* transparent wrapper — no border, no shadow, just spacing */
}

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

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

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

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

/* ─── Upload Area ───────────────────────────────────────────────── */
.cmax-upload-section {
    border: 2px dashed var(--cmax-primary);
    border-radius: var(--cmax-radius);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background-color: #fff3e0;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    min-height: 250px;
    box-sizing: border-box;
}

.cmax-upload-section:hover,
.cmax-upload-section.dragover {
    border-color: var(--cmax-secondary);
    background-color: #ffe0b2;
}

.cmax-upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.cmax-upload-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--cmax-text);
}

.cmax-upload-content p {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--cmax-text);
}

.cmax-file-types {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    color: var(--cmax-text-light);
}

/* ─── Preview ───────────────────────────────────────────────────── */
.cmax-preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cmax-preview-content img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 8px;
    margin-bottom: 14px;
    object-fit: contain;
    box-shadow: var(--cmax-shadow);
    display: block;
}

.cmax-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#cmax-file-name {
    font-size: 0.875rem;
    font-weight: 500;
}

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

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

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

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

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

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

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

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

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

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

.cmax-btn-primary {
    padding: 12px 24px;
    background-color: var(--cmax-primary);
    color: white;
    border: none;
}

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

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

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

.cmax-btn-secondary:hover {
    background-color: var(--cmax-secondary-hover);
    color: white !important;
}

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

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

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

.cmax-btn-text:hover {
    text-decoration: underline;
    color: var(--cmax-primary-hover) !important;
}

/* ─── Status Messages ───────────────────────────────────────────── */
.cmax-status-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

.cmax-status-message.loading {
    background-color: #eff6ff;
    color: var(--cmax-primary);
    border: 1px solid #bfdbfe;
}

.cmax-status-message.error {
    background-color: #fef2f2;
    color: var(--cmax-error);
    border: 1px solid #fecaca;
}

/* ─── Result Section ────────────────────────────────────────────── */
.cmax-result-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--cmax-border);
}

.cmax-result-section h3 {
    margin: 0 0 16px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--cmax-text);
}

.cmax-description-card,
.cmax-followup-answer-card {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--cmax-border);
    border-radius: 8px;
    background-color: #f8fafc;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
    white-space: pre-wrap;
    color: var(--cmax-text);
}

.cmax-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.cmax-actions .cmax-btn-secondary,
.cmax-actions .cmax-btn-outline {
    flex: 1;
}

.cmax-success-msg {
    color: var(--cmax-success);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ─── Follow-up Section ─────────────────────────────────────────── */
.cmax-followup-section {
    margin-bottom: 24px;
}

.cmax-followup-section h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cmax-text);
}

.cmax-followup-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.cmax-followup-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--cmax-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--cmax-text);
    outline: none;
}

.cmax-followup-input-group input:focus {
    border-color: var(--cmax-primary);
    box-shadow: 0 0 0 3px rgba(0, 68, 204, 0.15);
}

.cmax-reset-section {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--cmax-border);
}

/* ─── Utilities ─────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─── Daily Usage Badge ─────────────────────────────────────────── */
.cmax-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-usage-badge--empty {
    background: #fef2f2;
    color: #b71c1c;
    border-color: #ef9a9a;
}

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

    .cmax-hero h1 {
        font-size: 24px;
    }

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

    .cmax-followup-input-group {
        flex-direction: column;
    }

    .cmax-followup-input-group button {
        width: 100%;
    }
}
