/* Bestmart Extension - Content Script Styles */
/* All classes prefixed with "ja-" to avoid conflicts with page styles */

/* Notification Container */
.ja-notification-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
    max-width: 80vw;
}

/* Notification Bubble */
.ja-notification-bubble {
    position: relative;
    background: #333;
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease;
    opacity: 1;
    text-align: center;
    font-weight: bold;
    cursor: default;
    pointer-events: auto;
    min-width: 200px;
}

.ja-notification-bubble.success {
    background: #198754;
}

.ja-notification-bubble.error {
    background: #dc3545;
}

.ja-notification-bubble.warning {
    background: #ffc107;
}

.ja-notification-bubble.info {
    background: #0dcaf0;
}

.ja-notification-close {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
}

.ja-notification-close:hover {
    opacity: 1;
}

.ja-notification-text {
    padding-right: 25px;
}

/* Toast Container */
.ja-toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    max-width: 450px;
}

/* Toast */
.ja-toast {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: ja-slideInLeft 0.4s ease-out;
    min-width: 280px;
    cursor: default;
    position: relative;
}

.ja-toast.slide-out {
    animation: ja-slideOutLeft 0.3s ease-out;
}

.ja-toast-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    word-wrap: break-word;
}

.ja-toast-body {
    font-size: 12px;
    opacity: 0.9;
    word-wrap: break-word;
}

.ja-toast-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
}

.ja-toast-close:hover {
    opacity: 1;
}

/* Question Panel */
.ja-question-panel {
    background: #f7f7f2;
    color: #1c1c1c;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    width: 440px;
    height: 550px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
}

.ja-question-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: move;
}

.ja-question-panel-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    padding-right: 30px;
    word-wrap: break-word;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.ja-question-panel-close {
    position: relative;
    top: 0;
    right: 0;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
}

.ja-question-panel-close:hover {
    opacity: 1;
}

.ja-qa-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 12px 12px;
    background: radial-gradient(circle at top left, rgba(255,255,255,0.9), rgba(245,244,240,0.9));
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.questions-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ja-input-area {
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-top: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

/* Question Input */
.ja-question-input {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ja-question-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ja-question-input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}

.ja-question-input input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 14px;
    outline: none;
    color: #000 !important;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ja-question-send-btn {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.ja-question-send-btn:hover {
    background: rgba(255,255,255,0.25);
}

.ja-faq-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.ja-faq-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ja-faq-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ja-faq-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.ja-faq-btn:hover {
    background: rgba(255,255,255,0.25);
}

.ja-faq-btn:active {
    transform: translateY(1px);
}

.ja-faq-btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255,255,255,0.08);
}

.ja-faq-btn-disabled:hover {
    background: rgba(255,255,255,0.08);
}

.ja-faq-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255,255,255,0.08);
}

/* Question Text (after sent) */
.ja-question-text {
    margin: 0;
    color: #f9fafb;
    font-size: 14px;
    font-weight: 600;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.ja-bubble {
    padding: 8px 10px;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ja-bubble-question {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #f9fafb;
    max-width: 90%;
}

.ja-bubble-question .ja-loading-icon {
    color: #cbd5f5;
}

.ja-bubble-answer {
    align-self: flex-start;
    background: #ffffff;
    color: #111827;
    padding: 0;
}

.ja-loading-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.ja-success-icon {
    color: #4CAF50;
}

.ja-error-icon {
    color: #f44336;
}

.ja-warning-icon {
    color: #ff9800;
}

/* Answer Wrapper (bubble + buttons) */
.ja-answer-wrapper {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    width: 100%;
}

/* Answer Section */
.ja-answer-section {
    position: relative;
    margin-top: 0;
    background: #ffffff;
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
}

/* Answer Buttons Container */
.ja-answer-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.ja-answer-textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-family: inherit;
    background: #ffffff;
    color: #333;
    box-sizing: border-box;
    field-sizing: content;
    resize: none;
}

.ja-copy-btn {
    padding: 6px 8px;
    border-radius: 8px;
    border: none;
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.ja-copy-btn:hover {
    background: rgba(102, 126, 234, 0.25);
}

.ja-paste-btn {
    padding: 6px 8px;
    border-radius: 8px;
    border: none;
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.ja-paste-btn:hover {
    background: rgba(102, 126, 234, 0.25);
}

/* Error Message */
.ja-error-message {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

.ja-error-message.ja-warning {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

/* Smartkey Toast (top-right) */
.ja-smartkey-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    z-index: 999999;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: slideInRight 0.4s ease-out;
    max-width: 320px;
    min-width: 280px;
    cursor: pointer;
}

/* Avoid-Platform Warning Toast (top-center, danger) */
.ja-avoid-platform-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #c0392b 0%, #8e1a0e 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    z-index: 999999;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(192,57,43,0.55);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: ja-slideInDown 0.4s ease-out;
    max-width: 380px;
    min-width: 300px;
    border: 1px solid rgba(255,100,80,0.4);
}

@keyframes ja-slideInDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Highlighting Toast (top-left) */
.ja-highlighting-toast {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    z-index: 999999;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: slideInLeft 0.4s ease-out;
    max-width: 320px;
    min-width: 280px;
}

/* Keyboard key styling */
#job-apply-smartkey-toast kbd,
#job-apply-highlighting-toast kbd {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Toast inner layout */
.ja-toast-flex {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ja-toast-icon-wrapper {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.ja-toast-content {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.ja-toast-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.ja-toast-link {
    text-decoration: underline;
    cursor: pointer;
}

/* Hidden element */
.ja-hidden {
    display: none;
}

/* Screenshot Notification */
.ja-screenshot-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

.ja-screenshot-notification.success {
    background: #28a745;
}

.ja-screenshot-notification.error {
    background: #dc3545;
}

.ja-screenshot-flex {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ja-screenshot-icon {
    font-size: 18px;
}

.ja-screenshot-filename {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 4px;
}

/* Animations */
@keyframes ja-slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes ja-slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

@keyframes ja-slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes ja-slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* Full slide animations for smartkey and highlighting toasts */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-400px);
        opacity: 0;
    }
}

/* Loading dots animation */
.ja-loading-dots {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    margin-right: 10px;
}

.ja-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: ja-dot-pulse 1.4s infinite;
}

.ja-loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ja-loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ja-dot-pulse {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}
