/**
 * Tonewriter Support - Frontend Styles
 */

/* Bug Button op elke tonewriter-section */
.tws-bug-button {
    position: absolute;
    bottom: 12px;
    right: 15px; /* 3px extra voor uitlijning met velden */
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 20px; /* Extra ruimte boven het icoon */
}

.tws-bug-button:hover {
    opacity: 1;
    transform: scale(1.1);
    border-color: #0c19bc;
    box-shadow: 0 2px 6px rgba(12, 25, 188, 0.2);
}

.tws-bug-button:focus {
    outline: none;
    opacity: 1;
}

.tws-bug-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #64748b;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tws-bug-button:hover svg {
    stroke: #0c19bc;
}

/* Zorg dat tonewriter-section voldoende padding onderaan heeft voor het icoon */
.tonewriter-section {
    position: relative;
    padding-bottom: 50px !important; /* Ruimte voor bug button */
}


/* Modal Overlay */
.tws-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tws-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.tws-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tws-modal *,
.tws-modal *::before,
.tws-modal *::after {
    box-sizing: border-box;
}

.tws-modal-overlay.active .tws-modal {
    transform: translateY(0) scale(1);
}

/* Modal Header */
.tws-modal-header {
    padding: 20px 24px;
    background: #0c19bc;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tws-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-shadow: none;
}

.tws-modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.tws-modal-close:hover {
    opacity: 1;
}

/* Modal Body */
.tws-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 160px);
}

/* Form Fields */
.tws-field {
    margin-bottom: 20px;
}

.tws-field:last-child {
    margin-bottom: 0;
}

.tws-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.tws-field label .required {
    color: #dc2626;
    margin-left: 2px;
}

.tws-input,
.tws-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tws-input:focus,
.tws-textarea:focus {
    outline: none;
    border-color: #0c19bc;
    box-shadow: 0 0 0 3px rgba(12, 25, 188, 0.1);
}

.tws-input.error,
.tws-textarea.error {
    border-color: #dc2626;
}

.tws-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Error Message */
.tws-field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.tws-field.has-error .tws-field-error {
    display: block;
}

/* Screenshot Info */
.tws-screenshot-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    font-size: 13px;
}

.tws-screenshot-info svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Screenshot Preview */
.tws-screenshot-preview {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    max-height: 150px;
}

.tws-screenshot-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* Modal Footer */
.tws-modal-footer {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Buttons */
.tws-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.tws-btn-primary {
    background: #0c19bc;
    color: white;
}

.tws-btn-primary:hover:not(:disabled) {
    background: #0a1499;
}

.tws-btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.tws-btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Spinner */
.tws-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: tws-spin 0.8s linear infinite;
}

@keyframes tws-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success/Error States */
.tws-message {
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.tws-message.show {
    display: block;
}

.tws-message.success {
    background: #dcfce7;
    color: #166534;
}

.tws-message.error {
    background: #fee2e2;
    color: #991b1b;
}

.tws-message-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

/* Capturing overlay */
.tws-capturing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 999998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.tws-capturing-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tws-capturing-overlay .tws-spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
    border-color: rgba(12, 25, 188, 0.2);
    border-top-color: #0c19bc;
}

.tws-capturing-overlay p {
    margin-top: 16px;
    color: #374151;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
    .tws-modal-overlay {
        align-items: flex-start;
        padding: 0;
        overflow: hidden;
    }
    
    .tws-modal {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        margin: 0;
        box-sizing: border-box;
    }
    
    .tws-modal-header {
        padding: 14px 16px;
        flex-shrink: 0;
    }
    
    .tws-modal-header h3 {
        font-size: 16px;
    }
    
    .tws-modal-body {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }
    
    .tws-modal-footer {
        padding: 12px 16px;
        flex-shrink: 0;
        flex-direction: row;
        gap: 10px;
        background: #f9fafb;
        border-top: 1px solid #e5e7eb;
        box-sizing: border-box;
    }
    
    .tws-modal-footer .tws-btn {
        flex: 1;
        padding: 12px 16px;
    }
    
    .tws-field {
        margin-bottom: 16px;
    }
    
    .tws-input,
    .tws-textarea {
        padding: 10px 12px;
        font-size: 16px; /* Voorkomt zoom op iOS */
    }
    
    .tws-bug-button {
        bottom: 8px;
        right: 12px;
        width: 24px;
        height: 24px;
    }
    
    .tws-bug-button svg {
        width: 14px;
        height: 14px;
    }
    
    .tonewriter-section {
        padding-bottom: 45px !important;
    }
    
    /* Screenshot preview kleiner op mobiel */
    .tws-screenshot-preview {
        max-height: 80px;
    }
    
    .tws-textarea {
        min-height: 70px;
    }
    
    .tws-screenshot-info {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .tws-screenshot-info svg {
        width: 16px;
        height: 16px;
    }
}

/* Print: verberg support buttons */
@media print {
    .tws-bug-button,
    .tws-modal-overlay {
        display: none !important;
    }
}
