/**
 * Smart Owl AI Advantage Mashup - CSS Styles
 * Version: 1.0.3 - Fixed UI/UX Issues
 */

/* Main mashup panel box (inserted under Smart Owl Get Response button) */
.soaam-mashup-controls {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin: 14px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.soaam-mashup-controls * {
    box-sizing: border-box;
}

.soaam-position-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    margin-bottom: 12px;
}
.soaam-position-toggle label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}
.soaam-position-toggle input[type="radio"] { margin: 0; }

.soaam-instruction-area textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font: inherit;
    font-size: 14px;
    resize: vertical;
}
.soaam-both-instructions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.soaam-both-instructions label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}
.soaam-before-instructions, .soaam-after-instructions {
    display: flex; flex-direction: column;
}

.soaam-action-buttons {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}
.soaam-action-buttons .button-primary {
    min-width: 220px;
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
    text-shadow: none !important;
    box-shadow: 0 1px 0 #2271b1 !important;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.soaam-action-buttons .button-primary:hover:not(:disabled) {
    background: #135e96 !important;
    border-color: #135e96 !important;
    box-shadow: 0 1px 0 #135e96 !important;
}
.soaam-action-buttons .button-primary:active {
    background: #135e96 !important;
    border-color: #135e96 !important;
    box-shadow: inset 0 2px 0 rgba(0,0,0,0.1) !important;
    transform: translateY(1px);
}
.soaam-action-buttons .button-primary:disabled {
    background: #7e8993 !important;
    border-color: #7e8993 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ------------------------------------------------------------------
   Select control placement in response header (top-right corner)
   ------------------------------------------------------------------ */

/* Ensure response header can align items properly */
.response-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    position: relative;
    min-height: 32px;
}

/* Title stretches */
.response-header h3 {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 100px; /* Make room for controls */
}

/* Container for select and copy buttons - always in top-right */
.response-header .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

/* Copy button positioning */
.response-header .copy-response {
    flex: 0 0 auto;
}

/* Mashup "Select" control - styled checkbox */
.response-header .soaam-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
}

.response-header .soaam-select:hover {
    background: #e9ecef;
    border-color: #2271b1;
}

/* Custom checkbox styling */
.response-header .soaam-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #999;
    border-radius: 3px;
    background: #fff;
    position: relative;
    transition: all 0.2s ease;
}

.response-header .soaam-select input[type="checkbox"]:hover {
    border-color: #2271b1;
}

/* Checked state - blue background with white checkmark */
.response-header .soaam-select input[type="checkbox"]:checked {
    background: #2271b1;
    border-color: #2271b1;
}

.response-header .soaam-select input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

/* Label text */
.response-header .soaam-select span {
    font-weight: 500;
}

/* When the header wraps, keep the order sensible */
@media (max-width: 640px) {
    .response-header {
        gap: 6px;
        flex-wrap: wrap;
    }
    .response-header h3 {
        padding-right: 0;
        width: 100%;
        order: 1;
    }
    .response-header .header-right {
        position: static;
        order: 2;
    }
}

/* Notifications */
.soaam-notice {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
    z-index: 9999;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: soaam-slide-in 0.3s ease-out;
}
.soaam-notice-success { background: #46b450; }
.soaam-notice-error   { background: #dc3232; }

@keyframes soaam-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .soaam-both-instructions { grid-template-columns: 1fr; }
    .soaam-mashup-controls { padding: 12px; }
    .soaam-action-buttons .button-primary { width: 100%; min-width: auto; }
}

/* Print: hide the mashup controls */
@media print {
    .soaam-mashup-controls { display: none !important; }
}
