/* Base styles */
.amd-adimed-buzon-wrapper, .amd-adimed-floating-popup {
    perspective: 1000px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    font-family: sans-serif;
    z-index: 99999;
}

.amd-adimed-buzon-container {
    width: 100%;
    position: relative;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    height: 600px; /* Altura fija base */
    max-height: calc(100vh - 140px); /* Evita que se corte en pantallas pequeñas */
}

.amd-adimed-buzon-container.is-flipped {
    transform: rotateY(180deg);
}

.amd-adimed-flipper {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
}

.amd-adimed-front, .amd-adimed-back {
    width: 100%;
    height: 100%; /* Toma la altura del container */
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.2);
    overflow-y: auto; /* Permite scroll interno si el contenido es muy largo */
    box-sizing: border-box;
}

/* Custom scrollbar for webkit */
.amd-adimed-front::-webkit-scrollbar, .amd-adimed-back::-webkit-scrollbar {
    width: 6px;
}
.amd-adimed-front::-webkit-scrollbar-thumb, .amd-adimed-back::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.amd-adimed-front {
    background-color: #0b72b9; /* Color azul */
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    transition: transform 0.3s ease;
}

.amd-adimed-front:hover {
    transform: scale(1.02);
}

.amd-adimed-front-content h2 {
    font-size: 42px;
    font-weight: 300;
    margin-bottom: 25px;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.amd-adimed-front-content p {
    font-size: 22px;
    font-weight: 300;
    margin: 0 0 20px 0;
    color: #fff;
    line-height: 1.2;
}

.amd-click-hint {
    display: inline-block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    margin-top: 15px;
}

.amd-adimed-back {
    background-color: #fff;
    transform: rotateY(180deg);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.amd-anon-text {
    text-align: center;
    color: #38b6ff; /* Azul claro */
    font-size: 18px;
    margin-bottom: 30px;
    font-weight: 300;
}

/* Estilos de inputs tipo Material (línea inferior) */
.amd-adimed-buzon-form input[type="text"],
.amd-adimed-buzon-form input[type="date"],
.amd-adimed-buzon-form select {
    width: 100%;
    padding: 10px 0;
    margin-bottom: 25px;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    background-color: transparent;
    font-size: 15px;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.amd-adimed-buzon-form input[type="text"]:focus,
.amd-adimed-buzon-form input[type="date"]:focus,
.amd-adimed-buzon-form select:focus {
    outline: none;
    border-bottom: 2px solid #0b72b9;
}

/* Textarea tiene fondo gris claro */
.amd-adimed-buzon-form textarea {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: none;
    background-color: #f4f6fa;
    border-radius: 4px;
    font-size: 15px;
    color: #333;
    box-sizing: border-box;
    min-height: 100px;
    resize: vertical;
}

.amd-adimed-buzon-form textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(11, 114, 185, 0.2);
}

.amd-input-group {
    margin-bottom: 10px;
}

.amd-input-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-size: 14px;
}

.amd-required {
    color: #e74c3c;
}

.amd-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-bottom: 10px; /* extra padding at bottom */
}

.amd-adimed-submit, .amd-adimed-close {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: background 0.3s;
}

.amd-adimed-submit {
    background-color: #0b72b9;
    color: white;
}

.amd-adimed-submit:hover {
    background-color: #095992;
}

.amd-adimed-close {
    background-color: #e0e0e0;
    color: #333;
}

.amd-adimed-close:hover {
    background-color: #ccc;
}

.amd-adimed-response {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.amd-adimed-response.success {
    background-color: #d4edda;
    color: #155724;
}

.amd-adimed-response.error {
    background-color: #f8d7da;
    color: #721c24;
}

/* Floating Widget Styles */
.amd-adimed-floating-widget {
    position: fixed;
    top: 150px; /* Un poco más abajo del top */
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centra la etiqueta debajo del botón */
}

.amd-adimed-floating-label {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.amd-adimed-floating-popup {
    position: absolute;
    top: 0;
    right: 120px; /* Aparece a la izquierda del botón */
    width: 400px;
    max-width: calc(100vw - 150px);
    border-radius: 8px;
    transform-origin: top right;
    animation: amd-popup-in 0.3s ease forwards;
}

@keyframes amd-popup-in {
    from { opacity: 0; transform: scale(0.8) translateX(20px); }
    to { opacity: 1; transform: scale(1) translateX(0); }
}

.amd-adimed-floating-button {
    width: 100px;
    height: 100px;
    background-color: #0047a5; /* Azul oscuro basado en la nueva imagen */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 71, 165, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 10px;
    box-sizing: border-box;
}

.amd-adimed-floating-button:hover {
    transform: scale(1.05);
    background-color: #003682;
}

.amd-adimed-floating-button .amd-envelope-icon {
    width: 50px;
    height: 40px;
    margin-bottom: 5px;
}

.amd-adimed-floating-text {
    font-size: 13px;
    font-weight: bold;
    line-height: 1.1;
    text-align: center;
    letter-spacing: 0.2px;
}

.amd-adimed-floating-button.is-active {
    background-color: #e74c3c; /* Botón rojo de cerrar */
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    justify-content: center;
}

.amd-adimed-floating-button.is-active .amd-envelope-icon,
.amd-adimed-floating-button.is-active .amd-adimed-floating-text {
    display: none;
}

.amd-adimed-floating-button.is-active::after {
    content: "✕";
    font-size: 40px;
    font-weight: bold;
    font-family: sans-serif;
    display: block;
}
