/* WP Odontograma Styles */

.wp-odontograma-container {
    margin: 20px 0;
}

/* Seletor de dentes com botões */
.odontograma-teeth-selector {
    margin: 20px 0;
}

.teeth-section {
    margin: 15px 0;
}

.teeth-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 10px 0 12px;
    color: #333;
}

.teeth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

.tooth-btn {
    padding: 12px 8px;
    background-color: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    text-align: center;
}

.tooth-btn:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.tooth-btn.has-conditions {
    background-color: #4CAF50;
    color: white;
    border-color: #2E8B57;
}

.tooth-btn.has-conditions:hover {
    background-color: #45a049;
    border-color: #267E3A;
}

/* Modal */
.odontograma-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.odontograma-modal-overlay.active {
    display: flex;
}

.odontograma-modal {
    background-color: white;
    border-radius: 8px;
    max-width: 90%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.conditions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.condition-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.condition-item:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
}

.condition-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.condition-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    font-size: 15px;
    color: #333;
}

.condition-item input[type="checkbox"]:checked + label {
    font-weight: 600;
    color: #2E8B57;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.modal-btn-close {
    font-weight: 600;
}

.odontograma-container {
    position: relative;
    width: 100%;
    margin: 20px auto;
}

.odontograma {
    position: absolute;
    width: 100%;
    height: auto;
}

.hiddenImages {
    display: none !important;
}

.section-title {
    text-align: left;
}

.section-title h2 {
    margin: 20px 0 10px;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.inputLabelO2 {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.inputO2 {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.wp-odontograma-hidden-input {
    display: none;
}

.odontograma-container-images {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    position: relative;
    display: block;
    box-sizing: border-box;
}

/* Primeira imagem de fundo - aparece normalmente */
.odontograma-container-images img:nth-of-type(1) {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    z-index: 1;
    max-width: 100%;
}

/* Segunda imagem - sobreposta na primeira */
.odontograma-container-images img:nth-of-type(2) {
    width: 100%;
    height: auto;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    max-width: 100%;
    box-sizing: border-box;
}

/* Containers de imagens internas - overlay */
.odontograma-container-images .img-container,
.odontograma-container-images .img-sub-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 3;
}

.odontograma-container-images .img-container img,
.odontograma-container-images .img-sub-container img {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    object-fit: contain;
}

/* Responsivo - Tablet (até 768px) */
@media (max-width: 768px) {
    .teeth-grid {
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
        gap: 6px;
    }

    .tooth-btn {
        padding: 10px 6px;
        font-size: 12px;
    }

    .teeth-section h3 {
        font-size: 14px;
        margin: 8px 0 10px;
    }

    .odontograma-modal {
        max-width: 95%;
        max-height: 85vh;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .modal-body {
        padding: 15px;
    }

    .condition-item {
        padding: 10px;
        font-size: 14px;
    }

    .condition-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 10px;
    }

    .odontograma-teeth-selector {
        margin: 15px 0;
    }

    .teeth-section {
        margin: 10px 0;
    }

    .odontograma-container-images {
        width: 95% !important;
        margin: 15px auto;
    }

    .section-title h2 {
        font-size: 20px;
        margin: 15px 0 8px;
    }
}

/* Responsivo - Mobile (até 600px) */
@media (max-width: 600px) {
    .odontograma-teeth-selector {
        margin: 10px 0;
        padding: 0 5px;
    }

    .teeth-section {
        margin: 8px 0;
    }

    .teeth-section h3 {
        font-size: 13px;
        margin: 6px 0 8px;
    }

    .teeth-grid {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 5px;
        margin-bottom: 10px;
    }

    .tooth-btn {
        padding: 8px 4px;
        font-size: 11px;
        border-radius: 4px;
    }

    .odontograma-modal {
        max-width: 98%;
        max-height: 80vh;
        border-radius: 6px;
    }

    .modal-header {
        padding: 12px 15px;
    }

    .modal-header h3 {
        font-size: 15px;
    }

    .modal-close {
        width: 26px;
        height: 26px;
        font-size: 24px;
    }

    .modal-body {
        padding: 12px 15px;
        max-height: calc(80vh - 100px);
        overflow-y: auto;
    }

    .conditions-list {
        gap: 8px;
    }

    .condition-item {
        padding: 8px;
        font-size: 13px;
    }

    .condition-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .condition-item label {
        font-size: 13px;
    }

    .modal-footer {
        padding: 12px 15px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .wp-odontograma-container {
        margin: 5px 0;
        padding: 0 5px;
    }

    .odontograma-container-images {
        width: 100% !important;
        margin: 10px auto;
    }

    .odontograma-container-images img:nth-of-type(1),
    .odontograma-container-images img:nth-of-type(2) {
        width: 100%;
        height: auto;
    }

    .section-title h2 {
        font-size: 16px;
        margin: 10px 0 5px;
    }

    .section-title {
        text-align: center;
    }
}

/* Responsivo - Mobile pequeno (até 480px) */
@media (max-width: 480px) {
    .odontograma-teeth-selector {
        margin: 8px 0;
        padding: 0 3px;
    }

    .teeth-section {
        margin: 6px 0;
    }

    .teeth-section h3 {
        font-size: 12px;
        margin: 5px 0 7px;
    }

    .teeth-grid {
        grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
        gap: 4px;
        margin-bottom: 8px;
    }

    .tooth-btn {
        padding: 6px 3px;
        font-size: 10px;
        border-width: 1px;
    }

    .odontograma-modal {
        max-width: 100%;
        max-height: 75vh;
        border-radius: 0;
        max-height: calc(100vh - 20px);
    }

    .modal-header {
        padding: 10px 12px;
    }

    .modal-header h3 {
        font-size: 14px;
    }

    .modal-close {
        width: 24px;
        height: 24px;
        font-size: 22px;
    }

    .modal-body {
        padding: 10px 12px;
        max-height: calc(75vh - 90px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .conditions-list {
        gap: 6px;
    }

    .condition-item {
        padding: 6px;
        font-size: 12px;
        border-radius: 3px;
    }

    .condition-item input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }

    .condition-item label {
        font-size: 12px;
    }

    .modal-footer {
        padding: 10px 12px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .wp-odontograma-container {
        margin: 5px 0;
        padding: 0 3px;
    }

    .odontograma-container-images {
        width: 100% !important;
        margin: 8px auto;
    }

    .section-title h2 {
        font-size: 14px;
        margin: 8px 0 4px;
    }
}

/* Responsivo - Desktop (acima de 768px) */
@media (min-width: 769px) {
    .teeth-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    }

    .odontograma-modal {
        max-width: 500px;
    }

    .odontograma-container-images {
        width: 70% !important;
    }
}
