/**
 * Styles Frontend - Badge et Modal d'assistance
 */

/* Badge flottant */
.psdiag-badge {
    position: fixed;
    z-index: 999999;
    padding: 12px 12px;
    border-radius: 30px 30px 0 0;
    cursor: pointer;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.psdiag-badge.psd-vertical {
    writing-mode: vertical-rl; 
    text-orientation: mixed;
}

.psdiag-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.psdiag-badge-left {
    left: 0;
    border-radius: 0 10px 10px 0;
}

.psdiag-badge-right {
    right: 0;
    border-radius: 10px 0 0 10px;
}

.psdiag-badge-content {
	display: flex;
	align-items: center;
	gap: 8px;
	color: white;
	font-weight: 600;
	font-size: 16px;
	max-width: 20px;
	flex-wrap: wrap;
}

.psdiag-badge-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psdiag-icon-svg {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.psdiag-badge-text {
	word-break: break-all;
	max-width: 18px;
	text-align: center;
	line-height: 1.075;
	padding-left: 5px;
}

/* Modal */
.psdiag-modal {
    display: none;
    position: fixed;
    z-index: 1000000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.psdiag-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.psdiag-modal-content {
    background-color: #ffffff;
    margin: 20px;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.psdiag-modal-header {
    background: linear-gradient(135deg, #0273eb 0%, #0159b3 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.psdiag-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.psdiag-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.psdiag-close:hover {
    transform: rotate(90deg);
}

.psdiag-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

/* Onglets */
.psdiag-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.psdiag-tab-button {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
}

.psdiag-tab-button:hover {
    color: #0273eb;
    background: #f5f5f5;
}

.psdiag-tab-button.active {
    color: #0273eb;
    border-bottom-color: #0273eb;
}

.psdiag-tab-content {
    display: none;
}

.psdiag-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Grille d'informations */
.psdiag-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.psdiag-info-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #0273eb;
}

.psdiag-info-item strong {
    display: block;
    color: #0273eb;
    margin-bottom: 5px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.psdiag-info-item span {
    color: #333;
    font-size: 14px;
    word-break: break-all;
}

.psdiag-small-text {
    font-size: 11px !important;
    line-height: 1.4;
}

.psdiag-status-enabled {
    color: #28a745 !important;
    font-weight: 600;
}

.psdiag-status-disabled {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Formulaire */
.psdiag-form-group {
    margin-bottom: 20px;
}

.psdiag-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.psdiag-required {
    color: #dc3545;
}

.psdiag-optional {
    color: #6c757d;
    font-weight: normal;
    font-size: 12px;
}

.psdiag-input,
.psdiag-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.psdiag-input:focus,
.psdiag-textarea:focus {
    outline: none;
    border-color: #0273eb;
}

.psdiag-textarea {
    resize: vertical;
    min-height: 100px;
}

.psdiag-btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #0273eb 0%, #0159b3 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.psdiag-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.psdiag-btn-primary:active {
    transform: translateY(0);
}

.psdiag-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Messages */
.psdiag-form-message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
    font-size: 14px;
}

.psdiag-form-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.psdiag-form-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */

/* ≤ 767px : badge compact, texte caché, icône réduite de 25% */
@media (max-width: 767px) {
    .psdiag-badge-text {
        display: none;
    }

    .psdiag-icon-svg {
        width: 18px;
        height: 18px;
    }

    .psdiag-badge {
        padding: 10px;
        min-height: auto;
    }

    .psdiag-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ≤ 600px : modal pleine largeur, ancré en bas (bottom-sheet) */
@media (max-width: 600px) {
    .psdiag-modal {
        align-items: flex-end;
    }

    .psdiag-modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
    }

    .psdiag-modal-body {
        max-height: calc(85vh - 64px);
    }

    .psdiag-modal-header {
        padding: 16px 20px;
    }

    .psdiag-modal-header h3 {
        font-size: 17px;
    }
}

/* Animation de chargement */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.psdiag-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

/* RGPD Checkbox */
.psdiag-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}

.psdiag-checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.psdiag-privacy-notice {
    display: block;
    margin-top: 8px;
    margin-left: 24px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}
