/**
 * Basehead Support - Frontend Styles
 * Dark theme matching original support form
 */

/* Variables */
:root {
    --bh-bg-dark: #1c1f26;
    --bh-bg-darker: #15171d;
    --bh-bg-input: #262a33;
    --bh-border-color: #363a45;
    --bh-text-primary: #ffffff;
    --bh-text-secondary: #9ca3af;
    --bh-text-hint: #6b7280;
    --bh-text-placeholder: #5a6270;
    --bh-accent-blue: #3b82f6;
    --bh-accent-cyan: #22d3ee;
    --bh-accent-orange: #f5a623;
    --bh-accent-red: #ef4444;
    --bh-success: #22c55e;
    --bh-warning: #f59e0b;
    --bh-border-radius: 6px;
}

/* Form Wrapper */
.bh-support-form-wrap,
.bh-ticket-wrap,
.bh-tickets-list-wrap,
.bh-email-lookup-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Form Header */
.bh-form-header {
    margin-bottom: 20px;
}

.bh-form-header h2 {
    color: var(--bh-text-primary);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.bh-form-header p {
    color: var(--bh-text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Notices */
.bh-notice {
    padding: 15px 20px;
    border-radius: var(--bh-border-radius);
    margin-bottom: 20px;
}

.bh-notice-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--bh-success);
}

.bh-notice-error {
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.4);
    color: var(--bh-accent-orange);
}

.bh-notice-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--bh-accent-blue);
}

.bh-notice-warning {
    background: #d4956a;
    border: 2px solid #c4855a;
    color: #000;
    padding: 20px 25px;
    font-size: 1.05em;
}

/* Success Banner - large centered muted green */
.bh-success-banner {
    background: rgba(120, 160, 120, 0.2);
    border: 2px solid rgba(120, 160, 120, 0.5);
    border-radius: var(--bh-border-radius);
    padding: 30px 40px;
    text-align: center;
    margin: 20px 0;
}

.bh-success-banner p {
    color: #c8e0c8;
    font-size: 1.1em;
    margin: 0 0 10px 0;
}

.bh-success-banner p:last-child {
    margin-bottom: 0;
}

.bh-notice-warning p {
    margin: 0 0 10px 0;
}

.bh-notice-warning p:last-child {
    margin-bottom: 0;
}

.bh-notice-warning strong {
    font-size: 1.1em;
}

.bh-notice ul {
    margin: 0;
    padding-left: 20px;
}

/* Form Styles */
.bh-support-form,
.bh-reply-form,
.bh-email-lookup-form {
    background: var(--bh-bg-dark);
    padding: 30px;
    border-radius: var(--bh-border-radius);
    border: 1px solid var(--bh-border-color);
}

.bh-required-note {
    color: var(--bh-text-secondary);
    font-size: 13px;
    margin: 0 0 20px 0;
}

.bh-form-row {
    margin-bottom: 20px;
}

.bh-form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .bh-form-row-half {
        grid-template-columns: 1fr;
    }
}

.bh-form-group {
    margin-bottom: 20px;
}

.bh-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--bh-text-primary);
    font-size: 14px;
}

.bh-form-group label .required {
    color: var(--bh-accent-orange);
}

.bh-form-group input[type="text"],
.bh-form-group input[type="email"],
.bh-form-group select,
.bh-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bh-bg-input);
    border: 1px solid var(--bh-border-color);
    border-radius: var(--bh-border-radius);
    font-size: 15px;
    color: var(--bh-text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Readonly input fields - dimmed and italic */
.bh-form-group input[readonly] {
    background: transparent;
    border-color: transparent;
    color: var(--bh-text-hint);
    font-style: italic;
    cursor: not-allowed;
}

/* Account info display - logged in user */
.bh-account-info {
    opacity: 0.8;
    font-style: italic;
    margin-bottom: 20px;
    padding: 10px 0;
}

.bh-account-info p {
    margin: 0 0 5px 0;
    color: var(--bh-text-secondary);
    font-size: 14px;
}

.bh-account-info p:last-child {
    margin-bottom: 0;
}

.bh-form-group input::placeholder,
.bh-form-group textarea::placeholder {
    color: var(--bh-text-primary);
    font-style: italic;
    opacity: 0.4;
}

.bh-form-group select option:first-child {
    color: var(--bh-text-placeholder);
    font-style: italic;
}

.bh-form-group input:focus,
.bh-form-group select:focus,
.bh-form-group textarea:focus {
    outline: none;
    border-color: var(--bh-accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.bh-form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.bh-form-group select option {
    background: var(--bh-bg-darker);
    color: var(--bh-text-primary);
}

.bh-form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.bh-field-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--bh-text-hint);
}

.bh-hint-highlight {
    color: var(--bh-accent-cyan);
}

.bh-char-count {
    color: var(--bh-text-hint);
}

.bh-emoji {
    font-size: 14px;
}

/* Radio Group */
.bh-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.bh-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bh-accent-cyan);
    font-weight: normal;
    cursor: pointer;
    font-size: 14px;
}

.bh-radio-label input[type="radio"] {
    width: auto;
    accent-color: var(--bh-accent-cyan);
}

/* CAPTCHA */
.bh-captcha-group {
    padding-top: 20px;
    border-top: 1px solid var(--bh-border-color);
}

.bh-captcha-group label {
    margin-bottom: 12px;
}

/* Buttons */
.bh-btn {
    display: inline-block;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--bh-border-radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.bh-btn:active {
    transform: translateY(1px);
}

.bh-btn-primary {
    background: var(--bh-accent-blue);
    color: white;
}

.bh-btn-primary:hover {
    background: #2563eb;
}

.bh-form-actions {
    margin-top: 25px;
}

/* Form Phases */
.bh-form-phase {
    /* Phase containers */
}

.bh-phase-2-header {
    background: var(--bh-bg-input);
    border: 1px solid var(--bh-border-color);
    border-radius: var(--bh-border-radius);
    padding: 20px;
    margin-bottom: 25px;
}

.bh-phase-2-header h3 {
    color: var(--bh-text-primary);
    font-size: 16px;
    margin: 0 0 8px 0;
}

.bh-phase-2-header p {
    color: var(--bh-text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Suggestions Box */
.bh-suggestions-box {
    background: var(--bh-bg-darker);
    border: 2px solid var(--bh-accent-blue);
    border-radius: var(--bh-border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.bh-suggestions-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--bh-border-color);
    color: var(--bh-text-primary);
}

.bh-bulb-icon {
    font-size: 24px;
}

.bh-suggestion {
    background: var(--bh-bg-input);
    border-radius: var(--bh-border-radius);
    padding: 15px;
    margin-bottom: 15px;
}

.bh-suggestion:last-child {
    margin-bottom: 0;
}

.bh-suggestion-resolution {
    border-left: 4px solid var(--bh-success);
}

.bh-suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.bh-suggestion-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--bh-text-primary);
}

.bh-suggestion-header h4 a {
    color: var(--bh-accent-cyan);
    text-decoration: none;
    transition: color 0.2s;
}

.bh-suggestion-header h4 a:hover {
    color: var(--bh-accent-blue);
    text-decoration: underline;
}

.bh-doc-link {
    display: inline-block;
    color: var(--bh-accent-cyan);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 0;
}

.bh-doc-link:hover {
    color: var(--bh-accent-blue);
    text-decoration: underline;
}

/* Inline links within AI response content */
.bh-inline-link {
    color: #ced69c;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted #ced69c;
}

.bh-inline-link:hover {
    color: #dce4b0;
    text-decoration: none;
    border-bottom-style: solid;
    border-bottom-color: #dce4b0;
}

/* Markdown-style headers in AI content */
.bh-suggestion-content .bh-h2 {
    display: block;
    font-size: 15px;
    margin: 12px 0 8px 0;
    color: var(--bh-text-primary);
}

.bh-suggestion-content .bh-h3 {
    display: block;
    font-size: 14px;
    margin: 10px 0 6px 0;
    color: var(--bh-text-primary);
}

/* List items in AI content */
.bh-suggestion-content .bh-bullet,
.bh-suggestion-content .bh-numbered {
    display: block;
    margin: 4px 0 4px 16px;
    padding-left: 8px;
}

.bh-suggestion-content .bh-bullet::before {
    content: "•";
    margin-left: -16px;
    margin-right: 8px;
    color: #ced69c;
}

.bh-suggestion-content .bh-num {
    color: #ced69c;
    font-weight: 600;
}

/* Code snippets in AI content */
.bh-suggestion-content code {
    background: var(--bh-bg-darker);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 13px;
    color: var(--bh-accent-orange);
}

.bh-source-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.bh-badge-resolution {
    background: rgba(34, 197, 94, 0.2);
    color: var(--bh-success);
}

.bh-badge-manual {
    background: rgba(59, 130, 246, 0.2);
    color: var(--bh-accent-blue);
}

.bh-badge-ai {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.bh-suggestion-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--bh-text-secondary);
}

.bh-suggestion-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--bh-border-color);
}

.bh-solved-btn,
.bh-need-help-btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--bh-border-radius);
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.bh-solved-btn {
    background: var(--bh-success);
    color: white;
}

.bh-solved-btn:hover {
    background: #16a34a;
}

.bh-need-help-btn {
    background: var(--bh-bg-input);
    color: var(--bh-text-secondary);
    border: 1px solid var(--bh-border-color);
}

.bh-need-help-btn:hover {
    background: var(--bh-border-color);
}

.bh-suggestions-loading {
    text-align: center;
    padding: 20px;
    color: var(--bh-text-secondary);
}

/* Ticket View */
.bh-ticket-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--bh-border-color);
}

.bh-ticket-title h1 {
    font-size: 24px;
    margin: 0 0 10px 0;
    color: var(--bh-text-primary);
}

.bh-ticket-number {
    color: var(--bh-text-secondary);
    font-weight: normal;
    margin-right: 8px;
}

.bh-ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    font-size: 14px;
    color: var(--bh-text-secondary);
}

/* Status Badges */
.bh-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.status-open {
    background: rgba(59, 130, 246, 0.2);
    color: var(--bh-accent-blue);
}

.status-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--bh-warning);
}

.status-info {
    background: rgba(34, 211, 238, 0.2);
    color: var(--bh-accent-cyan);
}

.status-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--bh-success);
}

.status-closed {
    background: rgba(107, 114, 128, 0.2);
    color: var(--bh-text-hint);
}

/* Conversation */
.bh-conversation {
    margin-bottom: 30px;
}

.bh-message {
    background: var(--bh-bg-input);
    border-radius: var(--bh-border-radius);
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--bh-border-color);
}

.bh-message-customer {
    border-left: 4px solid var(--bh-text-hint);
}

.bh-message-support {
    border-left: 4px solid var(--bh-accent-blue);
    background: var(--bh-bg-darker);
}

.bh-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bh-border-color);
}

.bh-message-author {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bh-text-primary);
}

.bh-author-icon {
    font-size: 18px;
}

.bh-message-time {
    font-size: 13px;
    color: var(--bh-text-hint);
}

.bh-message-content {
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--bh-text-secondary);
}

.bh-message-attachments {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--bh-border-color);
    color: var(--bh-text-secondary);
}

.bh-message-attachments ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.bh-message-attachments a {
    color: var(--bh-accent-blue);
}

.bh-attachment-size {
    color: var(--bh-text-hint);
    font-size: 13px;
}

/* Reply Form */
.bh-reply-form-wrap {
    background: var(--bh-bg-input);
    padding: 25px;
    border-radius: var(--bh-border-radius);
    border: 1px solid var(--bh-border-color);
}

.bh-reply-form-wrap h3 {
    margin: 0 0 20px 0;
    color: var(--bh-text-primary);
}

/* Tickets Table */
.bh-tickets-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bh-bg-input);
    border-radius: var(--bh-border-radius);
    overflow: hidden;
}

.bh-tickets-table th,
.bh-tickets-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--bh-border-color);
}

.bh-tickets-table th {
    background: var(--bh-bg-darker);
    font-weight: 600;
    color: var(--bh-text-primary);
}

.bh-tickets-table td {
    color: var(--bh-text-secondary);
}

.bh-tickets-table a {
    color: var(--bh-accent-blue);
    text-decoration: none;
}

.bh-tickets-table a:hover {
    text-decoration: underline;
}

/* Email Lookup */
.bh-email-lookup-wrap {
    text-align: center;
}

.bh-email-lookup-form {
    max-width: 400px;
    margin: 0 auto;
}

/* File Upload */
.bh-file-upload-area {
    position: relative;
    border: 2px dashed var(--bh-border-color);
    border-radius: var(--bh-border-radius);
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.bh-file-upload-area:hover,
.bh-file-upload-area.dragover {
    border-color: var(--bh-accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.bh-file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.bh-file-upload-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--bh-text-secondary);
    pointer-events: none;
}

.bh-upload-icon {
    font-size: 28px;
}

.bh-file-list {
    margin-top: 12px;
}

.bh-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bh-bg-input);
    border: 1px solid var(--bh-border-color);
    border-radius: var(--bh-border-radius);
    margin-bottom: 8px;
}

.bh-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--bh-text-primary);
    font-size: 14px;
}

.bh-file-icon {
    font-size: 18px;
}

.bh-file-name {
    word-break: break-all;
}

.bh-file-size {
    color: var(--bh-text-hint);
    font-size: 12px;
    margin-left: 8px;
}

.bh-file-remove {
    background: none;
    border: none;
    color: var(--bh-accent-red);
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.bh-file-remove:hover {
    color: #dc2626;
}

.bh-file-error {
    color: var(--bh-accent-red);
    font-size: 13px;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 600px) {
    .bh-support-form,
    .bh-reply-form {
        padding: 20px;
    }

    .bh-ticket-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .bh-message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .bh-suggestion-header {
        flex-direction: column;
        gap: 8px;
    }

    .bh-suggestion-actions {
        flex-direction: column;
    }
}
