/**
 * TNG Free-Form Contact & Interactive Canvas Annotation Styles (2028 Sunlit Ivory Glass)
 */

/* Backdrop */
.tng-contact-backdrop,
.tng-annotate-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 16px;
    box-sizing: border-box;
}

.tng-contact-backdrop.is-active,
.tng-annotate-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Card */
.tng-contact-modal,
.tng-annotate-modal {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 248, 245, 0.92) 100%);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), inset 0 1px 1px rgba(255, 255, 255, 1);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
}

.tng-contact-backdrop.is-active .tng-contact-modal,
.tng-annotate-backdrop.is-active .tng-annotate-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.tng-modal-header {
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.6);
}

.tng-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tng-modal-close-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: #475569;
    transition: all 0.2s ease;
}

.tng-modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    transform: scale(1.08);
}

/* Modal Body */
.tng-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Context Badge for Potential Ideas */
.tng-contact-context-badge {
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.10) 0%, rgba(245, 158, 11, 0.12) 100%);
    border: 1px solid rgba(234, 88, 12, 0.25);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.88rem;
    color: #9a3412;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.45;
}

.tng-contact-context-badge strong {
    color: #ea580c;
    display: block;
    font-size: 0.94rem;
    margin-bottom: 2px;
}

/* Template Selector Chips */
.tng-template-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.tng-template-chip {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 99px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tng-template-chip:hover {
    background: rgba(234, 88, 12, 0.08);
    border-color: rgba(234, 88, 12, 0.3);
    color: #ea580c;
}

.tng-template-chip.is-active {
    background: #ea580c;
    border-color: #ea580c;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}

/* Form Groups */
.tng-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 540px) {
    .tng-form-row {
        grid-template-columns: 1fr;
    }
}

.tng-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tng-form-group label {
    font-size: 0.84rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tng-form-group label .req {
    color: #ef4444;
}

.tng-input-control {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.92rem;
    font-family: inherit;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    width: 100%;
}

.tng-input-control:focus {
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

textarea.tng-input-control {
    resize: vertical;
    min-height: 110px;
    line-height: 1.5;
}

/* Character Counter */
.tng-char-counter {
    text-align: right;
    font-size: 0.76rem;
    color: #64748b;
}

/* Photo & Screenshot Dropzone */
.tng-photo-dropzone {
    border: 2px dashed rgba(234, 88, 12, 0.35);
    background: rgba(254, 243, 199, 0.2);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tng-photo-dropzone:hover,
.tng-photo-dropzone.is-dragover {
    background: rgba(254, 243, 199, 0.5);
    border-color: #ea580c;
    transform: translateY(-1px);
}

.tng-photo-dropzone .dropzone-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.tng-photo-dropzone .dropzone-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.tng-photo-dropzone .dropzone-hint {
    font-size: 0.75rem;
    color: #64748b;
}

/* Attached Photos Grid */
.tng-attached-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.tng-photo-thumb-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #0f172a;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tng-photo-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tng-thumb-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    padding: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.95;
}

.tng-thumb-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all 0.2s ease;
}

.tng-thumb-btn:hover {
    background: #ffffff;
    color: #ea580c;
}

.tng-thumb-btn.btn-remove {
    background: rgba(239, 68, 68, 0.85);
    color: #ffffff;
}

.tng-thumb-btn.btn-remove:hover {
    background: #ef4444;
}

/* Modal Footer & Actions */
.tng-modal-footer {
    padding: 16px 24px 20px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tng-modal-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.tng-submit-main-btn {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
    transition: all 0.2s ease;
}

.tng-submit-main-btn:hover {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
}

.tng-submit-main-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tng-secondary-contact-links {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #64748b;
    flex-wrap: wrap;
}

.tng-secondary-contact-links a {
    color: #0284c7;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tng-secondary-contact-links a:hover {
    text-decoration: underline;
    color: #0369a1;
}

/* ==========================================================================
   Interactive Canvas Annotation Modal (Ported & Enhanced from NWB02)
   ========================================================================== */
.tng-annotate-modal {
    max-width: 900px;
    width: 95vw;
}

.tng-annotate-canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    padding: 16px;
    overflow: auto;
    max-height: 60vh;
}

#tng-annotation-canvas {
    touch-action: none;
    cursor: crosshair;
    display: block;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
}

/* Annotation Toolbar */
.tng-annotate-toolbar {
    padding: 14px 20px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: #ffffff;
}

.tng-tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tng-tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ffffff;
    padding: 6px 12px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.tng-tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tng-tool-btn.is-active {
    background: #ea580c;
    border-color: #ea580c;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.4);
}

.tng-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-sizing: border-box;
}

.tng-color-dot:hover {
    transform: scale(1.15);
}

.tng-color-dot.is-active {
    transform: scale(1.25);
    box-shadow: 0 0 0 2px #ea580c, 0 0 8px rgba(255, 255, 255, 0.8);
}

.tng-annotate-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tng-annotate-save-btn {
    background: #059669;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tng-annotate-save-btn:hover {
    background: #10b981;
    transform: translateY(-1px);
}

.tng-annotate-cancel-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
}

.tng-annotate-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Legacy Modernization Alert Banner in Modal */
.tng-modal-legacy-alert {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.12) 0%, rgba(245, 158, 11, 0.15) 100%);
    border: 1px solid rgba(217, 119, 6, 0.35);
    border-left: 4px solid #d97706;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: #92400e;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

.tng-modal-legacy-alert strong {
    color: #b45309;
    display: block;
    font-size: 0.90rem;
    margin-bottom: 3px;
}

